refactor: move persistence into modules where possible

This commit is contained in:
Moritz Böhme 2024-12-24 13:49:00 +01:00
parent 9f1cf602e5
commit 1764a421ab
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
10 changed files with 45 additions and 14 deletions

View file

@ -18,6 +18,7 @@ in
}; };
users.mutableUsers = false; users.mutableUsers = false;
environment.persistence."/persist" = { environment.persistence."/persist" = {
enable = cfg.enable;
hideMounts = true; hideMounts = true;
directories = [ directories = [
"/etc/NetworkManager/system-connections" "/etc/NetworkManager/system-connections"
@ -27,7 +28,6 @@ in
"/var/lib/nixos" "/var/lib/nixos"
"/var/lib/systemd" "/var/lib/systemd"
"/var/log" "/var/log"
"/etc/mullvad-vpn/"
]; ];
files = [ files = [
"/etc/machine-id" "/etc/machine-id"
@ -39,27 +39,14 @@ in
]; ];
users.moritz = { users.moritz = {
directories = [ directories = [
".SynologyDrive/data"
".SynologyDrive/log"
".cache/keepassxc" ".cache/keepassxc"
".cache/nvim/luac"
".cat_installer" # eduroam ".cat_installer" # eduroam
".config/JetBrains"
".config/Mullvad VPN/"
".config/Nextcloud" ".config/Nextcloud"
".config/Signal/" ".config/Signal/"
".config/calibre" ".config/calibre"
".config/github-copilot"
".config/kdeconnect"
".config/keepassxc" ".config/keepassxc"
".java/.userPrefs/jetbrains/"
".local/share/JetBrains"
".local/share/PrismLauncher/"
".local/share/Steam/" ".local/share/Steam/"
".local/share/direnv"
".local/share/nvim"
".local/share/zoxide" ".local/share/zoxide"
".local/state/nvim"
".mozilla" ".mozilla"
"Documents" "Documents"
"Downloads" "Downloads"

View file

@ -12,6 +12,9 @@ in
options.my.profiles.personal.calendar = mkEnableOption "calendar"; options.my.profiles.personal.calendar = mkEnableOption "calendar";
config = mkIf cfg.contacts { config = mkIf cfg.contacts {
environment.persistence."/persist".users.moritz.directories = [
".local/share/vdirsyncer/"
];
home-manager.users.moritz = { home-manager.users.moritz = {
programs.khal.enable = true; programs.khal.enable = true;
programs.vdirsyncer.enable = true; programs.vdirsyncer.enable = true;

View file

@ -12,6 +12,9 @@ in
options.my.profiles.personal.contacts = mkEnableOption "contacts"; options.my.profiles.personal.contacts = mkEnableOption "contacts";
config = mkIf cfg.contacts { config = mkIf cfg.contacts {
environment.persistence."/persist".users.moritz.directories = mkIf (!cfg.calendar) [
".local/share/vdirsyncer/"
];
home-manager.users.moritz = { home-manager.users.moritz = {
programs.khard.enable = true; programs.khard.enable = true;
programs.vdirsyncer.enable = true; programs.vdirsyncer.enable = true;

View file

@ -11,6 +11,10 @@ in
options.my.programs.direnv.enable = mkEnableOption "direnv"; options.my.programs.direnv.enable = mkEnableOption "direnv";
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".local/share/direnv"
];
home-manager.users.moritz.programs.direnv = { home-manager.users.moritz.programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;

View file

@ -24,6 +24,12 @@ in
}; };
config = mkIf anyEnabled { config = mkIf anyEnabled {
environment.persistence."/persist".users.moritz.directories = [
".config/JetBrains"
".java/.userPrefs/jetbrains/"
".local/share/JetBrains"
];
home-manager.users.moritz = { home-manager.users.moritz = {
xdg.configFile."ideavim/ideavimrc" = { xdg.configFile."ideavim/ideavimrc" = {
source = ./ideavimrc; source = ./ideavimrc;

View file

@ -11,6 +11,13 @@ in
options.my.programs.nvim.enable = mkEnableOption "nvim"; options.my.programs.nvim.enable = mkEnableOption "nvim";
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".cache/nvim/luac"
".config/github-copilot"
".local/share/nvim"
".local/state/nvim"
];
home-manager.users.moritz = { home-manager.users.moritz = {
home.packages = with pkgs; [ home.packages = with pkgs; [

View file

@ -21,6 +21,10 @@ in
options.my.programs.prismlauncher.enable = mkEnableOption "prismlauncher"; options.my.programs.prismlauncher.enable = mkEnableOption "prismlauncher";
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".local/share/PrismLauncher/"
];
users.users.moritz.packages = [ prismlauncher ]; users.users.moritz.packages = [ prismlauncher ];
}; };
} }

View file

@ -15,6 +15,10 @@ in
options.my.services.kdeconnect.enable = mkEnableOption "kdeconnect"; options.my.services.kdeconnect.enable = mkEnableOption "kdeconnect";
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".config/kdeconnect"
];
home-manager.users.moritz.services.kdeconnect.enable = mkIf (!config.my.programs.gnome.enable) true; home-manager.users.moritz.services.kdeconnect.enable = mkIf (!config.my.programs.gnome.enable) true;
networking.firewall = { networking.firewall = {
allowedTCPPortRanges = [ ports ]; allowedTCPPortRanges = [ ports ];

View file

@ -12,6 +12,14 @@ in
options.my.services.mullvad.enable = mkEnableOption "mullvad"; options.my.services.mullvad.enable = mkEnableOption "mullvad";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.persistence."/persist" = {
directories = [
"/etc/mullvad-vpn/"
];
users.moritz.directories = [
".config/Mullvad VPN/"
];
};
services.mullvad-vpn.enable = true; services.mullvad-vpn.enable = true;
users.users.moritz.packages = with pkgs; [ users.users.moritz.packages = with pkgs; [
mullvad-vpn mullvad-vpn

View file

@ -15,6 +15,11 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.persistence."/persist".users.moritz.directories = [
".SynologyDrive/data"
".SynologyDrive/log"
];
systemd.user.services.synology-drive = { systemd.user.services.synology-drive = {
after = [ "graphical-session.target" "network.target" ]; after = [ "graphical-session.target" "network.target" ];
partOf = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ];