1
Fork 0

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

View file

@ -10,16 +10,15 @@
}; };
outputs = { self, nixpkgs, ... }@attrs: let outputs = { self, nixpkgs, ... }@attrs: let
user = import ./username.nix; user = "user"; # Select user from `./users` directory
in { in {
# Debugging VM configuration # Debugging VM configuration
nixosConfigurations.qemu-vm = nixpkgs.lib.nixosSystem { nixosConfigurations.qemu-vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = attrs;
modules = [ modules = [
./users/${user}.nix ./users/${user}.nix
./common.nix
./systems/qemu-vm.nix ./systems/qemu-vm.nix
./systems/hardware/qemu-vm.nix
]; ];
}; };
}; };

View file

@ -1,10 +1,11 @@
{ config, pkgs, ... }: { pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
htop htop
wget wget
curl curl
git
]; ];
services.openssh.enable = true; services.openssh.enable = true;

View file

@ -1,6 +1,6 @@
# Common configuration for all systems # Common configuration for all systems
{ config, pkgs, ... }: { ... }:
{ {
nix = { nix = {

View file

@ -1,54 +1,37 @@
# Do not modify this file! It was generated by nixos-generate-config {lib, modulesPath, ... }:
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [
[ (modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.initrd.postDeviceCommands = lib.mkAfter ''
zfs rollback -r local/root@blank
'';
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = boot.zfs.devNodes = "/dev/disk/by-path";
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7";
fsType = "btrfs"; fileSystems."/" = {
options = [ "subvol=root" ]; device = "local/root";
fsType = "zfs";
}; };
fileSystems."/home" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/cba5b18e-14e6-479d-baf5-0827fced96e7"; device = "/dev/disk/by-uuid/1FD8-C4B8";
fsType = "btrfs";
options = [ "subvol=home" ];
};
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";
fsType = "vfat"; fsType = "vfat";
}; };
fileSystems."/nix" = {
device = "local/nix";
fsType = "zfs";
};
swapDevices = [ ]; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking

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 = [ imports = [
./hardware/qemu-vm.nix
../sets/meta/sysadmin.nix ../sets/meta/sysadmin.nix
../packages/vim/package.nix ../packages/vim/package.nix
./common.nix
./persist/qemu-vm.nix
]; ];
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";
networking.hostId = "e78229f8";
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
} }

View file

@ -1,2 +0,0 @@
# Select the user from the ./users directory
"user"