From 115b139f1c60ac99eb2eaef110281d2e36d16370 Mon Sep 17 00:00:00 2001 From: Kabbone Date: Sun, 6 Nov 2022 12:50:20 +0100 Subject: [PATCH] system: add snapper for home and subvol for nix --- hosts/configuration.nix | 18 ++++++++++++++---- hosts/desktop/hardware-configuration.nix | 18 +++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/hosts/configuration.nix b/hosts/configuration.nix index adb6cf6..13402fc 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -65,6 +65,7 @@ source-code-pro jetbrains-mono font-awesome # Icons + hack-font corefonts # MS (nerdfonts.override { # Nerdfont Icons override fonts = [ @@ -133,6 +134,15 @@ # com.obsproject.Studio # com.parsecgaming.parsec # com.usebottles.bottles + snapper.configs = { + home = { + subvolume = "/home"; + extraConfig = '' + TIMELINE_CREATE=yes + TIMELINE_CLEANUP=yes + ''; + }; + }; }; #xdg.portal = { # Required for flatpak @@ -167,10 +177,10 @@ }; system = { # NixOS settings - autoUpgrade = { # Allow auto update - enable = true; - channel = "https://nixos.org/channels/nixos-unstable"; - }; +# autoUpgrade = { # Allow auto update +# enable = true; +# channel = "https://nixos.org/channels/nixos-unstable"; +# }; stateVersion = "22.05"; }; } diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix index 62a5eb6..769e67e 100644 --- a/hosts/desktop/hardware-configuration.nix +++ b/hosts/desktop/hardware-configuration.nix @@ -25,19 +25,31 @@ fileSystems."/" = { device = "/dev/disk/by-label/NIXROOT"; fsType = "btrfs"; - options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@" ]; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@,discard=async" ]; }; fileSystems."/home" = { device = "/dev/disk/by-label/NIXROOT"; fsType = "btrfs"; - options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home" ]; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home,discard=async" ]; + }; + + fileSystems."/home/.snapshots" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@snapshots,discard=async" ]; }; fileSystems."/srv" = { device = "/dev/disk/by-label/NIXROOT"; fsType = "btrfs"; - options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv" ]; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv,discard=async" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nix,discard=async" ]; }; fileSystems."/boot" =