example refactor snowflake module system
This commit is contained in:
parent
0314109bc0
commit
3e29615db9
26 changed files with 1306 additions and 165 deletions
26
nix/snow/flake/modules/nixpkgs.nix
Normal file
26
nix/snow/flake/modules/nixpkgs.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Nixpkgs module. The only exception to the rule.
|
||||
#
|
||||
# Provides a `pkgs` argument in `perSystem`.
|
||||
#
|
||||
# Arguably, this shouldn't be in flake-parts, but in nixpkgs.
|
||||
# Nixpkgs could define its own module that does this, which would be
|
||||
# a more consistent UX, but for now this will do.
|
||||
#
|
||||
# The existence of this module does not mean that other flakes' logic
|
||||
# will be accepted into flake-parts, because it's against the
|
||||
# spirit of Flakes.
|
||||
#
|
||||
{
|
||||
config = {
|
||||
perSystem = { inputs', lib, ... }: {
|
||||
config = {
|
||||
_module.args.pkgs = lib.mkOptionDefault (
|
||||
builtins.seq
|
||||
(inputs'.nixpkgs or (throw "flake-parts: The flake does not have a `nixpkgs` input. Please add it, or set `perSystem._module.args.pkgs` yourself."))
|
||||
inputs'.nixpkgs.legacyPackages
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue