Add a separate file for the try-files function

This commit is contained in:
Manuel Thalmann 2024-05-09 01:04:55 +02:00
parent 0d399b63b9
commit 742b1d2029
2 changed files with 10 additions and 8 deletions

View file

@ -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:

9
lib/utils/try-files.nix Normal file
View file

@ -0,0 +1,9 @@
{ lib, ... }:
files: default:
lib.lists.foldr
(a: b:
if (a != null) && (builtins.pathExists a)
then a
else b)
default
files