Add stateVersion and multi-user to homeManagerInit
This commit is contained in:
parent
dd1ef4cf6c
commit
750fb580e1
32
flake.nix
32
flake.nix
@ -47,14 +47,19 @@
|
|||||||
# This function produces a module that adds the home-manager module to the
|
# 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
|
# system and configures the given module to the user's Home Manager
|
||||||
# configuration
|
# configuration
|
||||||
homeManagerInit = {system, username ? _username , module ? _ : {}, users ? { ${username} = module;} }:
|
homeManagerInit = {system, username ? _username , module ? _ : {}, userModules ? { ${username} = [ module ] ;}, stateVersion }:
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
# TODO ooprs i forgor home-manager needs a state version and i currently
|
mapUserModules = lib.attrsets.mapAttrs (user: modules: {...}:
|
||||||
# don't pass the system name to this so there is no way to derive this
|
{
|
||||||
# value properly and it should probably be derived with mkSystem
|
imports = modules;
|
||||||
users = users // { root = ./home/root.nix;};
|
config = {
|
||||||
|
home = { inherit stateVersion; };
|
||||||
|
};
|
||||||
|
});
|
||||||
|
users = mapUserModules userModules;
|
||||||
in
|
in
|
||||||
{ config, lib, pkgs, ... }: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
];
|
];
|
||||||
@ -72,14 +77,23 @@
|
|||||||
|
|
||||||
# This function produces a nixosSystem which imports configuration.nix and
|
# This function produces a nixosSystem which imports configuration.nix and
|
||||||
# a Home Manager home.nix for the given user from ./hosts/${hostname}/
|
# 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 {
|
lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
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
|
./hosts/${hostname}/configuration.nix
|
||||||
(homeManagerInit {
|
(homeManagerInit {
|
||||||
module = import ./hosts/${hostname}/home.nix;
|
module = import ./hosts/${hostname}/home.nix;
|
||||||
inherit username system;
|
inherit username system stateVersion;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
@ -116,6 +130,7 @@
|
|||||||
(homeManagerInit {
|
(homeManagerInit {
|
||||||
module = import ./hosts/slab/home.nix;
|
module = import ./hosts/slab/home.nix;
|
||||||
inherit system;
|
inherit system;
|
||||||
|
stateVersion = "23.11";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
@ -134,6 +149,7 @@
|
|||||||
(homeManagerInit {
|
(homeManagerInit {
|
||||||
module = import ./hosts/nullbox/home.nix;
|
module = import ./hosts/nullbox/home.nix;
|
||||||
inherit system;
|
inherit system;
|
||||||
|
stateVersion = "23.11";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user