improve module system more

This commit is contained in:
Daylin Morgan 2024-02-15 12:01:08 -06:00
parent daf4845e6e
commit 208e54b34c
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
2 changed files with 24 additions and 21 deletions

View file

@ -32,15 +32,14 @@ in rec {
mkSystem = hostname:
nixosSystem {
system = "x86_64-linux";
modules = [
modules =
[
../modules/common.nix
# ({...}: nixpkgs.overlays = [ import ../overlays {}; ])
(_:
{ nixpkgs.overlays = import ../overlays _ ++
[inputs.pinix.overlays.default]; })
../overlays
]
++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostname}"));
++ filter
isNixFile
(listFilesRecursive (../. + "/hosts/${hostname}"));
specialArgs = {inherit inputs mkRune;};
};

View file

@ -1,14 +1,18 @@
# import all nix files in the current folder,
# and execute them with args as parameters
# The return value is a list of all execution results,
# which is the list of overlays
args:
# execute and import all overlay files in the current
# directory with the given args
builtins.map
# execute and import the overlay file
(f: (import (./. + "/${f}") args))
# find all overlay files in the current directory
(builtins.filter
(f: f != "default.nix")
(builtins.attrNames (builtins.readDir ./.)))
{inputs, ...}: let
defaultOverlays =
# execute and import all overlay files in the current
# directory with the given args
builtins.map
# execute and import the overlay file
(f: (import (./. + "/${f}") {inherit inputs;}))
# find all overlay files in the current directory
(builtins.filter
(f: f != "default.nix")
(builtins.attrNames (builtins.readDir ./.)));
in {
nixpkgs.overlays =
defaultOverlays
++ [
inputs.pinix.overlays.default
];
}