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

View file

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

View file

@ -46,6 +46,29 @@
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 = {
gpg.enable = true;
man.enable = true;
@ -132,7 +155,7 @@
pkgs.zed-editor
pkgs.rmpc
pkgs.custom.zen-browser
inputs.zen-browser.packages.${pkgs.system}.twilight
pkgs.mpc-cli
pkgs.openvpn

View file

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

View file

@ -6,7 +6,7 @@
config,
...
}: {
imports = [./hardware-configuration.nix];
imports = [./hardware-configuration.nix (import ./disko.nix {device = "/dev/nvme0n1";})];
nix.settings = {
trusted-users = ["zoey"];
@ -73,6 +73,57 @@
};
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.extraHosts = "127.0.0.1 local-cald.io";
@ -104,6 +155,7 @@
];
programs.fish.enable = true;
programs.fuse.userAllowOther = true;
users.users.zoey = {
isNormalUser = true;
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";
};
};
};
};
};
};
};
};
}