2023-12-17 13:33:15 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "nixpkgs/nixos-23.11";
|
|
|
|
nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";
|
2024-04-06 12:00:33 +00:00
|
|
|
|
|
|
|
colmena = {
|
|
|
|
url = "github:zhaofengli/colmena";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-03-24 18:02:31 +00:00
|
|
|
|
2023-12-17 13:33:15 +00:00
|
|
|
home-manager = {
|
|
|
|
url = "github:nix-community/home-manager/release-23.11";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-24 18:02:45 +00:00
|
|
|
outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, colmena, ... }:
|
2024-03-24 18:02:29 +00:00
|
|
|
let
|
|
|
|
inherit (self) outputs;
|
2024-03-24 18:02:30 +00:00
|
|
|
systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
2024-03-24 18:02:29 +00:00
|
|
|
forAllSystems = lib.genAttrs systems;
|
|
|
|
lib = nixpkgs.lib // home-manager.lib;
|
|
|
|
in
|
2024-03-24 18:02:31 +00:00
|
|
|
rec {
|
2024-03-24 18:02:29 +00:00
|
|
|
inherit lib;
|
|
|
|
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
|
2024-03-24 18:02:29 +00:00
|
|
|
|
|
|
|
devShells = forAllSystems (system:
|
2024-03-24 18:02:45 +00:00
|
|
|
let pkgs = import nixpkgs { system = system; }; in {
|
2024-03-24 18:02:32 +00:00
|
|
|
default = pkgs.mkShell {
|
2024-04-01 18:33:14 +00:00
|
|
|
nativeBuildInputs = [ pkgs.nix pkgs.colmena pkgs.just pkgs.git pkgs.home-manager pkgs.nixos-rebuild ];
|
2024-03-24 18:02:32 +00:00
|
|
|
shellHook = "exec $SHELL";
|
|
|
|
};
|
2024-03-24 18:02:30 +00:00
|
|
|
});
|
2024-03-24 18:02:22 +00:00
|
|
|
|
2024-04-06 12:00:33 +00:00
|
|
|
colmena =
|
|
|
|
let
|
|
|
|
hosts = lib.genAttrs (builtins.attrNames (builtins.readDir ./hosts)) (name: { });
|
|
|
|
in
|
|
|
|
{
|
|
|
|
meta = {
|
|
|
|
description = "All my NixoS machines";
|
|
|
|
specialArgs = {
|
|
|
|
inherit inputs outputs;
|
|
|
|
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
|
|
|
};
|
|
|
|
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
2024-03-24 18:02:32 +00:00
|
|
|
};
|
2024-03-24 18:02:25 +00:00
|
|
|
|
2024-04-06 12:00:33 +00:00
|
|
|
defaults = { lib, config, name, ... }: {
|
|
|
|
imports = [ ./hosts/${name} ./profiles/base ];
|
2024-03-24 18:02:32 +00:00
|
|
|
|
2024-04-06 12:00:33 +00:00
|
|
|
networking.hostName = name;
|
|
|
|
|
|
|
|
home-manager.extraSpecialArgs = {
|
|
|
|
inherit inputs outputs;
|
|
|
|
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
|
|
|
};
|
2024-03-24 18:02:32 +00:00
|
|
|
};
|
2024-04-06 12:00:33 +00:00
|
|
|
} // hosts;
|
2024-03-24 18:02:32 +00:00
|
|
|
|
2024-04-06 12:00:33 +00:00
|
|
|
colmenaHive = inputs.colmena.lib.makeHive colmena;
|
2024-03-24 18:02:30 +00:00
|
|
|
|
2024-04-01 18:23:27 +00:00
|
|
|
nixosConfigurations = { } // colmenaHive.nodes;
|
|
|
|
|
|
|
|
packages.x86_64-linux.iso = self.nixosConfigurations.iso.config.system.build.isoImage;
|
2024-03-24 18:02:45 +00:00
|
|
|
|
2024-03-24 18:03:19 +00:00
|
|
|
homeConfigurations =
|
2024-03-24 18:02:30 +00:00
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
|
|
in
|
2024-04-06 12:00:33 +00:00
|
|
|
lib.genAttrs (builtins.attrNames (builtins.readDir ./users)) (name: lib.homeManagerConfiguration {
|
|
|
|
inherit pkgs;
|
|
|
|
modules = [ ./users/${name}/home.nix ];
|
|
|
|
extraSpecialArgs = {
|
|
|
|
inherit inputs outputs;
|
|
|
|
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
|
|
|
};
|
|
|
|
});
|
2023-12-17 13:33:15 +00:00
|
|
|
};
|
|
|
|
}
|