hehehehehe, got multi user config started. now, somehow, fix home-manager to work per user...

This commit is contained in:
Chris Kruining 2025-03-16 23:28:04 +01:00
parent b139021f8e
commit 00e0fae167
5 changed files with 12 additions and 9 deletions

View file

@ -1,5 +1,5 @@
{}: {}:
{ {
full_name = "WOOOP WOOOP"; full_name = "WOOOP WOOOP";
is_trusted = true; is_trusted = false;
} }

View file

@ -8,7 +8,7 @@
inherit (inputs.nixpkgs.lib) nixosSystem; inherit (inputs.nixpkgs.lib) nixosSystem;
inherit (builtins) baseNameOf elem; inherit (builtins) baseNameOf elem;
inherit (lib.attrsets) filterAttrs; inherit (lib.attrsets) filterAttrs;
inherit (lib.modules) mkDefault; inherit (lib.modules) mkDefault mkIf;
inherit (lib.strings) removeSuffix; inherit (lib.strings) removeSuffix;
inherit (self.modules) mapModules; inherit (self.modules) mapModules;
inherit (self) mkSysUser mkHmUser; inherit (self) mkSysUser mkHmUser;
@ -37,7 +37,7 @@ in rec
imports = [ "${path}/hardware.nix" ]; imports = [ "${path}/hardware.nix" ];
users = { users = {
mutableUsers = false; mutableUsers = true; # Set this to false when I get sops with passwords set up properly
users = mapModules "${path}/users" mkSysUser; users = mapModules "${path}/users" mkSysUser;
}; };
home-manager = { home-manager = {

View file

@ -10,10 +10,10 @@ in rec
in in
{ {
inherit name; inherit name;
inherit (user) is_trusted;
description = user.full_name; description = user.full_name;
extraGroups = (if user.is_trusted then [ "wheel" ] else []); extraGroups = (user.groups or []) ++ (if user.is_trusted then [ "wheel" ] else []);
isNormalUser = true; isNormalUser = true;
initialPassword = "kaas";
home = "/home/${name}"; home = "/home/${name}";
group = "users"; group = "users";
}; };

View file

@ -36,10 +36,13 @@ in
users.users.${config.user.name} = mkAliasDefinitions options.user; users.users.${config.user.name} = mkAliasDefinitions options.user;
nix.settings = let # Temp solution...
inherit (lib) attrNames filterAttrs; home-manager.users.${config.user.name}.home.stateVersion = "23.11";
users = (attrNames (filterAttrs ({ is_trusted ? false }: is_trusted) config.users)) ++ [ "root" ]; nix.settings = let
inherit (lib) elem attrNames filterAttrs;
users = (attrNames (filterAttrs (name: user: elem "wheel" (user.extraGroups or [])) config.users.users));# ++ [ "root" ];
in in
{ {
trusted-users = users; trusted-users = users;

View file

@ -1,4 +1,4 @@
{ config, options, lib, pkgs, ... }: { config, options, lib, pkgs, inputs, ... }:
let let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
in in