summary refs log tree commit diff
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-10-15 15:52:11 +0200
committerMel <einebeere@gmail.com>2024-10-15 15:52:11 +0200
commitc8235346fe342df4aebc3f47d4f29040162dbe61 (patch)
tree4ca20dccf9db66203b1c9a8b1593b8d964a2fa16
parent42d7140ae47ec30b84150d9b721682b30c74a1a7 (diff)
downloadminerals-c8235346fe342df4aebc3f47d4f29040162dbe61.tar.zst
minerals-c8235346fe342df4aebc3f47d4f29040162dbe61.zip
Bring in bismuth configuration
Signed-off-by: Mel <einebeere@gmail.com>
-rw-r--r--configs/monitors.xml88
-rw-r--r--flake.nix4
-rw-r--r--machines/bismuth/default.nix27
-rw-r--r--machines/bismuth/devices.nix75
-rw-r--r--machines/bismuth/hardware.nix37
-rw-r--r--machines/bismuth/home.nix9
-rw-r--r--machines/graphite/default.nix (renamed from machines/graphite.nix)6
-rw-r--r--machines/graphite/devices.nix (renamed from machines/devices/graphite.nix)0
-rw-r--r--machines/graphite/hardware.nix (renamed from machines/hardware/graphite.nix)0
-rw-r--r--machines/graphite/home.nix9
-rw-r--r--modules/home/common.nix (renamed from home.nix)2
-rw-r--r--modules/jellyfin.nix18
-rw-r--r--modules/nvidia.nix63
-rw-r--r--pkgs/default.nix5
-rw-r--r--pkgs/jellyfin-edited.nix15
15 files changed, 351 insertions, 7 deletions
diff --git a/configs/monitors.xml b/configs/monitors.xml
new file mode 100644
index 0000000..fcd7bbe
--- /dev/null
+++ b/configs/monitors.xml
@@ -0,0 +1,88 @@
+<monitors version="2">
+  <configuration>
+    <logicalmonitor>
+      <x>3840</x>
+      <y>0</y>
+      <scale>2</scale>
+      <primary>yes</primary>
+      <monitor>
+        <monitorspec>
+          <connector>DP-2</connector>
+          <vendor>GBT</vendor>
+          <product>M28U</product>
+          <serial>22120B002639</serial>
+        </monitorspec>
+        <mode>
+          <width>3840</width>
+          <height>2160</height>
+          <rate>144.000</rate>
+        </mode>
+      </monitor>
+    </logicalmonitor>
+    <logicalmonitor>
+      <x>0</x>
+      <y>0</y>
+      <scale>2</scale>
+      <monitor>
+        <monitorspec>
+          <connector>DP-1</connector>
+          <vendor>DEL</vendor>
+          <product>DELL U2720Q</product>
+          <serial>1JSXZ83</serial>
+        </monitorspec>
+        <mode>
+          <width>3840</width>
+          <height>2160</height>
+          <rate>59.997</rate>
+        </mode>
+      </monitor>
+    </logicalmonitor>
+  </configuration>
+  <configuration>
+    <logicalmonitor>
+      <x>3840</x>
+      <y>0</y>
+      <scale>2</scale>
+      <primary>yes</primary>
+      <monitor>
+        <monitorspec>
+          <connector>DP-2</connector>
+          <vendor>GBT</vendor>
+          <product>M28U</product>
+          <serial>22120B002639</serial>
+        </monitorspec>
+        <mode>
+          <width>3840</width>
+          <height>2160</height>
+          <rate>144.000</rate>
+        </mode>
+      </monitor>
+    </logicalmonitor>
+    <logicalmonitor>
+      <x>0</x>
+      <y>0</y>
+      <scale>2</scale>
+      <monitor>
+        <monitorspec>
+          <connector>DP-1</connector>
+          <vendor>DEL</vendor>
+          <product>DELL U2720Q</product>
+          <serial>1JSXZ83</serial>
+        </monitorspec>
+        <mode>
+          <width>3840</width>
+          <height>2160</height>
+          <rate>59.997</rate>
+        </mode>
+      </monitor>
+    </logicalmonitor>
+    <disabled>
+      <monitorspec>
+        <connector>None-1</connector>
+        <vendor>unknown</vendor>
+        <product>unknown</product>
+        <serial>unknown</serial>
+      </monitorspec>
+    </disabled>
+  </configuration>
+</monitors>
diff --git a/flake.nix b/flake.nix
index 51d13d9..0d04ff9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -35,12 +35,12 @@
         specialArgs = inputs // packageSets;
 
         modules = [
-          ./machines/${machine}.nix
+          ./machines/${machine}
         
           home-manager.nixosModules.home-manager {
             home-manager.useGlobalPkgs = true;
             home-manager.useUserPackages = true;
-            home-manager.users.mel = import ./home.nix;
+            home-manager.users.mel = import ./machines/${machine}/home.nix;
           }
         ];
       }
diff --git a/machines/bismuth/default.nix b/machines/bismuth/default.nix
new file mode 100644
index 0000000..8dbdd14
--- /dev/null
+++ b/machines/bismuth/default.nix
@@ -0,0 +1,27 @@
+{ ... }:
+
+{
+  imports = [
+    ../../modules/common.nix
+
+    ./hardware.nix
+    ./devices.nix
+
+    ../../modules/jellyfin.nix
+    ../../modules/nvidia.nix
+  ];
+
+  networking.hostName = "Bismuth";
+
+  # expose vm web interface to tailnet
+  services.tailscale.extraUpFlags = [
+    "--advertise-routes=192.168.122.100/32"
+  ];
+
+  # set monitor configuration for gdm
+  systemd.tmpfiles.rules = [
+    "L+ /run/gdm/.config/monitors.xml - - - - ${../../configs/monitors.xml}"
+  ];
+
+  system.stateVersion = "23.11";
+}
diff --git a/machines/bismuth/devices.nix b/machines/bismuth/devices.nix
new file mode 100644
index 0000000..06fa69f
--- /dev/null
+++ b/machines/bismuth/devices.nix
@@ -0,0 +1,75 @@
+{ config, pkgs, ... }:
+
+{
+  # boot settings
+  boot = {
+    loader.grub = {
+      enable = true;
+      devices = [ "nodev" ];
+      efiSupport = true;
+      useOSProber = true;
+      gfxmodeEfi = "1366x768x32";
+    };
+
+    loader.efi.canTouchEfiVariables = true;
+
+    plymouth.enable = true;
+  
+    initrd.systemd.enable = true; 
+  };
+
+  # swap
+  swapDevices = [{
+    device = "/var/swapfile";
+    size = 8 * 1024;
+  }];
+
+  # internet
+  networking.networkmanager.enable = true;
+  
+  # sound 
+  sound.enable = true;
+  hardware.pulseaudio.enable = false;
+  security.rtkit.enable = true;
+  services.pipewire = {
+    enable = true;
+    alsa = { enable = true; support32Bit = true; };
+    pulse.enable = true;
+    jack.enable = true;
+  };
+
+  # extra filesystems
+  boot.supportedFilesystems = [ "ntfs" ];
+
+  fileSystems = {
+    "/run/media/mel/Duo" = {
+      device = "/dev/disk/by-label/Duo";
+      fsType = "ntfs-3g";
+      options = [ "rw" "uid=1000" ];
+    };
+    "/run/media/mel/Half" = {
+      device = "/dev/disk/by-label/Half";
+      fsType = "ntfs-3g";
+      options = [ "rw" "uid=1000" ];
+    };
+    "/run/media/mel/Main" = {
+      device = "/dev/disk/by-label/Main";
+      fsType = "ntfs-3g";
+      options = [ "rw" "uid=1000" ];
+    };
+  };
+
+  # printing
+  services.printing = {
+    enable = true;
+    stateless = true;
+    startWhenNeeded = true;
+  };
+
+  services.avahi.enable = false;
+  #services.avahi = {
+  #  enable = true;
+  #  nssmdns4 = true;
+  #  openFirewall = true;
+  #};
+}
diff --git a/machines/bismuth/hardware.nix b/machines/bismuth/hardware.nix
new file mode 100644
index 0000000..272f987
--- /dev/null
+++ b/machines/bismuth/hardware.nix
@@ -0,0 +1,37 @@
+# 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, ... }:
+
+{
+  imports =
+    [ (modulesPath + "/installer/scan/not-detected.nix")
+    ];
+
+  boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
+  boot.initrd.kernelModules = [ ];
+  boot.kernelModules = [ "kvm-amd" ];
+  boot.extraModulePackages = [ ];
+
+  fileSystems."/" =
+    { device = "/dev/disk/by-uuid/58d99ea0-ea5e-465a-a5aa-4dc6f6d02e55";
+      fsType = "ext4";
+    };
+
+  fileSystems."/boot" =
+    { device = "/dev/disk/by-uuid/F2C3-B4E5";
+      fsType = "vfat";
+    };
+
+  swapDevices = [ ];
+
+  # 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.<interface>.useDHCP`.
+  networking.useDHCP = lib.mkDefault true;
+  # networking.interfaces.eno1.useDHCP = lib.mkDefault true;
+
+  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
diff --git a/machines/bismuth/home.nix b/machines/bismuth/home.nix
new file mode 100644
index 0000000..2ba6f25
--- /dev/null
+++ b/machines/bismuth/home.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }:
+
+{
+  imports = [
+    ../../modules/home/common.nix
+  ];
+
+  home.stateVersion = "23.11";
+}
diff --git a/machines/graphite.nix b/machines/graphite/default.nix
index d0bcaa8..4bbb938 100644
--- a/machines/graphite.nix
+++ b/machines/graphite/default.nix
@@ -2,10 +2,10 @@
 
 {
   imports = [
-    ../modules/common.nix
+    ../../modules/common.nix
 
-    ./hardware/graphite.nix
-    ./devices/graphite.nix
+    ./hardware.nix
+    ./devices.nix
   ];
 
   networking.hostName = "Graphite";
diff --git a/machines/devices/graphite.nix b/machines/graphite/devices.nix
index f8b7631..f8b7631 100644
--- a/machines/devices/graphite.nix
+++ b/machines/graphite/devices.nix
diff --git a/machines/hardware/graphite.nix b/machines/graphite/hardware.nix
index c8fc7c6..c8fc7c6 100644
--- a/machines/hardware/graphite.nix
+++ b/machines/graphite/hardware.nix
diff --git a/machines/graphite/home.nix b/machines/graphite/home.nix
new file mode 100644
index 0000000..dce0783
--- /dev/null
+++ b/machines/graphite/home.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }:
+
+{
+  imports = [
+    ../../modules/home/common.nix
+  ];
+
+  home.stateVersion = "24.05";
+}
diff --git a/home.nix b/modules/home/common.nix
index f13eb88..8e1a1c7 100644
--- a/home.nix
+++ b/modules/home/common.nix
@@ -37,6 +37,4 @@
   home.sessionPath = [
     "$HOME/.local/share/JetBrains/Toolbox/scripts"
   ];
-
-  home.stateVersion = "24.05";
 }
diff --git a/modules/jellyfin.nix b/modules/jellyfin.nix
new file mode 100644
index 0000000..1194573
--- /dev/null
+++ b/modules/jellyfin.nix
@@ -0,0 +1,18 @@
+{ config, pkgs, unstable, ... }:
+
+let
+  auxiliaryPkgs = import ../pkgs { inherit pkgs unstable; };
+in
+{
+  services.jellyfin = {
+    enable = true;
+    openFirewall = true;
+    package = auxiliaryPkgs.jellyfin;
+  };
+
+  environment.systemPackages = (with auxiliaryPkgs; [
+    jellyfin
+    jellyfin-web
+    pkgs.jellyfin-ffmpeg
+  ]);
+}
diff --git a/modules/nvidia.nix b/modules/nvidia.nix
new file mode 100644
index 0000000..efb38a3
--- /dev/null
+++ b/modules/nvidia.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, fetchpatch, ... }:
+
+let
+  # Fixes framebuffer with linux 6.11
+  fbdev_linux_611_patch = fetchpatch {
+    url = "https://patch-diff.githubusercontent.com/raw/NVIDIA/open-gpu-kernel-modules/pull/692.patch";
+    hash = "sha256-OYw8TsHDpBE5DBzdZCBT45+AiznzO9SfECz5/uXN5Uc=";
+  };
+in
+{
+  # Enable OpenGL
+  hardware.opengl = {
+    enable = true;
+    driSupport = true;
+    driSupport32Bit = true;
+  };
+
+  # Load nvidia driver for Xorg and Wayland
+  services.xserver.videoDrivers = ["nvidia"];
+
+  hardware.nvidia = {
+
+    # Modesetting is required.
+    modesetting.enable = true;
+
+    # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
+    powerManagement.enable = true;
+    # Fine-grained power management. Turns off GPU when not in use.
+    # Experimental and only works on modern Nvidia GPUs (Turing or newer).
+    powerManagement.finegrained = false;
+
+    # Use the NVidia open source kernel module (not to be confused with the
+    # independent third-party "nouveau" open source driver).
+    # Support is limited to the Turing and later architectures. Full list of 
+    # supported GPUs is at: 
+    # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus 
+    # Only available from driver 515.43.04+
+    # Currently alpha-quality/buggy, so false is currently the recommended setting.
+    # open = false;
+
+    # Enable the Nvidia settings menu,
+	# accessible via `nvidia-settings`.
+    # note: fails to build after 560
+    nvidiaSettings = false;
+
+    # Optionally, you may need to select the appropriate driver version for your specific GPU.
+    # package = config.boot.kernelPackages.nvidiaPackages.beta;
+    
+    # note: this is enabled by default for nvidia 555 so maybe it should be true?
+    # very crashy :(
+    open = false;   
+
+    package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
+      version = "560.35.03";
+      sha256_64bit = "sha256-8pMskvrdQ8WyNBvkU/xPc/CtcYXCa7ekP73oGuKfH+M=";
+      sha256_aarch64 = "sha256-s8ZAVKvRNXpjxRYqM3E5oss5FdqW+tv1qQC2pDjfG+s=";
+      openSha256 = "sha256-/32Zf0dKrofTmPZ3Ratw4vDM7B+OgpC4p7s+RHUjCrg=";
+      settingsSha256 = "sha256-kQsvDgnxis9ANFmwIwB7HX5MkIAcpEEAHc8IBOLdXvk=";
+      persistencedSha256 = "sha256-E2J2wYYyRu7Kc3MMZz/8ZIemcZg68rkzvqEwFAL3fFs=";
+      #patchesOpen = [ fbdev_linux_611_patch ];
+    }; 
+  };
+}
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 5f87431..104a92d 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -1,6 +1,11 @@
 { pkgs, unstablePkgs, ... }:
 
 rec {
+  inherit (pkgs.callPackages ./jellyfin-edited.nix {
+    jellyfin-prev = pkgs.jellyfin;
+    jellyfin-web-prev = pkgs.jellyfin-web;
+  }) jellyfin jellyfin-web;
+  
   inherit (pkgs.callPackages ./electron-wayland-wrappers.nix {})
     discord
     obsidian
diff --git a/pkgs/jellyfin-edited.nix b/pkgs/jellyfin-edited.nix
new file mode 100644
index 0000000..5792c77
--- /dev/null
+++ b/pkgs/jellyfin-edited.nix
@@ -0,0 +1,15 @@
+{ jellyfin-prev, jellyfin-web-prev }:
+ 
+let
+  script = "<script src=\"configurationpage?name=skip-intro-button.js\"></script>";
+
+  jellyfin-web = jellyfin-web-prev.overrideAttrs (attrs: {
+    postInstall = (attrs.postInstall or "") + ''
+      sed -i 's:</head>:${script}</head>:g' $out/share/jellyfin-web/index.html
+    '';
+  });
+
+  jellyfin = jellyfin-prev.override {
+    inherit jellyfin-web;
+  };
+in { inherit jellyfin jellyfin-web; }