diff --git a/cachix/cachix.nix b/cachix/cachix.nix index 6db8054..81515ed 100644 --- a/cachix/cachix.nix +++ b/cachix/cachix.nix @@ -1,4 +1,3 @@ - # WARN: this file will get overwritten by $ cachix use { pkgs, lib, ... }: @@ -6,8 +5,9 @@ let folder = ../cachix; toImport = name: value: folder + ("/" + name); filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; - imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); + imports = lib.mapAttrsToList toImport + (lib.filterAttrs filterCaches (builtins.readDir folder)); in { inherit imports; - nix.settings.substituters = ["https://cache.nixos.org/"]; -} \ No newline at end of file + nix.settings.substituters = [ "https://cache.nixos.org/" ]; +} diff --git a/cachix/nix-community.nix b/cachix/nix-community.nix index 4c03c1a..5579717 100644 --- a/cachix/nix-community.nix +++ b/cachix/nix-community.nix @@ -1,13 +1,10 @@ - { nix = { settings = { - substituters = [ - "https://nix-community.cachix.org" - ]; + substituters = [ "https://nix-community.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; }; -} \ No newline at end of file +} diff --git a/flake.nix b/flake.nix index 9f2d098..42939c2 100644 --- a/flake.nix +++ b/flake.nix @@ -21,35 +21,36 @@ nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; - outputs = { self, nixpkgs, lanzaboote, impermanence, nix-flatpak, home-manager, nixos-hardware } @ inputs: { - nixosConfigurations = { - # Desktop - "matt-nixos" = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - impermanence.nixosModules.impermanence - lanzaboote.nixosModules.lanzaboote - # kde.nixosModules.plasma6 - nix-flatpak.nixosModules.nix-flatpak - ./hosts/desktop/configuration.nix - ./share/impermanence - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.matt = import ./hosts/desktop/home.nix; - } - ]; - }; + outputs = { self, nixpkgs, lanzaboote, impermanence, nix-flatpak, home-manager + , nixos-hardware }@inputs: { + nixosConfigurations = { + # Desktop + "matt-nixos" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + impermanence.nixosModules.impermanence + lanzaboote.nixosModules.lanzaboote + # kde.nixosModules.plasma6 + nix-flatpak.nixosModules.nix-flatpak + ./hosts/desktop/configuration.nix + ./share/impermanence + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.matt = import ./hosts/desktop/home.nix; + } + ]; + }; - # Pi4 - "nixos-pi4" = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - nixos-hardware.nixosModules.raspberry-pi-4 - ./hosts/pi4/configuration.nix - ]; + # Pi4 + "nixos-pi4" = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + nixos-hardware.nixosModules.raspberry-pi-4 + ./hosts/pi4/configuration.nix + ]; + }; }; }; - }; } diff --git a/hosts/default.nix b/hosts/default.nix index 057705d..820d8df 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,13 +1,7 @@ { config, lib, pkgs, ... }: -let - timezone = "America/Chicago"; -in -{ - imports = - [ - ../modules - ../share - ]; +let timezone = "America/Chicago"; +in { + imports = [ ../modules ../share ]; # Enable nix flakes and nix-command tools nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -23,17 +17,17 @@ in # Disable pulse audio in favor of pipewire pulseaudio.enable = false; }; - + # Services configs services = { openssh.enable = true; # Enable firmware updates fwupd.enable = true; - + # Enable CUPS to print documents. printing.enable = true; - + # configure pipewire pipewire = { enable = true; @@ -56,8 +50,8 @@ in interpreter = "${pkgs.appimage-run}/bin/appimage-run"; recognitionType = "magic"; offset = 0; - mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; - magicOrExtension = ''\x7fELF....AI\x02''; + mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff"; + magicOrExtension = "\\x7fELF....AI\\x02"; }; }; -} \ No newline at end of file +} diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 8a30f4c..18f36d9 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -5,31 +5,29 @@ { config, lib, pkgs, ... }: let user = "matt"; - password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; + password = + "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; hostname = "matt-nixos"; # discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages. - discover-wrapped = pkgs.symlinkJoin - { - name = "discover-flatpak-backend"; - paths = [ pkgs.libsForQt5.discover ]; - buildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak" - ''; - }; -in -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - # ../../cachix/cachix.nix - ../default.nix - ]; + discover-wrapped = pkgs.symlinkJoin { + name = "discover-flatpak-backend"; + paths = [ pkgs.libsForQt5.discover ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak" + ''; + }; +in { + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + # ../../cachix/cachix.nix + ../default.nix + ]; share.hardware.amd = { enable = true; corectrl.enable = true; - corectrl.enablePolkit = true; + corectrl.enablePolkit = true; }; # Configure bootloader with lanzaboot and secureboot @@ -55,13 +53,11 @@ in }; configurationLimit = 2; }; - + # Override kernel to latest kernelPackages = pkgs.linuxPackages_latest; - kernelParams = [ - "quiet" - ]; + kernelParams = [ "quiet" ]; consoleLogLevel = 3; bootspec.enable = true; @@ -77,7 +73,7 @@ in # Steam udev rules for remote play steam-hardware.enable = true; - + # opengl.enable = true; # # Enables support for 32bit libs that steam uses # opengl.driSupport32Bit = true; @@ -88,7 +84,7 @@ in # Enable the X11 windowing system. xserver = { enable = true; - + # Enable the Plasma 6 Desktop Environment. displayManager = { sddm.enable = true; @@ -147,10 +143,8 @@ in }; # Time config - time = { - hardwareClockInLocalTime = true; - }; - + time = { hardwareClockInLocalTime = true; }; + # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ]; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; @@ -218,8 +212,10 @@ in # Steam steam = { enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + remotePlay.openFirewall = + true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = + true; # Open ports in the firewall for Source Dedicated Server }; }; @@ -236,18 +232,19 @@ in packageOverrides = pkgs: { steam = pkgs.steam.override { - extraPkgs = pkgs: with pkgs; [ - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - libpng - libpulseaudio - libvorbis - stdenv.cc.cc.lib - libkrb5 - keyutils - ]; + extraPkgs = pkgs: + with pkgs; [ + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + ]; }; }; }; diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix index 0de6494..52cb212 100644 --- a/hosts/desktop/hardware-configuration.nix +++ b/hosts/desktop/hardware-configuration.nix @@ -4,67 +4,65 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "ahci" "usbhid" "uas" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "xhci_pci" "nvme" "ahci" "usbhid" "uas" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "none"; - fsType = "tmpfs"; - }; + fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; - fsType = "btrfs"; - options = [ "subvol=nix" "compress=zstd" "noatime" ]; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; + fsType = "btrfs"; + options = [ "subvol=nix" "compress=zstd" "noatime" ]; + }; - fileSystems."/etc" = - { device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; - fsType = "btrfs"; - options = [ "subvol=etc" "compress=zstd" "noatime" ]; - }; + fileSystems."/etc" = { + device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; + fsType = "btrfs"; + options = [ "subvol=etc" "compress=zstd" "noatime" ]; + }; - fileSystems."/root" = - { device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; - fsType = "btrfs"; - options = [ "subvol=root" "compress=zstd" "noatime" ]; - }; + fileSystems."/root" = { + device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; + fsType = "btrfs"; + options = [ "subvol=root" "compress=zstd" "noatime" ]; + }; - fileSystems."/var/log" = - { device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; - fsType = "btrfs"; - options = [ "subvol=log" "compress=zstd" "noatime" ]; - }; + fileSystems."/var/log" = { + device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; + fsType = "btrfs"; + options = [ "subvol=log" "compress=zstd" "noatime" ]; + }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; - fsType = "btrfs"; - options = [ "subvol=home" "compress=zstd" ]; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; + fsType = "btrfs"; + options = [ "subvol=home" "compress=zstd" ]; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/1058-F967"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/1058-F967"; + fsType = "vfat"; + }; swapDevices = - [ { device = "/dev/disk/by-uuid/1db92c49-aa8d-4ca2-b453-83bfcd1d36dd"; } - ]; + [{ device = "/dev/disk/by-uuid/1db92c49-aa8d-4ca2-b453-83bfcd1d36dd"; }]; - fileSystems."/home/matt/Games" = - { device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3"; - fsType = "ext4"; - }; - fileSystems."/home/matt/1TB" = - { device = "/dev/disk/by-uuid/7f9c2d1e-64ee-d901-2084-2d1e64eed901"; - fsType = "ext4"; - }; + fileSystems."/home/matt/Games" = { + device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3"; + fsType = "ext4"; + }; + fileSystems."/home/matt/1TB" = { + device = "/dev/disk/by-uuid/7f9c2d1e-64ee-d901-2084-2d1e64eed901"; + fsType = "ext4"; + }; # 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 @@ -75,5 +73,6 @@ # networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index 66de4b2..68f37af 100644 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -1,8 +1,14 @@ -{ pkgs, ... }: +{ pkgs, ... }: let - vulkan-hdr-layer = import ./vulkan-hdr-layer.nix { inherit (pkgs) lib stdenv fetchFromGitHub meson pkg-config vulkan-loader ninja writeText vulkan-headers vulkan-utility-libraries jq wayland; libX11 = pkgs.xorg.libX11; libXrandr = pkgs.xorg.libXrandr; libxcb = pkgs.xorg.libxcb; }; -in -{ + vulkan-hdr-layer = import ./vulkan-hdr-layer.nix { + inherit (pkgs) + lib stdenv fetchFromGitHub meson pkg-config vulkan-loader ninja writeText + vulkan-headers vulkan-utility-libraries jq wayland; + libX11 = pkgs.xorg.libX11; + libXrandr = pkgs.xorg.libXrandr; + libxcb = pkgs.xorg.libxcb; + }; +in { home.username = "matt"; home.homeDirectory = "/home/matt"; @@ -30,7 +36,7 @@ in programs.command-not-found.enable = true; - home.packages = with pkgs; [ + home.packages = with pkgs; [ firefox tree lm_sensors @@ -46,6 +52,8 @@ in python3 virt-manager orca-slicer + nixfmt + deadnix # Other packages vulkan-hdr-layer ]; diff --git a/hosts/desktop/vulkan-hdr-layer.nix b/hosts/desktop/vulkan-hdr-layer.nix index 94b73b7..4f1ae51 100644 --- a/hosts/desktop/vulkan-hdr-layer.nix +++ b/hosts/desktop/vulkan-hdr-layer.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, fetchFromGitHub, meson, pkg-config, vulkan-loader, ninja, writeText, vulkan-headers, vulkan-utility-libraries, jq, libX11, libXrandr, libxcb, wayland }: +{ lib, stdenv, fetchFromGitHub, meson, pkg-config, vulkan-loader, ninja +, writeText, vulkan-headers, vulkan-utility-libraries, jq, libX11, libXrandr +, libxcb, wayland }: stdenv.mkDerivation rec { pname = "vulkan-hdr-layer"; @@ -18,7 +20,15 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ vulkan-headers meson ninja pkg-config jq ]; - buildInputs = [ vulkan-headers vulkan-loader vulkan-utility-libraries libX11 libXrandr libxcb wayland ]; + buildInputs = [ + vulkan-headers + vulkan-loader + vulkan-utility-libraries + libX11 + libXrandr + libxcb + wayland + ]; # Help vulkan-loader find the validation layers setupHook = writeText "setup-hook" '' @@ -31,4 +41,4 @@ stdenv.mkDerivation rec { platforms = platforms.linux; license = licenses.mit; }; -} \ No newline at end of file +} diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index 5ae81e1..29b6ce2 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -5,21 +5,20 @@ { config, lib, pkgs, ... }: let user = "admin"; - password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; + password = + "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; hostname = "jallen-nas"; -in -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ../default.nix - ]; +in { + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../default.nix + ]; nas-apps = { jellyfin.enable = true; jellyseerr.enable = true; - + sabnzbd.enable = true; radarr.enable = true; @@ -82,7 +81,6 @@ in dataDir = "/mnt/ssd/nix-app-data/grafana"; }; - services.prometheus = { enable = true; port = 9001; @@ -95,19 +93,33 @@ in smartctl = { enable = true; group = "disk"; - devices = [ "/dev/sda" "/dev/sdb" "/dev/sdc" "/dev/sdd" "/dev/sde" "/dev/sdf" "/dev/sdg" "/dev/sdh" "/dev/sdi" "/dev/nvme0n1" "/dev/nvme1n1" ]; + devices = [ + "/dev/sda" + "/dev/sdb" + "/dev/sdc" + "/dev/sdd" + "/dev/sde" + "/dev/sdf" + "/dev/sdg" + "/dev/sdh" + "/dev/sdi" + "/dev/nvme0n1" + "/dev/nvme1n1" + ]; }; }; - - scrapeConfigs = [ - { - job_name = hostname; - static_configs = [{ - targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" - "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}"]; - }]; - } - ]; + + scrapeConfigs = [{ + job_name = hostname; + static_configs = [{ + targets = [ + "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" + "127.0.0.1:${ + toString config.services.prometheus.exporters.smartctl.port + }" + ]; + }]; + }]; }; share.hardware.nvidia = { @@ -130,13 +142,11 @@ in efiSysMountPoint = "/boot"; }; }; - + # Override kernel to latest kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; - kernelParams = [ - "nohibernate" - ]; + kernelParams = [ "nohibernate" ]; consoleLogLevel = 3; bootspec.enable = true; @@ -152,7 +162,7 @@ in # # Nvidia # nvidia = { # package = config.boot.kernelPackages.nvidiaPackages.beta; - + # # Modesetting is required. # modesetting.enable = true; @@ -176,7 +186,7 @@ in # # accessible via `nvidia-settings`. # nvidiaSettings = true; # }; - + # # Enable OpenGL # opengl = { # enable = true; @@ -193,7 +203,7 @@ in # # Load nvidia driver for Xorg and Wayland # videoDrivers = ["nvidia"]; - + # Enable the Plasma 6 Desktop Environment. displayManager = { sddm.enable = true; @@ -279,7 +289,8 @@ in firewall = { enable = true; allowPing = true; - extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns''; # TODO is this needed? + extraCommands = + "iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; # TODO is this needed? allowedTCPPorts = [ 2342 61208 ]; allowedUDPPorts = [ 2342 61208 ]; }; @@ -335,7 +346,15 @@ in # Admin account users."${user}" = { isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "docker" "podman" "libvirtd" "nas-apps" "jallen-nas" ]; # Enable ‘sudo’ for the user. + extraGroups = [ + "wheel" + "networkmanager" + "docker" + "podman" + "libvirtd" + "nas-apps" + "jallen-nas" + ]; # Enable ‘sudo’ for the user. initialHashedPassword = password; shell = pkgs.fish; openssh.authorizedKeys.keys = [ @@ -367,7 +386,7 @@ in group = "jallen-nas"; extraGroups = [ "jallen-nas" ]; # Enable ‘sudo’ for the user. hashedPassword = password; - }; + }; }; # Virtualisation diff --git a/hosts/nas/hardware-configuration.nix b/hosts/nas/hardware-configuration.nix index 6acbe1b..256cb15 100644 --- a/hosts/nas/hardware-configuration.nix +++ b/hosts/nas/hardware-configuration.nix @@ -4,58 +4,56 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "mpt3sas" "xhci_pci" "ahci" "uas" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "nvme" "mpt3sas" "xhci_pci" "ahci" "uas" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "none"; - fsType = "tmpfs"; - }; + fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/C6E9-7371"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C6E9-7371"; + fsType = "vfat"; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; - fsType = "btrfs"; - options = [ "subvol=nix" "compress-force=zstd" "noatime" ]; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; + fsType = "btrfs"; + options = [ "subvol=nix" "compress-force=zstd" "noatime" ]; + }; - fileSystems."/etc" = - { device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; - fsType = "btrfs"; - options = [ "subvol=etc" "compress-force=zstd" "noatime" ]; - }; + fileSystems."/etc" = { + device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; + fsType = "btrfs"; + options = [ "subvol=etc" "compress-force=zstd" "noatime" ]; + }; - fileSystems."/root" = - { device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; - fsType = "btrfs"; - options = [ "subvol=root" "compress-force=zstd" "noatime" ]; - }; + fileSystems."/root" = { + device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; + fsType = "btrfs"; + options = [ "subvol=root" "compress-force=zstd" "noatime" ]; + }; - fileSystems."/var/log" = - { device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; - fsType = "btrfs"; - options = [ "subvol=log" "compress-force=zstd" "noatime" ]; - }; + fileSystems."/var/log" = { + device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; + fsType = "btrfs"; + options = [ "subvol=log" "compress-force=zstd" "noatime" ]; + }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; - fsType = "btrfs"; - options = [ "subvol=home" "compress-force=zstd"]; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; + fsType = "btrfs"; + options = [ "subvol=home" "compress-force=zstd" ]; + }; swapDevices = - [ { device = "/dev/disk/by-uuid/c08ba901-a8a9-4006-9688-002bb24da1b6"; } - ]; + [{ device = "/dev/disk/by-uuid/c08ba901-a8a9-4006-9688-002bb24da1b6"; }]; # 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 @@ -77,5 +75,6 @@ # networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/pi4/configuration.nix b/hosts/pi4/configuration.nix index 5d487b4..c864414 100644 --- a/hosts/pi4/configuration.nix +++ b/hosts/pi4/configuration.nix @@ -6,18 +6,18 @@ let user = "matt"; - password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; + password = + "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; SSID = "Joey’s Jungle"; SSIDpassword = "kR8v&3Qd"; interface = "wlan0"; timezone = "America/Chicago"; hostname = "nixos-pi4"; in { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ./docker-pi4.nix - ]; + imports = [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./docker-pi4.nix + ]; # Enable nix flakes and nix-command tools nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -43,12 +43,7 @@ in { }; }; - environment.systemPackages = with pkgs; [ - vim - raspberrypi-eeprom - htop - git - ]; + environment.systemPackages = with pkgs; [ vim raspberrypi-eeprom htop git ]; services.openssh.enable = true; diff --git a/hosts/pi4/docker-pi4.nix b/hosts/pi4/docker-pi4.nix index 913a86a..876e91a 100644 --- a/hosts/pi4/docker-pi4.nix +++ b/hosts/pi4/docker-pi4.nix @@ -25,9 +25,7 @@ "/media/T5/tv:/tv" ]; ports = [ "8096:8096" ]; - environment = { - JELLYFIN_LOG_DIR = "/log"; - }; + environment = { JELLYFIN_LOG_DIR = "/log"; }; }; } diff --git a/hosts/pi4/hardware-configuration.nix b/hosts/pi4/hardware-configuration.nix index 863f921..7623de6 100644 --- a/hosts/pi4/hardware-configuration.nix +++ b/hosts/pi4/hardware-configuration.nix @@ -4,33 +4,30 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = [ "xhci_pci" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/ec969af6-d557-408a-a149-ba23d31fd8a2"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/ec969af6-d557-408a-a149-ba23d31fd8a2"; + fsType = "ext4"; + }; - fileSystems."/media/T5" = - { device = "/dev/disk/by-uuid/191ce486-899d-4718-81e3-5c9b3ea860e4"; - fsType = "ext4"; - }; + fileSystems."/media/T5" = { + device = "/dev/disk/by-uuid/191ce486-899d-4718-81e3-5c9b3ea860e4"; + fsType = "ext4"; + }; - fileSystems."/FIRMWARE" = - { device = "/dev/disk/by-uuid/5A9F-FC90"; - fsType = "vfat"; - }; + fileSystems."/FIRMWARE" = { + device = "/dev/disk/by-uuid/5A9F-FC90"; + fsType = "vfat"; + }; swapDevices = - [ { device = "/dev/disk/by-uuid/d9909ef7-c345-48f7-b210-ad7cbe72224b"; } - ]; + [{ device = "/dev/disk/by-uuid/d9909ef7-c345-48f7-b210-ad7cbe72224b"; }]; # 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 diff --git a/modules/apps/collabora/default.nix b/modules/apps/collabora/default.nix index 4511412..abf989f 100644 --- a/modules/apps/collabora/default.nix +++ b/modules/apps/collabora/default.nix @@ -1,11 +1,8 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.collabora; +let cfg = config.nas-apps.collabora; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { @@ -16,9 +13,9 @@ in { # ... ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; }; }; }; diff --git a/modules/apps/collabora/options.nix b/modules/apps/collabora/options.nix index abcf2e5..46fe94e 100644 --- a/modules/apps/collabora/options.nix +++ b/modules/apps/collabora/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.collabora = { enable = mkEnableOption "collabora docker service"; - + autoStart = mkOption { type = types.bool; default = true; diff --git a/modules/apps/jellyfin/default.nix b/modules/apps/jellyfin/default.nix index 6d08dbc..583d642 100644 --- a/modules/apps/jellyfin/default.nix +++ b/modules/apps/jellyfin/default.nix @@ -1,14 +1,11 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.jellyfin; +let cfg = config.nas-apps.jellyfin; in { - imports = [ - ./options.nix - ]; - + imports = [ ./options.nix ]; + config = mkIf cfg.enable { - + systemd.services.jellyfin-nvidia-docker = { path = [ pkgs.bash pkgs.docker ]; script = '' @@ -74,4 +71,4 @@ in { # # PGID = "1000"; # # }; # # }; -# } \ No newline at end of file +# } diff --git a/modules/apps/jellyfin/options.nix b/modules/apps/jellyfin/options.nix index 74ced54..b3dffa9 100644 --- a/modules/apps/jellyfin/options.nix +++ b/modules/apps/jellyfin/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.jellyfin = { enable = mkEnableOption "jellyfin docker service"; - + autoStart = mkOption { type = types.bool; default = true; @@ -55,4 +54,4 @@ with lib; }; }; -} \ No newline at end of file +} diff --git a/modules/apps/jellyseerr/default.nix b/modules/apps/jellyseerr/default.nix index d41a704..0198785 100644 --- a/modules/apps/jellyseerr/default.nix +++ b/modules/apps/jellyseerr/default.nix @@ -1,24 +1,19 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.jellyseerr; +let cfg = config.nas-apps.jellyseerr; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { autoStart = cfg.autoStart; image = cfg.image; ports = [ "${cfg.port}:5055" ]; - volumes = [ - "${cfg.configPath}:/config" - ]; + volumes = [ "${cfg.configPath}:/config" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; }; }; }; diff --git a/modules/apps/jellyseerr/options.nix b/modules/apps/jellyseerr/options.nix index 879fc89..6115e9a 100644 --- a/modules/apps/jellyseerr/options.nix +++ b/modules/apps/jellyseerr/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.jellyseerr = { enable = mkEnableOption "jellyseerr docker service"; - + autoStart = mkOption { type = types.bool; default = true; @@ -45,4 +44,4 @@ with lib; }; }; -} \ No newline at end of file +} diff --git a/modules/apps/mariadb/default.nix b/modules/apps/mariadb/default.nix index de7d519..0e4be10 100644 --- a/modules/apps/mariadb/default.nix +++ b/modules/apps/mariadb/default.nix @@ -1,28 +1,23 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.mariadb; +let cfg = config.nas-apps.mariadb; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { autoStart = cfg.autoStart; image = cfg.image; ports = [ "${cfg.port}:3306" ]; - volumes = [ - "${cfg.configPath}:/config" - ]; + volumes = [ "${cfg.configPath}:/config" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; - MYSQL_ROOT_PASSWORD = cfg.rootPassword; - MYSQL_DATABASE = cfg.databaseName; - MYSQL_USER = cfg.databaseUser; - MYSQL_PASSWORD = cfg.databasePassword; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; + MYSQL_ROOT_PASSWORD = cfg.rootPassword; + MYSQL_DATABASE = cfg.databaseName; + MYSQL_USER = cfg.databaseUser; + MYSQL_PASSWORD = cfg.databasePassword; }; }; }; diff --git a/modules/apps/mariadb/options.nix b/modules/apps/mariadb/options.nix index cd1b808..cbaf1e0 100644 --- a/modules/apps/mariadb/options.nix +++ b/modules/apps/mariadb/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.mariadb = { enable = mkEnableOption "mariadb docker service"; - + autoStart = mkOption { type = types.bool; default = true; diff --git a/modules/apps/nextcloud/default.nix b/modules/apps/nextcloud/default.nix index ae02580..7300b30 100644 --- a/modules/apps/nextcloud/default.nix +++ b/modules/apps/nextcloud/default.nix @@ -1,25 +1,19 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.nextcloud; +let cfg = config.nas-apps.nextcloud; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { autoStart = cfg.autoStart; image = cfg.image; ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ]; - volumes = [ - "${cfg.configPath}:/config" - "${cfg.dataPath}:/data" - ]; + volumes = [ "${cfg.configPath}:/config" "${cfg.dataPath}:/data" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; }; }; }; diff --git a/modules/apps/nextcloud/options.nix b/modules/apps/nextcloud/options.nix index 902e188..4dad213 100644 --- a/modules/apps/nextcloud/options.nix +++ b/modules/apps/nextcloud/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.nextcloud = { enable = mkEnableOption "nextcloud docker service"; - + autoStart = mkOption { type = types.bool; default = true; @@ -54,4 +53,4 @@ with lib; default = "America/Chicago"; }; }; -} \ No newline at end of file +} diff --git a/modules/apps/radarr/default.nix b/modules/apps/radarr/default.nix index 186bb27..b893091 100644 --- a/modules/apps/radarr/default.nix +++ b/modules/apps/radarr/default.nix @@ -1,11 +1,8 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.radarr; +let cfg = config.nas-apps.radarr; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { @@ -13,14 +10,14 @@ in { image = cfg.image; ports = [ "${cfg.port}:7878" ]; volumes = [ - "${cfg.configPath}:/config" - "${cfg.moviesPath}:/movies" - "${cfg.downloadsPath}:/downloads" + "${cfg.configPath}:/config" + "${cfg.moviesPath}:/movies" + "${cfg.downloadsPath}:/downloads" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; }; }; }; diff --git a/modules/apps/radarr/options.nix b/modules/apps/radarr/options.nix index 1dbf029..857a9f0 100644 --- a/modules/apps/radarr/options.nix +++ b/modules/apps/radarr/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.radarr = { enable = mkEnableOption "radarr docker service"; - + autoStart = mkOption { type = types.bool; default = true; diff --git a/modules/apps/sabnzbd/default.nix b/modules/apps/sabnzbd/default.nix index 82de91d..652c8a9 100644 --- a/modules/apps/sabnzbd/default.nix +++ b/modules/apps/sabnzbd/default.nix @@ -1,11 +1,8 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.sabnzbd; +let cfg = config.nas-apps.sabnzbd; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { @@ -13,16 +10,16 @@ in { image = cfg.image; ports = [ "${cfg.port}:8080" ]; volumes = [ - "${cfg.configPath}:/config" - "${cfg.moviesPath}:/movies" - "${cfg.tvPath}:/tv" - "${cfg.downloadsPath}:/downloads" - "${cfg.downloadsIncompletePath}:/downloads-incomplete" + "${cfg.configPath}:/config" + "${cfg.moviesPath}:/movies" + "${cfg.tvPath}:/tv" + "${cfg.downloadsPath}:/downloads" + "${cfg.downloadsIncompletePath}:/downloads-incomplete" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; }; }; }; diff --git a/modules/apps/sabnzbd/options.nix b/modules/apps/sabnzbd/options.nix index 6e93cd6..bb264c4 100644 --- a/modules/apps/sabnzbd/options.nix +++ b/modules/apps/sabnzbd/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-apps.sabnzbd = { enable = mkEnableOption "sabnzbd docker service"; - + autoStart = mkOption { type = types.bool; default = true; diff --git a/modules/apps/sonarr/default.nix b/modules/apps/sonarr/default.nix index 85a3c77..e40f70e 100644 --- a/modules/apps/sonarr/default.nix +++ b/modules/apps/sonarr/default.nix @@ -1,11 +1,8 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.sonarr; +let cfg = config.nas-apps.sonarr; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { virtualisation.oci-containers.containers."${cfg.name}" = { @@ -13,14 +10,14 @@ in { image = cfg.image; ports = [ "${cfg.port}:8989" ]; volumes = [ - "${cfg.configPath}:/config" - "${cfg.tvPath}:/tv" - "${cfg.downloadsPath}:/downloads" + "${cfg.configPath}:/config" + "${cfg.tvPath}:/tv" + "${cfg.downloadsPath}:/downloads" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; }; }; }; diff --git a/modules/apps/sonarr/options.nix b/modules/apps/sonarr/options.nix index 8ee984c..8ea515d 100644 --- a/modules/apps/sonarr/options.nix +++ b/modules/apps/sonarr/options.nix @@ -1,9 +1,8 @@ -{lib, ... }: -with lib; -{ +{ lib, ... }: +with lib; { options.nas-apps.sonarr = { enable = mkEnableOption "sonarr docker service"; - + autoStart = mkOption { type = types.bool; default = true; diff --git a/modules/apps/swag/default.nix b/modules/apps/swag/default.nix index c6fc1b0..c17a495 100644 --- a/modules/apps/swag/default.nix +++ b/modules/apps/swag/default.nix @@ -1,14 +1,11 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-apps.swag; +let cfg = config.nas-apps.swag; in { - imports = [ - ./options.nix - ]; - + imports = [ ./options.nix ]; + config = mkIf cfg.enable { - + networking.firewall = { allowedTCPPorts = [ cfg.httpPort cfg.httpsPort ]; allowedUDPPorts = [ cfg.httpPort cfg.httpsPort ]; @@ -18,17 +15,15 @@ in { autoStart = cfg.autoStart; image = cfg.image; ports = [ "${toString cfg.httpPort}:80" "${toString cfg.httpsPort}:443" ]; - volumes = [ - "${cfg.configPath}:/config" - ]; + volumes = [ "${cfg.configPath}:/config" ]; environment = { - PUID = cfg.puid; - PGID = cfg.pgid; - TZ = cfg.timeZone; - EMAIL = cfg.email; - URL = cfg.url; - VALIDATION = cfg.validation; - SUBDOMAINS = cfg.subdomains; + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; + EMAIL = cfg.email; + URL = cfg.url; + VALIDATION = cfg.validation; + SUBDOMAINS = cfg.subdomains; }; }; }; diff --git a/modules/apps/swag/options.nix b/modules/apps/swag/options.nix index 16edc52..14ad315 100644 --- a/modules/apps/swag/options.nix +++ b/modules/apps/swag/options.nix @@ -1,6 +1,5 @@ -{lib, ... }: -with lib; -{ +{ lib, ... }: +with lib; { options.nas-apps.swag = { enable = mkEnableOption "swag docker service"; @@ -13,7 +12,7 @@ with lib; type = types.int; default = 80; }; - + httpsPort = mkOption { type = types.int; default = 443; diff --git a/modules/default.nix b/modules/default.nix index b6c2186..4811dc5 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { imports = [ ./samba ./apps/collabora @@ -13,4 +12,4 @@ ./apps/sonarr ./apps/swag ]; -} \ No newline at end of file +} diff --git a/modules/samba/default.nix b/modules/samba/default.nix index 961a8e7..b4a6460 100644 --- a/modules/samba/default.nix +++ b/modules/samba/default.nix @@ -1,11 +1,8 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.nas-samba; +let cfg = config.nas-samba; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { # make shares visible for Windows clients @@ -24,7 +21,7 @@ in { }; }; }; - + services.samba = { enable = true; securityType = "user"; @@ -42,26 +39,26 @@ in { guest account = nobody map to guest = bad user ''; - shares = - let - make = name: share: nameValuePair "${name}" - { - path = share.sharePath; - public = if share.enableTimeMachine then false else share.public; - private = if !share.public || share.enableTimeMachine then "yes" else "no"; - browseable = if share.browseable then "yes" else "no"; - writable = "yes"; - "read only" = if share.readOnly then "yes" else "no"; - "guest ok" = if share.guestOk then "yes" else "no"; - "create mask" = share.createMask; - "directory mask" = share.directoryMask; - "fruit:aapl" = if share.enableTimeMachine then "yes" else "no"; - "fruit:time machine" = if share.enableTimeMachine then "yes" else "no"; - "vfs objects" = "catia fruit streams_xattr"; - "fruit:time machine max size" = share.timeMachineMaxSize; - }; - in - mapAttrs' make cfg.shares; + shares = let + make = name: share: + nameValuePair "${name}" { + path = share.sharePath; + public = if share.enableTimeMachine then false else share.public; + private = + if !share.public || share.enableTimeMachine then "yes" else "no"; + browseable = if share.browseable then "yes" else "no"; + writable = "yes"; + "read only" = if share.readOnly then "yes" else "no"; + "guest ok" = if share.guestOk then "yes" else "no"; + "create mask" = share.createMask; + "directory mask" = share.directoryMask; + "fruit:aapl" = if share.enableTimeMachine then "yes" else "no"; + "fruit:time machine" = + if share.enableTimeMachine then "yes" else "no"; + "vfs objects" = "catia fruit streams_xattr"; + "fruit:time machine max size" = share.timeMachineMaxSize; + }; + in mapAttrs' make cfg.shares; }; }; } diff --git a/modules/samba/options.nix b/modules/samba/options.nix index c3cd04f..a9faea2 100644 --- a/modules/samba/options.nix +++ b/modules/samba/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.nas-samba = { enable = mkEnableOption "nas samba service"; - + autoStart = mkOption { type = types.bool; default = true; @@ -22,48 +21,46 @@ with lib; }; shares = mkOption { - type = types.attrsOf (types.submodule - { - options = { - public = mkOption { - type = types.bool; - default = false; - }; - sharePath = mkOption { - type = types.str; - default = ""; - }; - readOnly = mkOption { - type = types.bool; - default = false; - }; - browseable = mkOption { - type = types.bool; - default = true; - }; - guestOk = mkOption { - type = types.bool; - default = true; - }; - createMask = mkOption { - type = types.str; - default = "0644"; - }; - directoryMask = mkOption { - type = types.str; - default = "0755"; - }; - enableTimeMachine = mkOption { - type = types.bool; - default = false; - }; - timeMachineMaxSize = mkOption { - type = types.str; - default = "0K"; - }; + type = types.attrsOf (types.submodule { + options = { + public = mkOption { + type = types.bool; + default = false; }; - } - ); + sharePath = mkOption { + type = types.str; + default = ""; + }; + readOnly = mkOption { + type = types.bool; + default = false; + }; + browseable = mkOption { + type = types.bool; + default = true; + }; + guestOk = mkOption { + type = types.bool; + default = true; + }; + createMask = mkOption { + type = types.str; + default = "0644"; + }; + directoryMask = mkOption { + type = types.str; + default = "0755"; + }; + enableTimeMachine = mkOption { + type = types.bool; + default = false; + }; + timeMachineMaxSize = mkOption { + type = types.str; + default = "0K"; + }; + }; + }); default = { }; }; }; diff --git a/share/amd/default.nix b/share/amd/default.nix index fac8da6..5558322 100644 --- a/share/amd/default.nix +++ b/share/amd/default.nix @@ -1,14 +1,13 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.share.hardware.amd; +let cfg = config.share.hardware.amd; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { - boot.kernelParams = [ (if cfg.corectrl.enable then "amdgpu.ppfeaturemask=0xffffffff" else "") ]; + boot.kernelParams = [ + (if cfg.corectrl.enable then "amdgpu.ppfeaturemask=0xffffffff" else "") + ]; # Configure programs programs.corectrl.enable = cfg.corectrl.enable; @@ -42,7 +41,7 @@ in { return polkit.Result.YES; } }); - ''; + ''; }; }; } diff --git a/share/amd/options.nix b/share/amd/options.nix index b0f4d3b..efd7a40 100644 --- a/share/amd/options.nix +++ b/share/amd/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.share.hardware.amd = { enable = mkEnableOption "amd hardware config"; - + corectrl.enable = mkOption { type = types.bool; default = false; diff --git a/share/default.nix b/share/default.nix index 0a7b41a..c513fce 100644 --- a/share/default.nix +++ b/share/default.nix @@ -1,7 +1 @@ -{ ... }: -{ - imports = [ - ./amd - ./nvidia - ]; -} \ No newline at end of file +{ ... }: { imports = [ ./amd ./nvidia ]; } diff --git a/share/impermanence/default.nix b/share/impermanence/default.nix index 5712bc5..d4f3aaa 100644 --- a/share/impermanence/default.nix +++ b/share/impermanence/default.nix @@ -1,5 +1,4 @@ -{ pkgs, lib, LT, config, utils, inputs, ... }@args: -{ +{ pkgs, lib, LT, config, utils, inputs, ... }@args: { # Set up impernance configuration for things like bluetooth # In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints. @@ -11,10 +10,16 @@ "/var/lib/systemd/coredump" "/etc/NetworkManager/system-connections" "/etc/secureboot" - { directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; } - ]; - files = [ - { file = "/etc/nix/id_rsa"; parentDirectory = { mode = "u=rwx,g=,o="; }; } + { + directory = "/var/lib/colord"; + user = "colord"; + group = "colord"; + mode = "u=rwx,g=rx,o="; + } ]; + files = [{ + file = "/etc/nix/id_rsa"; + parentDirectory = { mode = "u=rwx,g=,o="; }; + }]; }; -} \ No newline at end of file +} diff --git a/share/nvidia/default.nix b/share/nvidia/default.nix index 7ebb6f0..b761c78 100644 --- a/share/nvidia/default.nix +++ b/share/nvidia/default.nix @@ -1,18 +1,18 @@ { lib, pkgs, config, ... }: with lib; -let - cfg = config.share.hardware.nvidia; +let cfg = config.share.hardware.nvidia; in { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; config = mkIf cfg.enable { hardware = { # Nvidia nvidia = { - package = if cfg.enableBeta then config.boot.kernelPackages.nvidiaPackages.beta else config.boot.kernelPackages.nvidiaPackages.latest; - + package = if cfg.enableBeta then + config.boot.kernelPackages.nvidiaPackages.beta + else + config.boot.kernelPackages.nvidiaPackages.latest; + # Modesetting is required. modesetting.enable = true; @@ -36,7 +36,7 @@ in { # accessible via `nvidia-settings`. nvidiaSettings = cfg.nvidiaSettings; }; - + # Enable OpenGL opengl = { enable = true; @@ -45,14 +45,12 @@ in { }; }; - # Services configs services.xserver = { # Load nvidia driver for Xorg and Wayland - videoDrivers = ["nvidia"]; + videoDrivers = [ "nvidia" ]; }; - # Virtualisation virtualisation.docker.enableNvidia = cfg.enableNvidiaDocker; }; diff --git a/share/nvidia/options.nix b/share/nvidia/options.nix index 5c73d96..5b1befd 100644 --- a/share/nvidia/options.nix +++ b/share/nvidia/options.nix @@ -1,9 +1,8 @@ { lib, ... }: -with lib; -{ +with lib; { options.share.hardware.nvidia = { enable = mkEnableOption "nvidia hardware config"; - + enableOpen = mkOption { type = types.bool; default = false;