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: mkSystem = hostname:
nixosSystem { nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules =
[
../modules/common.nix ../modules/common.nix
../overlays
# ({...}: nixpkgs.overlays = [ import ../overlays {}; ])
(_:
{ nixpkgs.overlays = import ../overlays _ ++
[inputs.pinix.overlays.default]; })
] ]
++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostname}")); ++ filter
isNixFile
(listFilesRecursive (../. + "/hosts/${hostname}"));
specialArgs = {inherit inputs mkRune;}; specialArgs = {inherit inputs mkRune;};
}; };

View File

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