This commit is contained in:
albert 2024-02-19 11:07:31 +09:00
parent 7c8f52e553
commit 74cbd62e3f
No known key found for this signature in database
GPG key ID: 64F6C4EB46C4543A
4 changed files with 89 additions and 6 deletions

View file

@ -142,7 +142,11 @@
# NixOS Related # NixOS Related
nix-clean-all() { 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 sudo nix-collect-garbage -d
} }
''; '';
@ -187,7 +191,6 @@
dday = "date +%A"; dday = "date +%A";
# nixos-rebuild # nixos-rebuild
ns = "nix shell";
nr = "sudo nixos-rebuild"; nr = "sudo nixos-rebuild";
nrs = "sudo nixos-rebuild --upgrade switch"; nrs = "sudo nixos-rebuild --upgrade switch";
nrt = "sudo nixos-rebuild test"; nrt = "sudo nixos-rebuild test";

View file

@ -62,7 +62,8 @@
(nmap "<leader>nc" ":NvimTreeClose<CR>" // desc "[C]lose NvimTree") (nmap "<leader>nc" ":NvimTreeClose<CR>" // desc "[C]lose NvimTree")
(nmap "<leader>nr" ":NvimTreeRefresh<CR>" // desc "[R]efresh NvimTree") (nmap "<leader>nr" ":NvimTreeRefresh<CR>" // desc "[R]efresh NvimTree")
# ToggleTerm # ToggleTerm
(nmap "<leader>TT" ":ToggleTerm<CR>" // desc "[T]oggle Terminal") (nmap "<leader>Tt" ":ToggleTerm<CR>" // desc "[T]oggle Terminal")
(nmap "<leader>Ts" ":TermSelect<CR>" // desc "[S]elect a terminal")
# Fugitive # Fugitive
(nmap "<leader>gc" ":Git commit -a<CR>" // desc "[C]ommit" ) (nmap "<leader>gc" ":Git commit -a<CR>" // desc "[C]ommit" )
(nmap "<leader>gp" ":Git push<CR>" // desc "Git [p]ush") (nmap "<leader>gp" ":Git push<CR>" // desc "Git [p]ush")

View file

@ -2,7 +2,7 @@
imports = [ imports = [
inputs.nixos-hardware.nixosModules.framework-13-7040-amd inputs.nixos-hardware.nixosModules.framework-13-7040-amd
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
./disks.nix ./disks-gpt.nix
./syncthing.nix ./syncthing.nix
../../common/services/tailscale-autoconnect.nix ../../common/services/tailscale-autoconnect.nix
../../common/modules/secureboot.nix ../../common/modules/secureboot.nix

View file

@ -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