Simplify trying to import files
This commit is contained in:
parent
808926f012
commit
2cce1f0b2e
1 changed files with 77 additions and 77 deletions
24
flake.nix
24
flake.nix
|
@ -8,6 +8,17 @@
|
|||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, sops-nix }: (
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
tryFiles = files: default:
|
||||
lib.lists.foldr
|
||||
(a: b:
|
||||
if builtins.pathExists a
|
||||
then a
|
||||
else b)
|
||||
default
|
||||
files;
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
|
@ -75,18 +86,7 @@
|
|||
})
|
||||
sops-nix.nixosModules.sops
|
||||
./lib/configuration.nix
|
||||
(
|
||||
let
|
||||
configCandidate = ./lib/machines/${name}.nix;
|
||||
|
||||
machineConfigPath =
|
||||
if builtins.pathExists configCandidate
|
||||
then
|
||||
configCandidate
|
||||
else
|
||||
./lib/hardware/base.nix;
|
||||
in
|
||||
machineConfigPath)
|
||||
(tryFiles [ ./lib/machines/${name}.nix ] ./lib/hardware/base.nix)
|
||||
];
|
||||
})
|
||||
systems;
|
||||
|
|
Loading…
Reference in a new issue