Impermanence support

kalle 2024-11-22 18:05:37 +01:00
parent ec0eb624df
commit 00b047f25b
5 changed files with 78 additions and 15 deletions

View File

@ -1,12 +1,27 @@
{ {
"nodes": { "nodes": {
"impermanence": {
"locked": {
"lastModified": 1731242966,
"narHash": "sha256-B3C3JLbGw0FtLSWCjBxU961gLNv+BOOBC6WvstKLYMw=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1731676054, "lastModified": 1732014248,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=", "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add", "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,6 +33,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"impermanence": "impermanence",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View File

@ -3,6 +3,7 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
impermanence.url = "github:nix-community/impermanence";
}; };
outputs = outputs =

View File

@ -5,7 +5,10 @@
... ...
}: }:
{ {
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; imports = [
(modulesPath + "/profiles/qemu-guest.nix")
./fs.nix
];
config = { config = {
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";
@ -17,10 +20,7 @@
# Enable QEMU Guest for Proxmox # Enable QEMU Guest for Proxmox
services.qemuGuest.enable = lib.mkDefault true; services.qemuGuest.enable = lib.mkDefault true;
# Use the boot drive for grub boot.loader.systemd-boot.enable = true;
boot.loader.grub.enable = lib.mkDefault true;
boot.loader.grub.devices = [ "/dev/sda" ];
boot.growPartition = lib.mkDefault true; boot.growPartition = lib.mkDefault true;
# Allow remote updates with flakes and non-root users # Allow remote updates with flakes and non-root users
@ -45,7 +45,7 @@
# Enable mDNS for `hostname.local` addresses # Enable mDNS for `hostname.local` addresses
services.avahi.enable = true; services.avahi.enable = true;
services.avahi.nssmdns = true; services.avahi.nssmdns4 = true;
services.avahi.publish = { services.avahi.publish = {
enable = true; enable = true;
addresses = true; addresses = true;
@ -68,11 +68,18 @@
}; };
programs.ssh.startAgent = true; programs.ssh.startAgent = true;
# Default filesystem environment.persistence."/persistent" = {
fileSystems."/" = lib.mkDefault { enable = true;
device = "/dev/disk/by-label/nixos"; hideMounts = true;
autoResize = true; directories = [
fsType = "ext4"; "/var/log"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/nixos"
];
files = [
"/etc/machine-id"
];
}; };
system.stateVersion = lib.mkDefault "24.05"; system.stateVersion = lib.mkDefault "24.05";

36
systems/base/fs.nix Normal file
View File

@ -0,0 +1,36 @@
{
...
}:
{
boot.supportedFilesystems = [ "btrfs" ];
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [ "default" "mode=755" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "fat";
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/btrfs";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=nix" "noatime" ];
};
fileSystems."/persistent" = {
device = "/dev/disk/by-label/btrfs";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=persistent" "noatime" ];
autoResize = true;
neededForBoot = true;
};
fileSystems."/media" = {
device = "vm@b9b22d11-3492-49a6-92b7-b36cdf0161fe.cephfs=/media";
fsType = "ceph";
};
}

View File

@ -12,6 +12,9 @@
specialArgs = { specialArgs = {
inherit inputs outputs; inherit inputs outputs;
}; };
modules = [ ./systems/base.nix ] ++ configs; modules = [
inputs.impermanence.nixosModules.impermanence
./systems/base.nix
] ++ configs;
}; };
} }