impermanence

This commit is contained in:
zackartz 2025-01-07 18:42:17 +00:00
parent bf86126a00
commit 55719b45aa
6 changed files with 336 additions and 117 deletions

255
flake.lock generated
View file

@ -206,6 +206,26 @@
"type": "github" "type": "github"
} }
}, },
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1736199437,
"narHash": "sha256-TdU0a/x8048rbbJmkKWzSY1CtsbbGKNkIJcMdr8Zf4Q=",
"owner": "nix-community",
"repo": "disko",
"rev": "49f8aa791f81ff2402039b3efe0c35b9386c4bcf",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"emacs-overlay": { "emacs-overlay": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_4",
@ -228,11 +248,27 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1733328505,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_10": {
"flake": false,
"locked": {
"lastModified": 1732722421,
"narHash": "sha256-HRJ/18p+WoXpWJkcdsk9St5ZiukCqSDgbOGFa8Okehg=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -260,11 +296,11 @@
"flake-compat_3": { "flake-compat_3": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1733328505, "lastModified": 1696426674,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -274,70 +310,6 @@
} }
}, },
"flake-compat_4": { "flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_6": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_7": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_8": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1733328505, "lastModified": 1733328505,
@ -353,14 +325,78 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_6": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_7": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_8": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_9": { "flake-compat_9": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1732722421, "lastModified": 1733328505,
"narHash": "sha256-HRJ/18p+WoXpWJkcdsk9St5ZiukCqSDgbOGFa8Okehg=", "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac", "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -765,24 +801,28 @@
}, },
"ghostty": { "ghostty": {
"inputs": { "inputs": {
"flake-compat": "flake-compat",
"nixpkgs-stable": "nixpkgs-stable_2", "nixpkgs-stable": "nixpkgs-stable_2",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"zig": "zig" "zig": "zig"
}, },
"locked": { "locked": {
"lastModified": 1734381839, "lastModified": 1736269184,
"narHash": "sha256-s3IrXBkJQ8oM+CSzmh3k1lO2EPZ0CqkIgin6LZ07edc=", "narHash": "sha256-RROzoSujiA6efbs9damV9ZzmOtYYpwnoVdqjeVuhWQU=",
"path": "/home/zoey/dev/ghostty", "owner": "ghostty-org",
"type": "path" "repo": "ghostty",
"rev": "0065aae6b6b97f47afbd5a9cb71852cebbe2ea69",
"type": "github"
}, },
"original": { "original": {
"path": "/home/zoey/dev/ghostty", "owner": "ghostty-org",
"type": "path" "repo": "ghostty",
"type": "github"
} }
}, },
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_5",
"gitignore": "gitignore_3", "gitignore": "gitignore_3",
"nixpkgs": [ "nixpkgs": [
"neovim-nightly-overlay", "neovim-nightly-overlay",
@ -1236,6 +1276,21 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": {
"locked": {
"lastModified": 1734945620,
"narHash": "sha256-olIfsfJK4/GFmPH8mXMmBDAkzVQ1TWJmeGT3wBGfQPY=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "d000479f4f41390ff7cf9204979660ad5dd16176",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"kb-gui": { "kb-gui": {
"inputs": { "inputs": {
"crane": "crane_2", "crane": "crane_2",
@ -1264,7 +1319,7 @@
"lanzaboote": { "lanzaboote": {
"inputs": { "inputs": {
"crane": "crane_3", "crane": "crane_3",
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_4", "flake-parts": "flake-parts_4",
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_4",
"nixpkgs": [ "nixpkgs": [
@ -1345,7 +1400,7 @@
}, },
"neovim-nightly-overlay": { "neovim-nightly-overlay": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_4",
"flake-parts": "flake-parts_5", "flake-parts": "flake-parts_5",
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
"hercules-ci-effects": "hercules-ci-effects", "hercules-ci-effects": "hercules-ci-effects",
@ -1421,16 +1476,18 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734424634, "lastModified": 1736012469,
"narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=", "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33", "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "nixos",
"type": "indirect" "ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
@ -1895,7 +1952,7 @@
}, },
"pre-commit-hooks": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat_2",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"hyprland", "hyprland",
@ -2009,12 +2066,14 @@
"awsvpnclient": "awsvpnclient", "awsvpnclient": "awsvpnclient",
"blog": "blog", "blog": "blog",
"catppuccin": "catppuccin", "catppuccin": "catppuccin",
"disko": "disko",
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"g2claude": "g2claude", "g2claude": "g2claude",
"ghostty": "ghostty", "ghostty": "ghostty",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"hypridle": "hypridle", "hypridle": "hypridle",
"hyprland": "hyprland", "hyprland": "hyprland",
"impermanence": "impermanence",
"kb-gui": "kb-gui", "kb-gui": "kb-gui",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"lix-module": "lix-module", "lix-module": "lix-module",
@ -2136,7 +2195,7 @@
}, },
"snowfall-lib": { "snowfall-lib": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_5", "flake-compat": "flake-compat_6",
"flake-utils-plus": "flake-utils-plus", "flake-utils-plus": "flake-utils-plus",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -2158,7 +2217,7 @@
}, },
"snowfall-lib_2": { "snowfall-lib_2": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_7", "flake-compat": "flake-compat_8",
"flake-utils-plus": "flake-utils-plus_2", "flake-utils-plus": "flake-utils-plus_2",
"nixpkgs": [ "nixpkgs": [
"solaar", "solaar",
@ -2182,7 +2241,7 @@
}, },
"solaar": { "solaar": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_6", "flake-compat": "flake-compat_7",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
@ -2205,7 +2264,7 @@
}, },
"spicetify-nix": { "spicetify-nix": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_8", "flake-compat": "flake-compat_9",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -2599,7 +2658,7 @@
}, },
"waybar": { "waybar": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_9", "flake-compat": "flake-compat_10",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -2664,15 +2723,15 @@
"nixpkgs": "nixpkgs_16" "nixpkgs": "nixpkgs_16"
}, },
"locked": { "locked": {
"lastModified": 1727721329, "lastModified": 1736267677,
"narHash": "sha256-QYlWZwUSwrM7BuO+dXclZIwoPvBIuJr6GpFKv9XKFPI=", "narHash": "sha256-7FH/gFShKOzf46yKqA4VWAaWxuyHBRnXOdaffbTxVo4=",
"owner": "MarceColl", "owner": "0xc000022070",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"rev": "e6ab73f405e9a2896cce5956c549a9cc359e5fcc", "rev": "c96c6a1ebf1bea782f9528dc316d986a6087ebc0",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "MarceColl", "owner": "0xc000022070",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"type": "github" "type": "github"
} }

View file

@ -19,7 +19,7 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
ghostty.url = "path:/home/zoey/dev/ghostty"; ghostty.url = "github:ghostty-org/ghostty";
emacs-overlay.url = "github:nix-community/emacs-overlay"; emacs-overlay.url = "github:nix-community/emacs-overlay";
@ -95,7 +95,7 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
zen-browser.url = "github:MarceColl/zen-browser-flake"; zen-browser.url = "github:0xc000022070/zen-browser-flake";
zoeycomputer = { zoeycomputer = {
url = "git+https://git.zoeys.cloud/zoey/zoeys.computer"; url = "git+https://git.zoeys.cloud/zoey/zoeys.computer";
@ -113,6 +113,15 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence = {
url = "github:nix-community/impermanence";
};
g2claude.url = "git+https://git.zoeys.cloud/zoey/g2claude.git"; g2claude.url = "git+https://git.zoeys.cloud/zoey/g2claude.git";
rust-overlay = { rust-overlay = {
@ -146,6 +155,7 @@
catppuccin.homeManagerModules.catppuccin catppuccin.homeManagerModules.catppuccin
anyrun.homeManagerModules.default anyrun.homeManagerModules.default
ags.homeManagerModules.default ags.homeManagerModules.default
impermanence.nixosModules.home-manager.impermanence
]; ];
systems.modules.nixos = with inputs; [ systems.modules.nixos = with inputs; [
@ -157,6 +167,8 @@
solaar.nixosModules.default solaar.nixosModules.default
zoeycomputer.nixosModules.default zoeycomputer.nixosModules.default
lix-module.nixosModules.default lix-module.nixosModules.default
disko.nixosModules.default
impermanence.nixosModules.impermanence
]; ];
}; };
in in

View file

@ -46,6 +46,29 @@
xdg.enable = true; xdg.enable = true;
home.persistence."/persist/home" = {
directories = [
"Downloads"
"Music"
"Pictures"
"Documents"
"Videos"
".gnupg"
".ssh"
".nixops"
".local/share/keyrings"
".local/share/direnv"
{
directory = ".local/share/Steam";
method = "symlink";
}
];
files = [
".screenrc"
];
allowOther = true;
};
programs = { programs = {
gpg.enable = true; gpg.enable = true;
man.enable = true; man.enable = true;
@ -132,7 +155,7 @@
pkgs.zed-editor pkgs.zed-editor
pkgs.rmpc pkgs.rmpc
pkgs.custom.zen-browser inputs.zen-browser.packages.${pkgs.system}.twilight
pkgs.mpc-cli pkgs.mpc-cli
pkgs.openvpn pkgs.openvpn

View file

@ -29,21 +29,21 @@ in {
lexend lexend
jost jost
dejavu_fonts dejavu_fonts
# iosevka iosevka
(iosevka.override { # (iosevka.override {
set = "Custom"; # set = "Custom";
privateBuildPlan = '' # privateBuildPlan = ''
[buildPlans.IosevkaCustom] # [buildPlans.IosevkaCustom]
family = "Iosevka" # family = "Iosevka"
spacing = "normal" # spacing = "normal"
serifs = "sans" # serifs = "sans"
noCvSs = true # noCvSs = true
exportGlyphNames = true # exportGlyphNames = true
#
[buildPlans.IosevkaCustom.variants] # [buildPlans.IosevkaCustom.variants]
inherits = "ss03" # inherits = "ss03"
''; # '';
}) # })
noto-fonts noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans
noto-fonts-emoji noto-fonts-emoji

View file

@ -6,7 +6,7 @@
config, config,
... ...
}: { }: {
imports = [./hardware-configuration.nix]; imports = [./hardware-configuration.nix (import ./disko.nix {device = "/dev/nvme0n1";})];
nix.settings = { nix.settings = {
trusted-users = ["zoey"]; trusted-users = ["zoey"];
@ -73,6 +73,57 @@
}; };
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/root_vg/root /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
fileSystems."/persist".neededForBoot = true;
environment.persistence."/persist/system" = {
hideMounts = true;
directories = [
"/etc/nixos"
"/var/log"
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
{
directory = "/var/lib/colord";
user = "colord";
group = "colord";
mode = "u=rwx,g=rx,o=";
}
];
files = [
"/etc/machine-id"
{
file = "/var/keys/secret_file";
parentDirectory = {mode = "u=rwx,g=,o=";};
}
];
};
networking.hostName = "earth"; # Define your hostname. networking.hostName = "earth"; # Define your hostname.
networking.extraHosts = "127.0.0.1 local-cald.io"; networking.extraHosts = "127.0.0.1 local-cald.io";
@ -104,6 +155,7 @@
]; ];
programs.fish.enable = true; programs.fish.enable = true;
programs.fuse.userAllowOther = true;
users.users.zoey = { users.users.zoey = {
isNormalUser = true; isNormalUser = true;
description = "zoey"; description = "zoey";

View file

@ -0,0 +1,73 @@
{device ? throw "Set this to your disk device, e.g. /dev/sda", ...}: {
disko.devices = {
disk.main = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
esp = {
name = "ESP";
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
swap = {
size = "4G";
content = {
type = "swap";
resumeDevice = true;
};
};
root = {
name = "root";
size = "100%";
content = {
type = "lvm_pv";
vg = "root_vg";
};
};
};
};
};
lvm_vg = {
root_vg = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
};
"/persist" = {
mountOptions = ["subvol=persist" "noatime"];
mountpoint = "/persist";
};
"/nix" = {
mountOptions = ["subvol=nix" "noatime"];
mountpoint = "/nix";
};
};
};
};
};
};
};
};
}