feat(users): configure sessions in GDM
This commit is contained in:
parent
e90b0b4d03
commit
be81acd46b
3 changed files with 56 additions and 10 deletions
|
|
@ -113,14 +113,6 @@
|
||||||
"nix-command"
|
"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;
|
services.userborn.enable = true;
|
||||||
|
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
],
|
],
|
||||||
"shell": "nushell",
|
"shell": "nushell",
|
||||||
"realName": "ENC[AES256_GCM,data:KBIRbQWsz6n1nAZ2rtGfCdSoQiTrRchpqA==,iv:mD0Rx4GHSJcQhPCa4fxZgYgqYkwzaRQVe50I+bgML04=,tag:ZcrOoRAVOoUKPktL5Dpi/g==,type:str]",
|
"realName": "ENC[AES256_GCM,data:KBIRbQWsz6n1nAZ2rtGfCdSoQiTrRchpqA==,iv:mD0Rx4GHSJcQhPCa4fxZgYgqYkwzaRQVe50I+bgML04=,tag:ZcrOoRAVOoUKPktL5Dpi/g==,type:str]",
|
||||||
|
"session": "co:niri",
|
||||||
"sops": {
|
"sops": {
|
||||||
"age": [
|
"age": [
|
||||||
{
|
{
|
||||||
|
|
@ -12,8 +13,8 @@
|
||||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB2Skp6cGdweFBaZUM2eXRC\nTHExSmtCZU53OXZWZDl3VFFMb1FSdFhkaUhnCnhiSUNQSkZZQ2htTTVxd1Nleitq\nSVV4WmFrdXNUVVU5L0RONHpMUlB2UDgKLS0tIE9UTC9qeEQ0MFlSUFhwdW9NeXYw\nelVGZ0ZYUzFoVXdibmpjTyt1ZHYxaTgKnD3m3Ceq0OT27s2OAWF+gLh5f6Xv3cpp\n28Q3JLG+FpYlBaszOdsWInouCf50tYItWHhQU3gmkhrJsA9gljOAOw==\n-----END AGE ENCRYPTED FILE-----\n"
|
"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",
|
"lastmodified": "2026-05-07T15:31:42Z",
|
||||||
"mac": "ENC[AES256_GCM,data:sqPuXb7Dnr9jOULMIeILhQUbj0WUdE+aQrRiyMok0GlfKDRoIM0SIxG8gKBnnZbzbd5wBu4Hf+HzbBj4RfkfAOQDXMdqR95teSIj4l1a8is/VOllLY/5iC1zTg2ShKsq2VbQJ2c9EG6QYKZABp504+XG0urGIrNgrnqyMwT3/sY=,iv:fwhLVEShUiLNolcg1LBesWupVlh4oCHtyXfFsjqYRqQ=,tag:sKbwSa7nhrRdtzV30FDOQw==,type:str]",
|
"mac": "ENC[AES256_GCM,data:ouXlr7xwQj05RtKc1VKByybKSuXtLk9UXxnE7JSofmVdXzPc7k4atejrWyrWa6weJonpPMldnuyXBiy2RzIHLF8nyvbyCik8o5r4pJ7LlgCHvxM5B2itN/nWCR8Ave9ijBrMk1HQLE4wodUstehnigwkmfMn6phsQEnWY9vYV2c=,iv:vX1/zN+RUDvJnrnMC/KFDKRkWJdFNd12MdH32Y4nNlY=,tag:3aP34p6oaAX8luIUc7eilA==,type:str]",
|
||||||
"encrypted_regex": "^realName$",
|
"encrypted_regex": "^realName$",
|
||||||
"version": "3.12.1"
|
"version": "3.12.1"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
- `realName`: User's real name (optionally)
|
- `realName`: User's real name (optionally)
|
||||||
- `extraGroups`: groups (optionally)
|
- `extraGroups`: groups (optionally)
|
||||||
- `shell`: User's shell
|
- `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)
|
User's face (optionally)
|
||||||
- if any, should be located at users/{user}/face.png
|
- if any, should be located at users/{user}/face.png
|
||||||
|
|
@ -69,4 +74,52 @@
|
||||||
}) cfg.usersList
|
}) 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
|
||||||
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue