Fix impermanence vm
This commit is contained in:
parent
a1c5c3b291
commit
fb414ef491
9 changed files with 59 additions and 47 deletions
|
@ -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
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Common configuration for all systems
|
# Common configuration for all systems
|
||||||
|
|
||||||
{ config, pkgs, ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
nix = {
|
nix = {
|
|
@ -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
|
||||||
|
|
BIN
systems/persist/.common.nix.un~
Normal file
BIN
systems/persist/.common.nix.un~
Normal file
Binary file not shown.
19
systems/persist/common.nix
Normal file
19
systems/persist/common.nix
Normal 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"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
7
systems/persist/qemu-vm.nix
Normal file
7
systems/persist/qemu-vm.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Select the user from the ./users directory
|
|
||||||
"user"
|
|
Loading…
Reference in a new issue