mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-06 01:36:37 +02:00
flake: Don't dynamically declare nixosConfigurations
This makes it easier to add hosts that have multiple nixosConfigurations due to compiling for different architectures.
This commit is contained in:
parent
663c89148b
commit
0384654ee4
36
flake.nix
36
flake.nix
@ -27,10 +27,23 @@
|
|||||||
inherit (nixpkgs.legacyPackages.x86_64-linux) nixpkgs-fmt callPackage;
|
inherit (nixpkgs.legacyPackages.x86_64-linux) nixpkgs-fmt callPackage;
|
||||||
inherit (builtins) attrNames listToAttrs map replaceStrings readDir;
|
inherit (builtins) attrNames listToAttrs map replaceStrings readDir;
|
||||||
|
|
||||||
flakeOutputs = [ "overlays" "nixosModules" "nixosConfigurations" "homeManagerModules" "packages" "checks" ];
|
flakeOutputs = [ "overlays" "nixosModules" "homeManagerModules" "packages" "checks" ];
|
||||||
flakeDirectories = [ "overlays" "modules" "hardware" "home" "packages" "tests" ];
|
flakeDirectories = [ "overlays" "modules" "home" "packages" "tests" ];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
nixosConfigurations =
|
||||||
|
{
|
||||||
|
nixos = nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = attrs // { nix-config = self; };
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
./.
|
||||||
|
./hardware/laptop.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
formatter.x86_64-linux = nixpkgs-fmt;
|
formatter.x86_64-linux = nixpkgs-fmt;
|
||||||
} //
|
} //
|
||||||
(listToAttrs
|
(listToAttrs
|
||||||
@ -44,10 +57,7 @@
|
|||||||
attributeValue = (listToAttrs
|
attributeValue = (listToAttrs
|
||||||
(map
|
(map
|
||||||
(file: {
|
(file: {
|
||||||
name =
|
name = replaceStrings [ ".nix" ] [ "" ] file;
|
||||||
if file == "laptop.nix"
|
|
||||||
then "nixos"
|
|
||||||
else replaceStrings [ ".nix" ] [ "" ] file;
|
|
||||||
value =
|
value =
|
||||||
if directory == "packages"
|
if directory == "packages"
|
||||||
then callPackage ./${directory}/${file} { }
|
then callPackage ./${directory}/${file} { }
|
||||||
@ -59,19 +69,7 @@
|
|||||||
inherit self;
|
inherit self;
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
}
|
}
|
||||||
else
|
else import ./${directory}/${file};
|
||||||
if directory == "hardware"
|
|
||||||
then
|
|
||||||
nixosSystem
|
|
||||||
{
|
|
||||||
system = "x86_64-linux";
|
|
||||||
specialArgs = attrs // { nix-config = self; };
|
|
||||||
modules = [
|
|
||||||
./.
|
|
||||||
./${directory}/${file}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
else import ./${directory}/${file};
|
|
||||||
})
|
})
|
||||||
(attrNames (readDir ./${directory}))));
|
(attrNames (readDir ./${directory}))));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user