Add NixOS modules: boot, users, AMD, disko layout, secrets, Hyprland, Steam
- my.disks generates disko: NVMe btrfs (@root/@home/@nix/@log/@swap) + SATA SSD btrfs with one subvolume per ~/Games, Downloads, Documents, Music, Pictures, Videos, Storage (nofail) - lanzaboote Secure Boot, systemd initrd, latest kernel - AMD CPU/GPU: amdgpu initrd, OpenCL, LACT, optional ROCm - agenix with host-key identity, optional password and SSH key secrets - Hyprland (UWSM, XWayland) + greetd/tuigreet, Noctalia services, PipeWire, fonts - Steam + Proton-GE, gamescope, gamemode - overlays: compose Hyprland's hyprland-packages + hyprland-extras (upstream default lacks the hyprwm dependency overlays) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1cugeLkfFLZMpiztQ8TyN
This commit is contained in:
21 files changed
+972
-4
No files matched your search
@@ -0,0 +1,89 @@
|
||||
# The primary (only) interactive user.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.user;
|
||||
inherit (lib) mkOption types;
|
||||
|
||||
passwordSecret = "${cfg.name}-password";
|
||||
hasPasswordSecret = config.age.secrets ? ${passwordSecret};
|
||||
in
|
||||
{
|
||||
options.my.user = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
example = "faumaray";
|
||||
description = "Login name of the primary user.";
|
||||
};
|
||||
|
||||
fullName = mkOption {
|
||||
type = types.str;
|
||||
description = "Display name (GECOS), also used for git.";
|
||||
};
|
||||
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
description = "E-mail address, used for git.";
|
||||
};
|
||||
|
||||
uid = mkOption {
|
||||
type = types.int;
|
||||
default = 1000;
|
||||
description = "Numeric user id.";
|
||||
};
|
||||
|
||||
extraGroups = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Groups in addition to the ones every desktop user gets.";
|
||||
};
|
||||
|
||||
sshAuthorizedKeys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Public keys allowed to log in over SSH.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
users.mutableUsers = true;
|
||||
|
||||
users.users.${cfg.name} = {
|
||||
isNormalUser = true;
|
||||
inherit (cfg) uid;
|
||||
description = cfg.fullName;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"video"
|
||||
"audio"
|
||||
"input"
|
||||
"render"
|
||||
]
|
||||
++ lib.optional config.my.gaming.enable "gamemode"
|
||||
++ cfg.extraGroups;
|
||||
shell = pkgs.zsh;
|
||||
openssh.authorizedKeys.keys = cfg.sshAuthorizedKeys;
|
||||
|
||||
# Real password comes from agenix; otherwise a throwaway one so the first
|
||||
# boot can never lock the user out.
|
||||
hashedPasswordFile = lib.mkIf hasPasswordSecret config.age.secrets.${passwordSecret}.path;
|
||||
initialPassword = lib.mkIf (!hasPasswordSecret) "changeme";
|
||||
};
|
||||
|
||||
# Required by `shell = pkgs.zsh` (puts zsh into /etc/shells).
|
||||
programs.zsh.enable = true;
|
||||
|
||||
security.sudo.wheelNeedsPassword = true;
|
||||
|
||||
warnings = lib.optional (!hasPasswordSecret) ''
|
||||
User "${cfg.name}" has the temporary password "changeme". Run `passwd` after
|
||||
the first login, or add secrets/${passwordSecret}.age (hashed with
|
||||
`mkpasswd -m yescrypt`, encrypted with agenix) and `git add` it.
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user