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
user = import ./username.nix;
user = "user"; # Select user from `./users` directory
in {
# Debugging VM configuration
nixosConfigurations.qemu-vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
modules = [
./users/${user}.nix
./common.nix
./systems/qemu-vm.nix
./systems/hardware/qemu-vm.nix
];
};
};

View file

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

View file

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

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";
}

View file

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