~abyxcos/nas.nix

88d92282989924a1cb9aaadc094f320776a08202 — abyxcos 1 year, 5 months ago 8411961
Clean up some old grup options. Remove Vagrant (never committed) in favor of libvirtd and virt-manager for VMs. The XML fragments aren't automatically handled by Nix, we need to manually import them to virsh.
4 files changed, 53 insertions(+), 17 deletions(-)

M configuration.nix
M hardware-configuration.nix
A libvirtd.pool_guava.xml
A libvirtd.pool_guava_isos.xml
M configuration.nix => configuration.nix +12 -17
@@ 10,17 10,6 @@
      ./hardware-configuration.nix
    ];

  # Use the GRUB 2 boot loader.
  #boot.loader.grub.enable = true;
  #boot.loader.grub.version = 2;
  #boot.loader.grub.efiSupport = true;
  #boot.loader.grub.configurationLimit = 20;
  ## boot.loader.grub.efiInstallAsRemovable = true;
  ## boot.loader.efi.efiSysMountPoint = "/boot/efi";
  ## Define on which hard drive you want to install Grub.
  #boot.loader.grub.device = "/dev/sdg"; # or "nodev" for efi only
  #boot.loader.grub.copyKernels = true;

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.supportedFilesystems = [ "zfs" ];


@@ 28,6 17,9 @@
  # Enable virtualisation
  boot.kernelModules = [ "kvm-amd" "kvm-intel" "coretemp" "jc42" ];
  virtualisation.libvirtd.enable = true;
  virtualisation.libvirtd.qemu.ovmf.enable = true;
  # libvirtd now requires polkit to be enabled
  security.polkit.enable = true;

  # Enable automatic upgrades but don't reboot
  system.autoUpgrade.enable = true;


@@ 35,7 27,6 @@

  networking.hostName = "nas"; # Define your hostname.
  networking.hostId = "e058e4cd";
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Set your time zone.
  # time.timeZone = "Europe/Amsterdam";


@@ 57,21 48,20 @@
  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.abyxcos = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
    extraGroups = [ "wheel" "libvirtd" ]; # Enable ‘sudo’ for the user.
  };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    nixos-option
    lm_sensors
    wget curl vim tmux htop lsof
    wget curl vim tmux htop lsof tree
    unzip
    git ripgrep
    clang llvm gcc binutils file
    go
    rustc cargo cargo-flamegraph openssl pkg-config
    navidrome
    jellyfin
    navidrome jellyfin
  ];

  # Some programs need SUID wrappers, can be configured further or are


@@ 86,6 76,11 @@

  # Enable the OpenSSH daemon.
  services = {
    zfs = {
      autoScrub.enable = true;
      autoSnapshot.enable = true;
    };

    openssh = {
      enable = true;
    };

M hardware-configuration.nix => hardware-configuration.nix +5 -0
@@ 73,6 73,11 @@
      fsType = "zfs";
    };

  fileSystems."/mnt/guava/vm" =
    { device = "guava/vm";
      fsType = "zfs";
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/2b47c28e-7a36-4473-9474-aa157159a007"; }
      { device = "/dev/disk/by-uuid/7de3ccde-cfed-4d8b-ab64-fa4672be132c"; }

A libvirtd.pool_guava.xml => libvirtd.pool_guava.xml +18 -0
@@ 0,0 1,18 @@
<pool type='dir'>
  <name>guava</name>
  <uuid>7639a36b-f01a-4f07-91f0-b7a5b042e1c3</uuid>
  <capacity unit='bytes'>5325064241152</capacity>
  <allocation unit='bytes'>3354787840</allocation>
  <available unit='bytes'>5321709453312</available>
  <source>
  </source>
  <target>
    <path>/mnt/guava/vm/libvirtd_images</path>
    <permissions>
      <mode>0775</mode>
      <owner>0</owner>
      <group>67</group>
    </permissions>
  </target>
</pool>


A libvirtd.pool_guava_isos.xml => libvirtd.pool_guava_isos.xml +18 -0
@@ 0,0 1,18 @@
<pool type='dir'>
  <name>guava-isos</name>
  <uuid>9db3c962-0872-46ce-907e-44f218da7b24</uuid>
  <capacity unit='bytes'>5436124954624</capacity>
  <allocation unit='bytes'>114399510528</allocation>
  <available unit='bytes'>5321725444096</available>
  <source>
  </source>
  <target>
    <path>/mnt/guava/isos</path>
    <permissions>
      <mode>0755</mode>
      <owner>1000</owner>
      <group>100</group>
    </permissions>
  </target>
</pool>