no impermanence for now

This commit is contained in:
twoneis 2024-05-08 22:38:33 +02:00
parent 877569a39a
commit 21a6750d09
6 changed files with 1 additions and 155 deletions

View file

@ -1,81 +0,0 @@
{
disko.devices = {
disk = {
vda = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "128M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"/rootfs" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/";
};
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/nix";
};
"/persist" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/persist";
};
};
mountpoint = "/partition-root";
swap = {
swapfile = {
size = "16G";
};
};
};
};
};
};
};
vdb = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
"/ext" = {
mountOptions = [ "compress=zstd" "noatime" ];
mountpoint = "/ext";
};
};
};
};
};
};
};
};
};
}

View file

@ -3,30 +3,6 @@
initrd = { initrd = {
availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
kernelModules = [ ]; kernelModules = [ ];
postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/disk/by-uuid/b6e6bca7-1435-4b41-b174-8550eace7c32 /btrfs_tmp
if [[ -e /btrfs_tmp/rootfs ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/rootfs)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/rootfs "/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/rootfs
umount /btrfs_tmp
'';
}; };
kernelModules = [ "kvm-amd" ]; kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ]; extraModulePackages = [ ];

16
flake.lock generated
View file

@ -249,21 +249,6 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": {
"locked": {
"lastModified": 1708968331,
"narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"niri": { "niri": {
"inputs": { "inputs": {
"crate2nix": "crate2nix", "crate2nix": "crate2nix",
@ -479,7 +464,6 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"impermanence": "impermanence",
"niri": "niri", "niri": "niri",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",

View file

@ -21,10 +21,6 @@
url = "github:sodiboo/niri-flake"; url = "github:sodiboo/niri-flake";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
impermanence = {
url = "github:nix-community/impermanence";
};
}; };
outputs = inputs: import ./outputs.nix inputs; outputs = inputs: import ./outputs.nix inputs;

View file

@ -1,27 +0,0 @@
{ ... }: {
users.mutableUsers = false;
users.users.twoneis.initialHashedPassword = "$y$j9T$0pmWE8A2JWcr2BDqqZ2u./$Km7K1hml9Gy0fc9DzBsDTvpyCKZ9DW0GOkD.lDcyYw0";
users.users.root.initialHashedPassword = "$y$j9T$U8fvYSDoZxqVrkjlZM2Db.$qvkT9GIbVJ23EtB7KcqyI8u7RKJ99pYSXNu8IhVcDx9";
environment.persistence."/persist" = {
directories = [
"/var/log"
"/var/lib/bluetooth"
"/var/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
];
files = [
"/etc/machine-id"
];
users.twoneis = {
directories = [
"Documents"
"uni"
"code"
# a lot of firefox settings that can't/aren't currently declared properly
".mozilla"
".local/share/keyrings"
];
};
};
}

View file

@ -1,4 +1,4 @@
{ nixpkgs, home-manager, nixos-hardware, nur, niri, impermanence, ... }@inputs: { { nixpkgs, home-manager, nixos-hardware, niri, ... }@inputs: {
nixosConfigurations = { nixosConfigurations = {
# AMD Ryzen 5600X # AMD Ryzen 5600X
# nvidia GeForce GTX 1060 (6GB) # nvidia GeForce GTX 1060 (6GB)
@ -11,10 +11,8 @@
./devices/ellaca ./devices/ellaca
./modules/system ./modules/system
./modules/system/home ./modules/system/home
./modules/system/persist
./options.nix ./options.nix
niri.nixosModules.niri niri.nixosModules.niri
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
]; ];
}; };