Fix impermanence vm

This commit is contained in:
caem 2023-06-24 20:56:54 +02:00
parent a1c5c3b291
commit fb414ef491
9 changed files with 59 additions and 47 deletions

20
systems/common.nix Normal file
View file

@ -0,0 +1,20 @@
# Common configuration for all systems
{ ... }:
{
nix = {
settings.auto-optimise-store = true;
# Clean generations older than a week
gc = {
automatic = false; # Flip this to do it automatically
dates = "weekly";
options = "--delete-older-than 7d";
};
};
nixpkgs.config.allowUnfree = true;
system.stateVersion = "23.05";
}

View file

@ -1,53 +1,36 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{lib, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.initrd.postDeviceCommands = lib.mkAfter ''
zfs rollback -r local/root@blank
'';
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.zfs.devNodes = "/dev/disk/by-path";
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/" = {
device = "local/root";
fsType = "zfs";
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7";
fsType = "btrfs";
options = [ "subvol=log" ];
neededForBoot = true;
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5725-D092";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1FD8-C4B8";
fsType = "vfat";
};
};
fileSystems."/nix" = {
device = "local/nix";
fsType = "zfs";
};
swapDevices = [ ];

Binary file not shown.

View file

@ -0,0 +1,19 @@
{ impermanence, ... }:
{
imports = [
impermanence.nixosModules.impermanence
];
environment.persistence."/nix/persist/common" = {
directories = [
"/etc/ssh"
"/var/lib"
];
files = [
"/etc/machine-id"
"/etc/shadow"
];
};
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./common.nix
];
}

View file

@ -1,13 +1,18 @@
{ config, pkgs, ... }:
{ ... }:
{
imports = [
./hardware/qemu-vm.nix
../sets/meta/sysadmin.nix
../packages/vim/package.nix
./common.nix
./persist/qemu-vm.nix
];
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
networking.hostId = "e78229f8";
time.timeZone = "Europe/Berlin";
}