cerulean/nix/snow/flake/default.nix

59 lines
1.2 KiB
Nix
Raw Normal View History

{
this,
inputs,
systems,
...
}: let
2026-03-14 21:01:02 +10:00
inherit
(builtins)
attrNames
concatStringsSep
filter
length
warn
;
inherit (inputs.nixpkgs) lib;
in {
# snow.flake
flake = flakeInputs: root: let
snowflake = lib.evalModules {
class = "snowflake";
2026-03-14 21:01:02 +10:00
specialArgs = let
2026-03-14 22:18:28 +10:00
reservedSpecialArgs = {
2026-03-14 21:01:02 +10:00
inherit (this) snow;
inherit systems root;
inputs = flakeInputs;
};
warnIfReserved = let
getReservedNames = names:
2026-03-14 22:18:28 +10:00
reservedSpecialArgs
2026-03-14 21:01:02 +10:00
|> attrNames
|> filter (name: names?${name});
reservedNames =
flakeInputs
|> attrNames
|> getReservedNames;
in
(length reservedNames == 0)
|| warn ''
2026-03-14 22:18:28 +10:00
[snow] Your `flake.nix` declares inputs with reserved names!
2026-03-14 21:01:02 +10:00
[snow] These will be accessible only via `inputs.''${NAME}`
[snow] Please rename the following:
[snow] ${concatStringsSep reservedNames ", "}
''
true;
in
assert warnIfReserved;
2026-03-14 22:18:28 +10:00
flakeInputs // reservedSpecialArgs;
modules = [
./module.nix
];
};
in
snowflake.config.outputs;
}