- 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
73 lines
2.0 KiB
Nix
73 lines
2.0 KiB
Nix
# agenix secrets. Every secret file is optional: a secret is only declared when
|
|
# its .age file exists in `my.secrets.dir`, so a fresh clone still evaluates.
|
|
#
|
|
# <user>-password.age hashed login password (mkpasswd -m yescrypt)
|
|
# ssh-<key>.age private SSH key, installed for the user (home-manager
|
|
# links it to ~/.ssh/<key>)
|
|
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.secrets;
|
|
user = config.my.user.name;
|
|
|
|
secretFile = name: cfg.dir + "/${name}.age";
|
|
exists = name: builtins.pathExists (secretFile name);
|
|
|
|
passwordSecrets = lib.optionalAttrs (exists "${user}-password") {
|
|
"${user}-password" = {
|
|
file = secretFile "${user}-password";
|
|
mode = "0400";
|
|
};
|
|
};
|
|
|
|
sshSecrets = lib.listToAttrs (
|
|
map (
|
|
key:
|
|
lib.nameValuePair "ssh-${key}" {
|
|
file = secretFile "ssh-${key}";
|
|
owner = user;
|
|
mode = "0400";
|
|
}
|
|
) (lib.filter (key: exists "ssh-${key}") cfg.userSshKeys)
|
|
);
|
|
in
|
|
{
|
|
options.my.secrets = {
|
|
enable = lib.mkEnableOption "agenix secrets from the repository's secrets/ directory";
|
|
|
|
dir = lib.mkOption {
|
|
type = lib.types.path;
|
|
default = ../../../secrets;
|
|
defaultText = lib.literalExpression "../../../secrets";
|
|
description = ''
|
|
Directory holding the *.age files. In a flake only files tracked by git
|
|
are visible, so `git add` new secrets before building.
|
|
'';
|
|
};
|
|
|
|
userSshKeys = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ "id_ed25519" ];
|
|
description = "SSH key names; each maps to secrets/ssh-<name>.age if present.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# The host key is generated on the install USB (`create-keys`) and copied
|
|
# to the target, so secrets can be decrypted on the very first boot.
|
|
age.identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
|
|
|
age.secrets = passwordSecrets // sshSecrets;
|
|
|
|
environment.systemPackages = [
|
|
inputs.agenix.packages.${pkgs.stdenv.hostPlatform.system}.default
|
|
pkgs.age
|
|
];
|
|
};
|
|
}
|