From 4308e476fb517ccaf8b264d0989c60e50ce2db57 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 24 Jan 2025 10:35:24 +0000 Subject: [PATCH 1/3] add homeshare nfs client to semita --- hosts/citadel/default.nix | 2 +- hosts/semita/default.nix | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hosts/citadel/default.nix b/hosts/citadel/default.nix index 4f42d4c..8745c23 100644 --- a/hosts/citadel/default.nix +++ b/hosts/citadel/default.nix @@ -51,7 +51,7 @@ in { ../common/optional/fileserver/nfs-client/photos.nix ../common/optional/fileserver/nfs-client/personal.nix - ../common/optional/printing.nix + # ../common/optional/printing.nix ../common/optional/backlight.nix ../common/optional/xmodmap-arrow-remaps.nix ../common/optional/nix-ld.nix diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix index ba1f01f..8576d54 100644 --- a/hosts/semita/default.nix +++ b/hosts/semita/default.nix @@ -55,6 +55,10 @@ in { ../common/optional/gaming.nix ../common/optional/restic-backup.nix + ../common/optional/fileserver/nfs-client/media.nix + ../common/optional/fileserver/nfs-client/photos.nix + ../common/optional/fileserver/nfs-client/personal.nix + ../common/optional/distributed-builds/local-machine.nix outputs.nixosModules.nixosAutoUpgrade From c5d3d7c7dfe135c56615a5a208f861ffc799313c Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 24 Jan 2025 10:58:35 +0000 Subject: [PATCH 2/3] sparky autoupgrade and change home persistence --- hosts/common/users/media/default.nix | 20 +++----------------- hosts/sparky/default.nix | 11 ++++++----- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/hosts/common/users/media/default.nix b/hosts/common/users/media/default.nix index a0320dd..179145f 100644 --- a/hosts/common/users/media/default.nix +++ b/hosts/common/users/media/default.nix @@ -21,7 +21,6 @@ in { extraGroups = [ "scanner" "lp" - "wheel" ]; packages = with pkgs; [ @@ -31,22 +30,9 @@ in { }; environment.persistence."/persist" = { - hideMounts = true; - users.${username} = { - directories = [ - "Sync" - "Keep" - ".ssh" - ".config" - ".mozilla" - ".local" - ".zotero" - ".var" - ".steam" - ]; - files = [ - ]; - }; + directories = [ + "/home/${username}" + ]; }; sops.secrets = { diff --git a/hosts/sparky/default.nix b/hosts/sparky/default.nix index 5c76883..aba4ca6 100644 --- a/hosts/sparky/default.nix +++ b/hosts/sparky/default.nix @@ -15,6 +15,7 @@ then "/dev/mapper/crypted" else "/dev/root_vg/root"; impermanence = true; + merlinIp = configVars.networking.addresses.merlin.ip; piholeIp = configVars.networking.addresses.pihole.ip; gatewayIp = configVars.networking.addresses.gateway.ip; in { @@ -44,9 +45,9 @@ in { # Import optional options ../common/optional/openssh.nix ../common/optional/persistence.nix - # ../common/optional/fileserver/media.nix - ../common/optional/gaming.nix - ../common/optional/printing.nix + ../common/optional/fileserver/nfs-client/media.nix + # ../common/optional/printing.nix + ../common/optional/distributed-builds/local-machine.nix outputs.nixosModules.nixosAutoUpgrade ]; @@ -80,11 +81,11 @@ in { system.services.nixosAutoUpgrade = { enable = true; persistent = true; + remote = "remotebuild@${merlinIp}"; reboot = false; pushUpdates = false; configDir = "/etc/nixos"; - onCalendar = "*-*-* 07:00:00"; - user = "media"; + onCalendar = "*-*-* 06:00:00"; }; services.xserver = { From a8b91ff8618d0430d9ec8cc2bc9b9274bf9e048f Mon Sep 17 00:00:00 2001 From: System administrator Date: Fri, 24 Jan 2025 11:55:11 +0000 Subject: [PATCH 3/3] manual declare hw conf for sparky --- hosts/sparky/default.nix | 58 ++--------------- hosts/sparky/hardware-configuration.nix | 84 ++++++++++++++++++++----- 2 files changed, 73 insertions(+), 69 deletions(-) diff --git a/hosts/sparky/default.nix b/hosts/sparky/default.nix index aba4ca6..d0e8e57 100644 --- a/hosts/sparky/default.nix +++ b/hosts/sparky/default.nix @@ -1,20 +1,11 @@ { - inputs, - config, lib, configVars, outputs, + pkgs, ... }: let - # Disko setup - fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence - dev = "/dev/sda"; # depends on target hardware - encrypted = false; # currrently only applies to btrfs - btrfsMountDevice = - if encrypted - then "/dev/mapper/crypted" - else "/dev/root_vg/root"; - impermanence = true; + btrfsMountDevice = "/dev/root_vg/root"; merlinIp = configVars.networking.addresses.merlin.ip; piholeIp = configVars.networking.addresses.pihole.ip; gatewayIp = configVars.networking.addresses.gateway.ip; @@ -22,15 +13,7 @@ in { imports = [ # Create users for this host ../common/users/media - - # Disk configuration - inputs.disko.nixosModules.disko - (import ../common/disks { - device = dev; - impermanence = impermanence; - fsType = fsType; - encrypted = encrypted; - }) + ./hardware-configuration.nix # Impermanence (import ../common/disks/btrfs/impermanence.nix { @@ -51,15 +34,6 @@ in { outputs.nixosModules.nixosAutoUpgrade ]; - boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - timeout = 3; - }; - }; - boot.kernelParams = ["i915.enable_psr=0"]; - networking = { hostName = "sparky"; networkmanager.enable = true; @@ -67,14 +41,6 @@ in { nameservers = ["${piholeIp}" "${gatewayIp}" "8.8.8.8"]; }; - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ - # Add additional package names here - "nvidia-x11" - "nvidia-settings" - "nvidia-persistenced" - ]; - services.displayManager.defaultSession = "cinnamon"; services.libinput.enable = true; @@ -86,11 +52,12 @@ in { pushUpdates = false; configDir = "/etc/nixos"; onCalendar = "*-*-* 06:00:00"; + user = "root"; }; services.xserver = { enable = true; - videoDrivers = ["nvidia"]; + videoDrivers = ["modesetting"]; displayManager.lightdm.enable = true; exportConfiguration = true; deviceSection = '' @@ -100,19 +67,4 @@ in { }; }; - # Enable OpenGL - hardware.opengl = { - enable = true; - driSupport32Bit = true; - }; - - # Load nvidia driver - hardware.nvidia = { - # https://nixos.wiki/wiki/Nvidia - modesetting.enable = true; - powerManagement.enable = false; - open = false; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; } diff --git a/hosts/sparky/hardware-configuration.nix b/hosts/sparky/hardware-configuration.nix index 0a2bb19..e3ab1b7 100644 --- a/hosts/sparky/hardware-configuration.nix +++ b/hosts/sparky/hardware-configuration.nix @@ -1,24 +1,76 @@ -# 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, ... }: +{ config, lib, pkgs, ... }: { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + fileSystems."/" = + { device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/persist" = + { device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd"; + fsType = "btrfs"; + options = [ "subvol=persist" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/.swapvol" = + { device = "/dev/disk/by-uuid/7e660e53-6c56-4679-ab25-3a2b1eacaebd"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3DC4-7CCE"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ + { + device = "/.swapvol/swapfile"; + size = 2 * 1024; + } + ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # Add hardware support for intel gpus as specified here: https://nixos.wiki/wiki/Jellyfin + nixpkgs.config.packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;}; + }; + + hardware.graphics = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + intel-vaapi-driver + vaapiVdpau + libvdpau-va-gl + intel-compute-runtime + # only available on unstable + unstable.vpl-gpu-rt + intel-media-sdk + ]; + }; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + timeout = 3; + }; + }; + boot.kernelParams = ["i915.enable_psr=0"]; }