diff --git a/home-manager/common/software/cli/bash.nix b/home-manager/common/software/cli/bash.nix index 0066c187..313feed5 100644 --- a/home-manager/common/software/cli/bash.nix +++ b/home-manager/common/software/cli/bash.nix @@ -142,7 +142,11 @@ # NixOS Related nix-clean-all() { - sudo nix-env -u --always + echo "Optimizing the nix store..." + sudo nix-store --optimize + echo "nix-store: Collecting Garbage..." + sudo nix-store --gc + echo "Collecting garbage..." sudo nix-collect-garbage -d } ''; @@ -187,7 +191,6 @@ dday = "date +%A"; # nixos-rebuild - ns = "nix shell"; nr = "sudo nixos-rebuild"; nrs = "sudo nixos-rebuild --upgrade switch"; nrt = "sudo nixos-rebuild test"; @@ -202,4 +205,4 @@ rebuild-all-remote = "rebuild-host-remote && rebuild-home-remote"; }; }; -} \ No newline at end of file +} diff --git a/home-manager/common/software/cli/nixvim-base.nix b/home-manager/common/software/cli/nixvim-base.nix index 0907df7b..1c3c09d9 100644 --- a/home-manager/common/software/cli/nixvim-base.nix +++ b/home-manager/common/software/cli/nixvim-base.nix @@ -62,7 +62,8 @@ (nmap "nc" ":NvimTreeClose" // desc "[C]lose NvimTree") (nmap "nr" ":NvimTreeRefresh" // desc "[R]efresh NvimTree") # ToggleTerm - (nmap "TT" ":ToggleTerm" // desc "[T]oggle Terminal") + (nmap "Tt" ":ToggleTerm" // desc "[T]oggle Terminal") + (nmap "Ts" ":TermSelect" // desc "[S]elect a terminal") # Fugitive (nmap "gc" ":Git commit -a" // desc "[C]ommit" ) (nmap "gp" ":Git push" // desc "Git [p]ush") diff --git a/nixos/hosts/nixos-framework/default.nix b/nixos/hosts/nixos-framework/default.nix index 0e7dce0b..580c1395 100644 --- a/nixos/hosts/nixos-framework/default.nix +++ b/nixos/hosts/nixos-framework/default.nix @@ -2,7 +2,7 @@ imports = [ inputs.nixos-hardware.nixosModules.framework-13-7040-amd (modulesPath + "/installer/scan/not-detected.nix") - ./disks.nix + ./disks-gpt.nix ./syncthing.nix ../../common/services/tailscale-autoconnect.nix ../../common/modules/secureboot.nix @@ -76,4 +76,4 @@ distrobox ]; -} \ No newline at end of file +} diff --git a/nixos/hosts/nixos-framework/disks-gpt.nix b/nixos/hosts/nixos-framework/disks-gpt.nix new file mode 100644 index 00000000..bffd8e36 --- /dev/null +++ b/nixos/hosts/nixos-framework/disks-gpt.nix @@ -0,0 +1,79 @@ +{ + imports = [ ../../common/services/snapper.nix ]; + + services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.interval = "weekly"; + + boot.resumeDevice = "/dev/mapper/ROOT"; + boot.kernelParams = [ "resume_offset=533760" ]; + # https://sawyershepherd.org/post/hibernating-to-an-encrypted-swapfile-on-btrfs-with-nixos/ + + disko.devices.disk.nvme0 = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + BOOT = { + priority = 1; + name = "BOOT"; + start = "0%"; + end = "550MiB"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + # https://github.com/nix-community/disko/issues/527 + mountOptions = [ "umask=0077" ]; + mountpoint = "/boot"; + }; + }; # partition 1 (ESP) + LUKS-ROOT = { + start = "550MiB"; + end = "-64GiB"; + content = { + type = "luks"; + name = "ROOT"; + extraOpenArgs = [ "--allow-discards" ]; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home" = { + mountpoint = "/home"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix + # SNAPSHOT SUBVOLS + "/root/.snapshots" = { + mountpoint = "/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home/.snapshots" = { + mountpoint = "/home/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix/.snapshots" = { + mountpoint = "/nix/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix + # Swap partition + "/swap" = { + mountpoint = "/swap"; + swap.swapfile.size = "64G"; + }; # swap + }; # subvolumes + }; # content.content + }; # content + }; # partition 2 (/ BTRFS) + }; # partitions + }; # content + }; # disko.devices.disk.nvme0 +} # nix