diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/default.nix | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix index 989920d..f720a08 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -28,6 +28,20 @@ let { # This function's return value can be used as pkgs.populate input. source: sanitize (eval source).config.source; + # Inputs a source draws from other sources, as list of attribute sets like + # { path = [ "stockholm" "nixpkgs" ]; source = "nixpkgs"; }. + flakeFollows = source: let + flatten = prefix: inputs: lib.concatLists (lib.mapAttrsToList + (name: input: + lib.optional (input.follows or null != null) { + path = prefix ++ [ name ]; + source = input.follows; + } ++ + flatten (prefix ++ [ name ]) (input.inputs or {})) + inputs); + in + flatten [] (source.${source.type}.inputs or {}); + maybeHostName = default: let # We're parsing /etc/hostname here because reading # /proc/sys/kernel/hostname yields "" |
