dotfiles/lib/default.nix

34 lines
776 B
Nix
Raw Normal View History

{ nixpkgs, self, ... } @ inputs:
let
inherit (nixpkgs) lib;
in rec {
mkSystems = builtins.mapAttrs (hostName: cfg: lib.nixosSystem {
inherit (cfg) system;
specialArgs = {inherit self inputs;};
modules = [
{
networking = {inherit hostName;};
nixpkgs.hostPlatform = cfg.system;
}
self.nixosModules.default
cfg.module
];
});
recReadDir = startDir: dir: lib.concatMapAttrs (file: type: let
fullFile = "${dir}/${file}";
in
if type == "directory" then recReadDir startDir fullFile
else {${fullFile} = "${startDir}/${fullFile}";}
) (builtins.readDir "${startDir}/${dir}");
filterNixReadDir = dir: lib.filterAttrs (name: _:
builtins.match ".*\\.nix" name == null
) (recReadDir dir ".");
}