2024-09-02 22:26:06 +02:00
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
config,
|
|
|
|
lib,
|
2025-07-19 21:51:37 +02:00
|
|
|
sources,
|
2024-09-02 22:26:06 +02:00
|
|
|
...
|
2025-07-20 01:23:48 +02:00
|
|
|
}:
|
|
|
|
let
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (lib.modules) mkIf mkForce;
|
2024-09-20 15:45:44 +02:00
|
|
|
inherit (builtins) map;
|
2024-09-02 22:26:06 +02:00
|
|
|
|
|
|
|
cfg = config.modules.system.impermanence;
|
2025-07-20 01:23:48 +02:00
|
|
|
in
|
|
|
|
{
|
2024-09-20 15:45:44 +02:00
|
|
|
imports = [
|
2025-07-19 21:51:37 +02:00
|
|
|
(sources.impermanence + "/nixos.nix")
|
2024-09-20 15:45:44 +02:00
|
|
|
];
|
2024-09-25 18:04:42 +02:00
|
|
|
config = mkIf cfg.enable {
|
2024-09-20 22:57:15 +02:00
|
|
|
users = {
|
2025-01-07 19:54:27 +01:00
|
|
|
mutableUsers = true;
|
2024-09-25 18:04:42 +02:00
|
|
|
users = {
|
|
|
|
cr = {
|
|
|
|
hashedPasswordFile = "/persist/passwords/cr";
|
|
|
|
};
|
|
|
|
root.hashedPasswordFile = "/persist/passwords/root";
|
2024-09-20 22:57:15 +02:00
|
|
|
};
|
|
|
|
};
|
2024-09-02 22:26:06 +02:00
|
|
|
|
2024-09-25 18:04:42 +02:00
|
|
|
environment.persistence."/persist" = {
|
2024-09-26 00:35:14 +02:00
|
|
|
enable = true;
|
2024-09-25 18:04:42 +02:00
|
|
|
hideMounts = true;
|
|
|
|
directories = [
|
|
|
|
"/etc/nixos"
|
|
|
|
"/etc/nix"
|
|
|
|
"/etc/NetworkManager/system-connections"
|
|
|
|
"/var/db/sudo"
|
|
|
|
"/var/log"
|
|
|
|
"/var/lib/bluetooth"
|
|
|
|
"/var/lib/nixos"
|
|
|
|
"/var/lib/pipewire"
|
|
|
|
"/var/lib/systemd/coredump"
|
2025-04-06 22:09:17 +02:00
|
|
|
"/etc/secureboot"
|
2024-09-25 18:04:42 +02:00
|
|
|
];
|
2024-09-20 15:45:44 +02:00
|
|
|
|
2024-09-25 18:04:42 +02:00
|
|
|
users.cr = {
|
2025-07-20 01:23:48 +02:00
|
|
|
directories = [
|
|
|
|
"cloud"
|
|
|
|
"repos"
|
|
|
|
]
|
|
|
|
++ map (dir: ".config/${dir}") [
|
|
|
|
"nicotine"
|
|
|
|
"Signal"
|
|
|
|
"Nextcloud"
|
|
|
|
"emacs"
|
|
|
|
"doom"
|
|
|
|
]
|
|
|
|
++ map (dir: ".cache/${dir}") [
|
|
|
|
"tealdeer"
|
|
|
|
"keepassxc"
|
|
|
|
"nix"
|
|
|
|
"starship"
|
|
|
|
"nix-index"
|
|
|
|
"mozilla"
|
|
|
|
"zsh"
|
|
|
|
"nvim"
|
|
|
|
]
|
|
|
|
++ map (dir: ".local/share/${dir}") [
|
|
|
|
"direnv"
|
|
|
|
"Steam"
|
|
|
|
"TelegramDesktop"
|
|
|
|
"PrismLauncher"
|
|
|
|
"nicotine"
|
|
|
|
"zoxide"
|
|
|
|
".keepass"
|
|
|
|
];
|
2024-09-25 18:04:42 +02:00
|
|
|
};
|
2024-09-20 15:45:44 +02:00
|
|
|
};
|
|
|
|
|
2024-09-25 18:04:42 +02:00
|
|
|
# for some reason *this* is what makes networkmanager not get screwed completely instead of the impermanence module
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"L /var/lib/NetworkManager/secret_key - - - - /persist/var/lib/NetworkManager/secret_key"
|
|
|
|
"L /var/lib/NetworkManager/seen-bssids - - - - /persist/var/lib/NetworkManager/seen-bssids"
|
|
|
|
"L /var/lib/NetworkManager/timestamps - - - - /persist/var/lib/NetworkManager/timestamps"
|
|
|
|
];
|
2024-09-20 15:45:44 +02:00
|
|
|
|
2024-09-25 18:04:42 +02:00
|
|
|
services.openssh.hostKeys = mkForce [
|
|
|
|
{
|
|
|
|
bits = 4096;
|
|
|
|
path = "/persist/etc/ssh/ssh_host_rsa_key";
|
|
|
|
type = "rsa";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
bits = 4096;
|
|
|
|
path = "/persist/etc/ssh/ssh_host_ed25519_key";
|
|
|
|
type = "ed25519";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-09-02 22:26:06 +02:00
|
|
|
}
|