Refactor the whole configuration

Reviewed-on: #1
This commit is contained in:
caem 2025-02-01 14:05:15 +01:00
parent fb5d4d46f8
commit 6cb66d86d2
153 changed files with 2078 additions and 3094 deletions

View file

@ -1,7 +1,5 @@
{ lib }:
# todo: Write a function to import all of these automatically
let
fs = import ./fs.nix { inherit lib; };
hosts = import ./hosts.nix { inherit lib; };

View file

@ -5,6 +5,12 @@
path: let
dirs = builtins.readDir path;
in
builtins.filter (name: dirs.${name} == "directory") (builtins.attrNames dirs);
builtins.filter (type: dirs.${type} == "directory") (builtins.attrNames dirs);
getModuleImports =
path: let
files = builtins.attrNames (builtins.removeAttrs (builtins.readDir path) ["default.nix"]);
in
map (file: "${path}/${file}") files;
}

View file

@ -2,15 +2,23 @@
{
mkHosts = {
modules,
nixpkgs,
inputs,
modules,
user,
}: builtins.listToAttrs (builtins.map (host: {
name = host;
value = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = modules ++ [ ../hosts/${host} ];
specialArgs = { inherit inputs; };
modules = modules ++ [
../hosts/${host}
../modules/nixos/user/${user}.nix
];
specialArgs = {
inherit inputs lib;
username = user;
cfgPath = ../.;
};
};
}) (lib.getDirsInDir ../hosts));
}