mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-26 18:16:13 +01:00
4b8ef0d6db
Signed-off-by: magic_rb <magic_rb@redalder.org>
149 lines
3.4 KiB
Nix
149 lines
3.4 KiB
Nix
{
|
|
inputs',
|
|
pkgs,
|
|
...
|
|
}: let
|
|
rollbackStart = pkgs.writeText "rollback-start" ''
|
|
${pkgs.rolling_datasets}/bin/roll_dataset "omen-ssd/ephemeral/home" "10"
|
|
${pkgs.rolling_datasets}/bin/roll_dataset "omen-ssd/ephemeral/root" "10"
|
|
${pkgs.rolling_datasets}/bin/roll_dataset "omen-ssd/ephemeral/nix-tmp" "10"
|
|
'';
|
|
in {
|
|
nixpkgs.overlays = [
|
|
inputs'.self.overlays.show-files-to-be-deleted
|
|
];
|
|
|
|
environment.systemPackages = [
|
|
pkgs.show-files-to-be-deleted
|
|
];
|
|
|
|
environment.persistence."/nix/persist" = {
|
|
hideMounts = true;
|
|
directories = [
|
|
"/var/log"
|
|
"/var/lib/bluetooth"
|
|
"/var/lib/nixos"
|
|
"/var/lib/systemd/coredump"
|
|
"/var/lib/iwd"
|
|
"/var/lib/syncthing"
|
|
"/var/lib/containers"
|
|
];
|
|
files = [
|
|
"/etc/machine-id"
|
|
"/etc/ssh/ssh_host_rsa_key"
|
|
"/etc/ssh/ssh_host_rsa_key.pub"
|
|
"/etc/ssh/ssh_host_ed25519_key"
|
|
"/etc/ssh/ssh_host_ed25519_key.pub"
|
|
];
|
|
users.main = {
|
|
directories = [
|
|
"sync"
|
|
".steam"
|
|
".local/share/Steam"
|
|
".emacs.d"
|
|
"roam"
|
|
"dotfiles"
|
|
"Documents"
|
|
{
|
|
directory = ".gnupg";
|
|
mode = "0700";
|
|
}
|
|
{
|
|
directory = ".ssh";
|
|
mode = "0700";
|
|
}
|
|
".local/share/direnv"
|
|
".local/share/PrismLauncher"
|
|
"repos"
|
|
".config/Element"
|
|
".cache/librewolf"
|
|
".librewolf"
|
|
".stack"
|
|
".cache/nix"
|
|
".cache/fontconfig"
|
|
".cache/mesa_shader_cache"
|
|
".cache/ghcide"
|
|
".local/share/pantalaimon"
|
|
"Mail"
|
|
".cache/mu"
|
|
".gradle"
|
|
".password-store"
|
|
];
|
|
files = [
|
|
{
|
|
file = ".config/wallpaper";
|
|
method = "symlink";
|
|
}
|
|
{
|
|
file = ".gitignore";
|
|
method = "symlink";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
|
|
boot.initrd.systemd.storePaths = with pkgs; [
|
|
zfs
|
|
busybox
|
|
rolling_datasets
|
|
rollbackStart
|
|
];
|
|
boot.initrd.systemd.services.rollback = {
|
|
description = "Rollback ZFS datasets to a pristine state";
|
|
wantedBy = [
|
|
"initrd.target"
|
|
];
|
|
after = [
|
|
"zfs-import-omen-ssd.service"
|
|
];
|
|
before = [
|
|
"sysroot.mount"
|
|
];
|
|
path = with pkgs; [
|
|
zfs
|
|
busybox
|
|
];
|
|
unitConfig.DefaultDependencies = "no";
|
|
serviceConfig.Type = "oneshot";
|
|
serviceConfig.ExecStart = "/bin/sh ${rollbackStart}";
|
|
};
|
|
|
|
systemd.services."mount-old-homes" = {
|
|
description = "Mount old versions of home dataset";
|
|
|
|
wantedBy = ["local-fs.target"];
|
|
after = ["local-fs.target"];
|
|
|
|
script = ''
|
|
${pkgs.rolling_datasets}/bin/mount_datasets "omen-ssd/ephemeral/home" "/home/.old"
|
|
${pkgs.rolling_datasets}/bin/mount_datasets "omen-ssd/ephemeral/root" "/root/.old"
|
|
${pkgs.rolling_datasets}/bin/mount_datasets "omen-ssd/ephemeral/nix-tmp" "/nix/tmp/.old"
|
|
'';
|
|
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = "yes";
|
|
TimeoutStartSec = "5m";
|
|
};
|
|
};
|
|
|
|
systemd.services."home-manager-main-pre.service" = {
|
|
description = "Home Manager environment prestart for main";
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
before = ["home-manager-main.service"];
|
|
|
|
script = ''
|
|
set -e
|
|
mkdir -p /home/main
|
|
chown 1000:1000 /home/main
|
|
'';
|
|
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = "yes";
|
|
TimeoutStartSec = "5m";
|
|
};
|
|
};
|
|
}
|