From 26440ac05856c72a82d3dd2a4c4ebc5bbf048905 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Sun, 25 Jun 2023 11:26:04 +0200 Subject: [PATCH] refactor: move all persistance to root binds --- capibara.nix | 1 + home/nixos-common.nix | 82 ----------------------------------------- nixos/common.nix | 85 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 84 deletions(-) diff --git a/capibara.nix b/capibara.nix index fe1ef20..1348391 100644 --- a/capibara.nix +++ b/capibara.nix @@ -86,6 +86,7 @@ in { device = "/dev/mapper/data"; fsType = "btrfs"; options = [ "subvol=vfs_share" "compress=zstd" ]; + neededForBoot = true; }; "/mnt/backups/0" = { diff --git a/home/nixos-common.nix b/home/nixos-common.nix index 28dc177..e5b7581 100644 --- a/home/nixos-common.nix +++ b/home/nixos-common.nix @@ -84,88 +84,6 @@ ./zsh ]; - home.persistence = { - "/mnt/data/${config.home.homeDirectory}" = { - directories = [ - "Audio" - "Calendars" - "Contacts" - "Documents" - "Downloads" - "Images" - "Maildir" - "Monero" - "code" - "misc" - "workspace" - ]; - allowOther = true; - }; - - "/mnt/vfs_share/${config.home.homeDirectory}" = { - directories = [ "vfs_share" ]; - allowOther = true; - }; - - "/mnt/persist/${config.home.homeDirectory}" = { - directories = [ - ".Slic3r" - ".abook" - ".bitmonero" - ".config/Element" - ".config/Nextcloud" - ".config/Signal" - ".config/SuperCollider" - ".config/ardour6" - ".config/chromium" - ".config/kdeconnect" - ".config/kicad" - ".config/nvim/plugin" - ".config/syncthing" - ".config/tea" - ".config/whatsapp-for-linux" - ".electrum" - ".gnupg" - ".hydrogen" - ".john" - ".kube" - ".librewolf" - ".local/share/Bisq" - ".local/share/Nextcloud" - ".local/share/Steam" - ".local/share/SuperCollider" - ".local/share/TelegramDesktop" - ".local/share/nvim" - { - directory = ".local/share/containers"; - method = "symlink"; - } - ".local/share/dino" - ".local/share/direnv" - ".local/share/gopass/stores" - ".local/share/keyrings" - ".local/share/mpd" - ".local/share/tor-browser" - ".local/share/webkitgtk" - ".local/state/wireplumber" - ".local/state/zsh" - ".mozilla" - ".newsboat" - ".password-store" - ".platformio" - ".vagrant.d" - ".vdirsyncer" - ".virtualenvs" - ".wine" - "Nextcloud" - "configs" - # ".cache" - ]; - files = [ ".mailsynclastrun" ".ssh/known_hosts" ".lmmsrc.xml" ]; - allowOther = true; - }; - }; - home.sessionVariables = { EDITOR = "${pkgs.neovim}/bin/nvim"; VISUAL = "${pkgs.neovim}/bin/nvim"; diff --git a/nixos/common.nix b/nixos/common.nix index 56733a8..c64051a 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -182,6 +182,7 @@ "plugdev" "adbusers" "video" + "vboxusers" ]; subUidRanges = [{ startUid = 100000; @@ -247,8 +248,12 @@ enable = true; defaultNetwork.settings.dns_enabled = true; }; - libvirtd.enable = true; + libvirtd = { + enable = true; + allowedBridges = [ "virbr0" "virbr1" "virbr2" ]; + }; spiceUSBRedirection.enable = true; + virtualbox.host.enable = true; }; services.spice-vdagentd.enable = true; programs.dconf.enable = true; @@ -282,6 +287,7 @@ swapDevices = [{ device = "/swap/swapfile"; }]; environment.persistence = { + "/mnt/persist" = { directories = [ "/etc/NetworkManager/system-connections" @@ -291,6 +297,58 @@ "/var/lib/docker" "/var/lib/libvirt" "/var/lib/systemd/coredump" + + "/home/rilla/.Slic3r" + "/home/rilla/.abook" + "/home/rilla/.bitmonero" + "/home/rilla/.config/Element" + "/home/rilla/.config/Nextcloud" + "/home/rilla/.config/Signal" + "/home/rilla/.config/SuperCollider" + "/home/rilla/.config/VirtualBox" + "/home/rilla/.config/ardour6" + "/home/rilla/.config/chromium" + "/home/rilla/.config/kdeconnect" + "/home/rilla/.config/kicad" + "/home/rilla/.config/nvim/plugin" + "/home/rilla/.config/syncthing" + "/home/rilla/.config/tea" + "/home/rilla/.config/whatsapp-for-linux" + "/home/rilla/.electrum" + "/home/rilla/.gnupg" + "/home/rilla/.hydrogen" + "/home/rilla/.john" + "/home/rilla/.kube" + "/home/rilla/.librewolf" + "/home/rilla/.local/share/Bisq" + "/home/rilla/.local/share/Nextcloud" + "/home/rilla/.local/share/Steam" + "/home/rilla/.local/share/SuperCollider" + "/home/rilla/.local/share/TelegramDesktop" + "/home/rilla/.local/share/containers" + "/home/rilla/.local/share/dino" + "/home/rilla/.local/share/direnv" + "/home/rilla/.local/share/gopass/stores" + "/home/rilla/.local/share/keyrings" + "/home/rilla/.local/share/mpd" + "/home/rilla/.local/share/nvim" + "/home/rilla/.local/share/tor-browser" + "/home/rilla/.local/share/webkitgtk" + "/home/rilla/.local/state/wireplumber" + "/home/rilla/.local/state/zsh" + "/home/rilla/.mozilla" + "/home/rilla/.newsboat" + "/home/rilla/.password-store" + "/home/rilla/.platformio" + "/home/rilla/.vagrant.d" + "/home/rilla/.vdirsyncer" + "/home/rilla/.virtualenvs" + "/home/rilla/.wine" + "/home/rilla/Nextcloud" + "/home/rilla/VirtualBox VMs" + "/home/rilla/configs" + # "/home/rilla/.cache" + ]; files = [ "/etc/machine-id" @@ -298,10 +356,30 @@ "/etc/ssh/ssh_host_ed25519_key.pub" "/etc/ssh/ssh_host_ed25519_key-cert.pub" "/etc/ssh/user_ca.pub" + + "/home/rilla/.lmmsrc.xml" + "/home/rilla/.mailsynclastrun" + "/home/rilla/.ssh/known_hosts" + ]; }; "/mnt/data" = { - directories = [ "/etc/luks-keys" ]; + directories = [ + "/etc/luks-keys" + + "/home/rilla/Audio" + "/home/rilla/Calendars" + "/home/rilla/Contacts" + "/home/rilla/Documents" + "/home/rilla/Downloads" + "/home/rilla/Images" + "/home/rilla/Maildir" + "/home/rilla/Monero" + "/home/rilla/code" + "/home/rilla/misc" + "/home/rilla/workspace" + + ]; files = [ "/etc/btrbk/id_ed25519" "/etc/btrbk/id_ed25519.pub" @@ -309,6 +387,9 @@ ]; }; "/mnt/logs" = { directories = [ "/var/log" ]; }; + "/mnt/vfs_share" = { + directories = [ "/home/rilla/vfs_share" ]; + }; }; # Open ports in the firewall.