From 00e0fae1674a47be89a163b92c3100e99da6b481 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Sun, 16 Mar 2025 23:28:04 +0100 Subject: [PATCH] hehehehehe, got multi user config started. now, somehow, fix home-manager to work per user... --- hosts/chris-pc/users/{Kaas => kaas}/default.nix | 2 +- lib/nixos.nix | 4 ++-- lib/user.nix | 4 ++-- modules/options.nix | 9 ++++++--- modules/services/games/minecraft.nix | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) rename hosts/chris-pc/users/{Kaas => kaas}/default.nix (62%) diff --git a/hosts/chris-pc/users/Kaas/default.nix b/hosts/chris-pc/users/kaas/default.nix similarity index 62% rename from hosts/chris-pc/users/Kaas/default.nix rename to hosts/chris-pc/users/kaas/default.nix index f5e5722..e288dfc 100644 --- a/hosts/chris-pc/users/Kaas/default.nix +++ b/hosts/chris-pc/users/kaas/default.nix @@ -1,5 +1,5 @@ {}: { full_name = "WOOOP WOOOP"; - is_trusted = true; + is_trusted = false; } diff --git a/lib/nixos.nix b/lib/nixos.nix index 76e94c9..7040a34 100644 --- a/lib/nixos.nix +++ b/lib/nixos.nix @@ -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 = { diff --git a/lib/user.nix b/lib/user.nix index e7046b9..5117265 100644 --- a/lib/user.nix +++ b/lib/user.nix @@ -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"; }; diff --git a/modules/options.nix b/modules/options.nix index 90872bd..39a87af 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -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; diff --git a/modules/services/games/minecraft.nix b/modules/services/games/minecraft.nix index e5478e8..c606082 100644 --- a/modules/services/games/minecraft.nix +++ b/modules/services/games/minecraft.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, ... }: +{ config, options, lib, pkgs, inputs, ... }: let inherit (lib.modules) mkIf; in