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";
is_trusted = true;
is_trusted = false;
}

View file

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

View file

@ -10,10 +10,10 @@ in rec
in
{
inherit name;
inherit (user) is_trusted;
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;
initialPassword = "kaas";
home = "/home/${name}";
group = "users";
};

View file

@ -36,10 +36,13 @@ in
users.users.${config.user.name} = mkAliasDefinitions options.user;
nix.settings = let
inherit (lib) attrNames filterAttrs;
# Temp solution...
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
{
trusted-users = users;

View file

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