diff --git a/flake.nix b/flake.nix index c624e9f..27bbe08 100644 --- a/flake.nix +++ b/flake.nix @@ -30,14 +30,7 @@ }; systems = builtins.mapAttrs (name: value: defaultMachine // value) machines; - tryFiles = files: default: - lib.lists.foldr - (a: b: - if (a != null) && (builtins.pathExists a) - then a - else b) - default - files; + tryFiles = import ./lib/utils/try-files.nix { inherit lib; }; in flake-utils.lib.eachDefaultSystem ( system: diff --git a/lib/utils/try-files.nix b/lib/utils/try-files.nix new file mode 100644 index 0000000..c71e5fc --- /dev/null +++ b/lib/utils/try-files.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + files: default: + lib.lists.foldr + (a: b: + if (a != null) && (builtins.pathExists a) + then a + else b) + default + files