Compare commits

...

2 Commits

2 changed files with 29 additions and 4 deletions

View File

@ -48,7 +48,19 @@
# This function produces a module that adds the home-manager module to the
# system and configures the given module to the user's Home Manager
# configuration
homeManagerInit = {system, username ? _username , module}: { config, lib, pkgs, ... }: {
homeManagerInit = {system, username ? _username , module ? _ : {}, userModules ? { ${username} = [ module ] ;}, stateVersion }:
{ config, lib, pkgs, ... }:
let
mapUserModules = lib.attrsets.mapAttrs (user: modules: {...}:
{
imports = modules;
config = {
home = { inherit stateVersion; };
};
});
users = mapUserModules userModules;
in
{
imports = [
inputs.home-manager.nixosModules.home-manager
];
@ -56,7 +68,7 @@
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = module;
inherit users;
extraSpecialArgs = {
inherit inputs outputs vars;
extraPkgs = mkExtraPkgs system;
@ -66,14 +78,23 @@
# This function produces a nixosSystem which imports configuration.nix and
# a Home Manager home.nix for the given user from ./hosts/${hostname}/
mkSystem = {system, hostname, username ? _username}:
mkSystem = {system, hostname, username ? _username, stateVersion}:
lib.nixosSystem {
inherit system;
modules = [
({pkgs, config, lib, ...}@args:
{
# Values for every single system that would not conceivably need
# to be made modular
system.stateVersion = stateVersion;
# not having the freedom to install unfree programs is unfree
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = ["nix-command" "flakes" ];
})
./hosts/${hostname}/configuration.nix
(homeManagerInit {
module = import ./hosts/${hostname}/home.nix;
inherit username system;
inherit username system stateVersion;
})
];
specialArgs = {
@ -110,6 +131,7 @@
(homeManagerInit {
module = import ./hosts/slab/home.nix;
inherit system;
stateVersion = "23.11";
})
];
specialArgs = {
@ -128,6 +150,7 @@
(homeManagerInit {
module = import ./hosts/nullbox/home.nix;
inherit system;
stateVersion = "23.11";
})
];
};

2
home/root.nix Normal file
View File

@ -0,0 +1,2 @@
{ config, lib, pkgs, ... }@args:
{ }