diff --git a/hosts/fennecBox/configuration.nix b/hosts/fennecBox/configuration.nix index 766cda4..e413cd4 100755 --- a/hosts/fennecBox/configuration.nix +++ b/hosts/fennecBox/configuration.nix @@ -113,14 +113,6 @@ "nix-command" ]; - # Enable the GNOME Desktop Environment. - services.displayManager.gdm.enable = true; - services.desktopManager.gnome.enable = true; - programs.hyprland = { - enable = true; - withUWSM = true; - systemd.setPath.enable = true; - }; services.userborn.enable = true; # Configure keymap in X11 diff --git a/users/Sk7Str1p3/about.json b/users/Sk7Str1p3/about.json index aa1cf2d..843ab19 100644 --- a/users/Sk7Str1p3/about.json +++ b/users/Sk7Str1p3/about.json @@ -5,6 +5,7 @@ ], "shell": "nushell", "realName": "ENC[AES256_GCM,data:KBIRbQWsz6n1nAZ2rtGfCdSoQiTrRchpqA==,iv:mD0Rx4GHSJcQhPCa4fxZgYgqYkwzaRQVe50I+bgML04=,tag:ZcrOoRAVOoUKPktL5Dpi/g==,type:str]", + "session": "co:niri", "sops": { "age": [ { @@ -12,8 +13,8 @@ "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB2Skp6cGdweFBaZUM2eXRC\nTHExSmtCZU53OXZWZDl3VFFMb1FSdFhkaUhnCnhiSUNQSkZZQ2htTTVxd1Nleitq\nSVV4WmFrdXNUVVU5L0RONHpMUlB2UDgKLS0tIE9UTC9qeEQ0MFlSUFhwdW9NeXYw\nelVGZ0ZYUzFoVXdibmpjTyt1ZHYxaTgKnD3m3Ceq0OT27s2OAWF+gLh5f6Xv3cpp\n28Q3JLG+FpYlBaszOdsWInouCf50tYItWHhQU3gmkhrJsA9gljOAOw==\n-----END AGE ENCRYPTED FILE-----\n" } ], - "lastmodified": "2026-05-02T21:33:32Z", - "mac": "ENC[AES256_GCM,data:sqPuXb7Dnr9jOULMIeILhQUbj0WUdE+aQrRiyMok0GlfKDRoIM0SIxG8gKBnnZbzbd5wBu4Hf+HzbBj4RfkfAOQDXMdqR95teSIj4l1a8is/VOllLY/5iC1zTg2ShKsq2VbQJ2c9EG6QYKZABp504+XG0urGIrNgrnqyMwT3/sY=,iv:fwhLVEShUiLNolcg1LBesWupVlh4oCHtyXfFsjqYRqQ=,tag:sKbwSa7nhrRdtzV30FDOQw==,type:str]", + "lastmodified": "2026-05-07T15:31:42Z", + "mac": "ENC[AES256_GCM,data:ouXlr7xwQj05RtKc1VKByybKSuXtLk9UXxnE7JSofmVdXzPc7k4atejrWyrWa6weJonpPMldnuyXBiy2RzIHLF8nyvbyCik8o5r4pJ7LlgCHvxM5B2itN/nWCR8Ave9ijBrMk1HQLE4wodUstehnigwkmfMn6phsQEnWY9vYV2c=,iv:vX1/zN+RUDvJnrnMC/KFDKRkWJdFNd12MdH32Y4nNlY=,tag:3aP34p6oaAX8luIUc7eilA==,type:str]", "encrypted_regex": "^realName$", "version": "3.12.1" } diff --git a/users/default.nix b/users/default.nix index a3e282f..2c64351 100644 --- a/users/default.nix +++ b/users/default.nix @@ -7,6 +7,11 @@ - `realName`: User's real name (optionally) - `extraGroups`: groups (optionally) - `shell`: User's shell + - `session`: User's default graphical session (optionally) + + Session must have format of "{type}:{session}" where type is one of `co` (short for "compositor") and `de` (short for "desktop environment"). + This `type` is actually important, because it depends where nix will search corresponding option for enabling your session. + If `co`, it will search it in `programs.*`, and if `de`, in `services.desktopManager.*` User's face (optionally) - if any, should be located at users/{user}/face.png @@ -69,4 +74,52 @@ }) cfg.usersList ) }; + + # Configure DM and users' default sessions + services.displayManager.gdm.enable = true; + systemd.tmpfiles.settings."20-gdm-default-session" = lib.mkMerge ( + map (user: { + "/run/tmpfiles/var/lib/AccountsService/users/${user}".f = { + argument = "${lib.generators.toINI { } { + User = { + Session = builtins.toString ( + builtins.tail ( + lib.splitString ":" (builtins.fromJSON (builtins.readFile ./${user}/about.json)).session + ) + ); + SystemAccount = false; + } + // ( + let + pic = ./${user}/face.png; + in + if builtins.pathExists pic then { Icon = "${pic}"; } else { } + ); + }}"; + }; + "/var/lib/AccountsService/users/${user}"."L+" = { + argument = "/run/tmpfiles/var/lib/AccountsService/users/${user}"; + }; + }) cfg.usersList + ); } +// (lib.foldl (acc: elem: acc // elem) { } ( + map ( + user: + let + __session = lib.splitString ":" (builtins.fromJSON (builtins.readFile ./${user}/about.json)) + .session; + sessionType = (builtins.head __session); + session = builtins.toString (builtins.tail __session); + in + assert sessionType == "co" || sessionType == "de"; + if sessionType == "co" then + { + programs.${session}.enable = true; + } + else if sessionType == "de" then + { services.desktopManager.${session}.enable = true; } + else + { } + ) cfg.usersList +))