formatting

This commit is contained in:
mjallen18
2024-02-28 21:49:51 -06:00
parent bdfd5e92b7
commit 347d30094b
40 changed files with 459 additions and 503 deletions

View File

@@ -1,4 +1,3 @@
# WARN: this file will get overwritten by $ cachix use <name> # WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }: { pkgs, lib, ... }:
@@ -6,8 +5,9 @@ let
folder = ../cachix; folder = ../cachix;
toImport = name: value: folder + ("/" + name); toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; 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 { in {
inherit imports; inherit imports;
nix.settings.substituters = ["https://cache.nixos.org/"]; nix.settings.substituters = [ "https://cache.nixos.org/" ];
} }

View File

@@ -1,10 +1,7 @@
{ {
nix = { nix = {
settings = { settings = {
substituters = [ substituters = [ "https://nix-community.cachix.org" ];
"https://nix-community.cachix.org"
];
trusted-public-keys = [ trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];

View File

@@ -21,35 +21,36 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
}; };
outputs = { self, nixpkgs, lanzaboote, impermanence, nix-flatpak, home-manager, nixos-hardware } @ inputs: { outputs = { self, nixpkgs, lanzaboote, impermanence, nix-flatpak, home-manager
nixosConfigurations = { , nixos-hardware }@inputs: {
# Desktop nixosConfigurations = {
"matt-nixos" = nixpkgs.lib.nixosSystem { # Desktop
system = "x86_64-linux"; "matt-nixos" = nixpkgs.lib.nixosSystem {
modules = [ system = "x86_64-linux";
impermanence.nixosModules.impermanence modules = [
lanzaboote.nixosModules.lanzaboote impermanence.nixosModules.impermanence
# kde.nixosModules.plasma6 lanzaboote.nixosModules.lanzaboote
nix-flatpak.nixosModules.nix-flatpak # kde.nixosModules.plasma6
./hosts/desktop/configuration.nix nix-flatpak.nixosModules.nix-flatpak
./share/impermanence ./hosts/desktop/configuration.nix
home-manager.nixosModules.home-manager ./share/impermanence
{ home-manager.nixosModules.home-manager
home-manager.useGlobalPkgs = true; {
home-manager.useUserPackages = true; home-manager.useGlobalPkgs = true;
home-manager.users.matt = import ./hosts/desktop/home.nix; home-manager.useUserPackages = true;
} home-manager.users.matt = import ./hosts/desktop/home.nix;
]; }
}; ];
};
# Pi4 # Pi4
"nixos-pi4" = nixpkgs.lib.nixosSystem { "nixos-pi4" = nixpkgs.lib.nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ modules = [
nixos-hardware.nixosModules.raspberry-pi-4 nixos-hardware.nixosModules.raspberry-pi-4
./hosts/pi4/configuration.nix ./hosts/pi4/configuration.nix
]; ];
};
}; };
}; };
};
} }

View File

@@ -1,13 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let timezone = "America/Chicago";
timezone = "America/Chicago"; in {
in imports = [ ../modules ../share ];
{
imports =
[
../modules
../share
];
# Enable nix flakes and nix-command tools # Enable nix flakes and nix-command tools
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
@@ -56,8 +50,8 @@ in
interpreter = "${pkgs.appimage-run}/bin/appimage-run"; interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic"; recognitionType = "magic";
offset = 0; offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff";
magicOrExtension = ''\x7fELF....AI\x02''; magicOrExtension = "\\x7fELF....AI\\x02";
}; };
}; };
} }

View File

@@ -5,26 +5,24 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
user = "matt"; user = "matt";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "matt-nixos"; hostname = "matt-nixos";
# discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages. # discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages.
discover-wrapped = pkgs.symlinkJoin discover-wrapped = pkgs.symlinkJoin {
{ name = "discover-flatpak-backend";
name = "discover-flatpak-backend"; paths = [ pkgs.libsForQt5.discover ];
paths = [ pkgs.libsForQt5.discover ]; buildInputs = [ pkgs.makeWrapper ];
buildInputs = [ pkgs.makeWrapper ]; postBuild = ''
postBuild = '' wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak"
wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak" '';
''; };
}; in {
in imports = [ # Include the results of the hardware scan.
{ ./hardware-configuration.nix
imports = # ../../cachix/cachix.nix
[ # Include the results of the hardware scan. ../default.nix
./hardware-configuration.nix ];
# ../../cachix/cachix.nix
../default.nix
];
share.hardware.amd = { share.hardware.amd = {
enable = true; enable = true;
@@ -59,9 +57,7 @@ in
# Override kernel to latest # Override kernel to latest
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [ kernelParams = [ "quiet" ];
"quiet"
];
consoleLogLevel = 3; consoleLogLevel = 3;
bootspec.enable = true; bootspec.enable = true;
@@ -147,9 +143,7 @@ in
}; };
# Time config # Time config
time = { time = { hardwareClockInLocalTime = true; };
hardwareClockInLocalTime = true;
};
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ]; # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
@@ -218,8 +212,10 @@ in
# Steam # Steam
steam = { steam = {
enable = true; enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play remotePlay.openFirewall =
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server 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: { packageOverrides = pkgs: {
steam = pkgs.steam.override { steam = pkgs.steam.override {
extraPkgs = pkgs: with pkgs; [ extraPkgs = pkgs:
xorg.libXcursor with pkgs; [
xorg.libXi xorg.libXcursor
xorg.libXinerama xorg.libXi
xorg.libXScrnSaver xorg.libXinerama
libpng xorg.libXScrnSaver
libpulseaudio libpng
libvorbis libpulseaudio
stdenv.cc.cc.lib libvorbis
libkrb5 stdenv.cc.cc.lib
keyutils libkrb5
]; keyutils
];
}; };
}; };
}; };

View File

@@ -4,67 +4,65 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[ (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.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ]; options = [ "subvol=nix" "compress=zstd" "noatime" ];
}; };
fileSystems."/etc" = fileSystems."/etc" = {
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=etc" "compress=zstd" "noatime" ]; options = [ "subvol=etc" "compress=zstd" "noatime" ];
}; };
fileSystems."/root" = fileSystems."/root" = {
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ]; options = [ "subvol=root" "compress=zstd" "noatime" ];
}; };
fileSystems."/var/log" = fileSystems."/var/log" = {
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=log" "compress=zstd" "noatime" ]; options = [ "subvol=log" "compress=zstd" "noatime" ];
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d"; device = "/dev/disk/by-uuid/c6cf43cb-d0d2-4111-bc81-994e41b2632d";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" "compress=zstd" ]; options = [ "subvol=home" "compress=zstd" ];
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/1058-F967"; device = "/dev/disk/by-uuid/1058-F967";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = 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" = fileSystems."/home/matt/Games" = {
{ device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3"; device = "/dev/disk/by-uuid/1adb3161-ef9e-45d9-be5f-dd718186f1b3";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/home/matt/1TB" = fileSystems."/home/matt/1TB" = {
{ device = "/dev/disk/by-uuid/7f9c2d1e-64ee-d901-2084-2d1e64eed901"; device = "/dev/disk/by-uuid/7f9c2d1e-64ee-d901-2084-2d1e64eed901";
fsType = "ext4"; fsType = "ext4";
}; };
# 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
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
@@ -75,5 +73,6 @@
# networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 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;
} }

View File

@@ -1,8 +1,14 @@
{ pkgs, ... }: { pkgs, ... }:
let 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; }; vulkan-hdr-layer = import ./vulkan-hdr-layer.nix {
in 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.username = "matt";
home.homeDirectory = "/home/matt"; home.homeDirectory = "/home/matt";
@@ -30,7 +36,7 @@ in
programs.command-not-found.enable = true; programs.command-not-found.enable = true;
home.packages = with pkgs; [ home.packages = with pkgs; [
firefox firefox
tree tree
lm_sensors lm_sensors
@@ -46,6 +52,8 @@ in
python3 python3
virt-manager virt-manager
orca-slicer orca-slicer
nixfmt
deadnix
# Other packages # Other packages
vulkan-hdr-layer vulkan-hdr-layer
]; ];

View File

@@ -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 { stdenv.mkDerivation rec {
pname = "vulkan-hdr-layer"; pname = "vulkan-hdr-layer";
@@ -18,7 +20,15 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ vulkan-headers meson ninja pkg-config jq ]; 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 # Help vulkan-loader find the validation layers
setupHook = writeText "setup-hook" '' setupHook = writeText "setup-hook" ''

View File

@@ -5,15 +5,14 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
user = "admin"; user = "admin";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "jallen-nas"; hostname = "jallen-nas";
in in {
{ imports = [ # Include the results of the hardware scan.
imports = ./hardware-configuration.nix
[ # Include the results of the hardware scan. ../default.nix
./hardware-configuration.nix ];
../default.nix
];
nas-apps = { nas-apps = {
jellyfin.enable = true; jellyfin.enable = true;
@@ -82,7 +81,6 @@ in
dataDir = "/mnt/ssd/nix-app-data/grafana"; dataDir = "/mnt/ssd/nix-app-data/grafana";
}; };
services.prometheus = { services.prometheus = {
enable = true; enable = true;
port = 9001; port = 9001;
@@ -95,19 +93,33 @@ in
smartctl = { smartctl = {
enable = true; enable = true;
group = "disk"; 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 = [ scrapeConfigs = [{
{ job_name = hostname;
job_name = hostname; static_configs = [{
static_configs = [{ targets = [
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}"]; "127.0.0.1:${
}]; toString config.services.prometheus.exporters.smartctl.port
} }"
]; ];
}];
}];
}; };
share.hardware.nvidia = { share.hardware.nvidia = {
@@ -134,9 +146,7 @@ in
# Override kernel to latest # Override kernel to latest
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = [ kernelParams = [ "nohibernate" ];
"nohibernate"
];
consoleLogLevel = 3; consoleLogLevel = 3;
bootspec.enable = true; bootspec.enable = true;
@@ -279,7 +289,8 @@ in
firewall = { firewall = {
enable = true; enable = true;
allowPing = 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 ]; allowedTCPPorts = [ 2342 61208 ];
allowedUDPPorts = [ 2342 61208 ]; allowedUDPPorts = [ 2342 61208 ];
}; };
@@ -335,7 +346,15 @@ in
# Admin account # Admin account
users."${user}" = { users."${user}" = {
isNormalUser = true; 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; initialHashedPassword = password;
shell = pkgs.fish; shell = pkgs.fish;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [

View File

@@ -4,58 +4,56 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[ (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.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "none"; device = "none";
fsType = "tmpfs"; fsType = "tmpfs";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/C6E9-7371"; device = "/dev/disk/by-uuid/C6E9-7371";
fsType = "vfat"; fsType = "vfat";
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" "compress-force=zstd" "noatime" ]; options = [ "subvol=nix" "compress-force=zstd" "noatime" ];
}; };
fileSystems."/etc" = fileSystems."/etc" = {
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=etc" "compress-force=zstd" "noatime" ]; options = [ "subvol=etc" "compress-force=zstd" "noatime" ];
}; };
fileSystems."/root" = fileSystems."/root" = {
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" "compress-force=zstd" "noatime" ]; options = [ "subvol=root" "compress-force=zstd" "noatime" ];
}; };
fileSystems."/var/log" = fileSystems."/var/log" = {
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=log" "compress-force=zstd" "noatime" ]; options = [ "subvol=log" "compress-force=zstd" "noatime" ];
}; };
fileSystems."/home" = fileSystems."/home" = {
{ device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3"; device = "/dev/disk/by-uuid/85e2fa30-816f-4457-80a1-9f88b9ab77b3";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" "compress-force=zstd"]; options = [ "subvol=home" "compress-force=zstd" ];
}; };
swapDevices = 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 # 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 # (the default) this is the recommended approach. When using systemd-networkd it's
@@ -77,5 +75,6 @@
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 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;
} }

View File

@@ -6,18 +6,18 @@
let let
user = "matt"; user = "matt";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
SSID = "Joeys Jungle"; SSID = "Joeys Jungle";
SSIDpassword = "kR8v&3Qd"; SSIDpassword = "kR8v&3Qd";
interface = "wlan0"; interface = "wlan0";
timezone = "America/Chicago"; timezone = "America/Chicago";
hostname = "nixos-pi4"; hostname = "nixos-pi4";
in { in {
imports = imports = [ # Include the results of the hardware scan.
[ # Include the results of the hardware scan. ./hardware-configuration.nix
./hardware-configuration.nix ./docker-pi4.nix
./docker-pi4.nix ];
];
# Enable nix flakes and nix-command tools # Enable nix flakes and nix-command tools
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
@@ -43,12 +43,7 @@ in {
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ vim raspberrypi-eeprom htop git ];
vim
raspberrypi-eeprom
htop
git
];
services.openssh.enable = true; services.openssh.enable = true;

View File

@@ -25,9 +25,7 @@
"/media/T5/tv:/tv" "/media/T5/tv:/tv"
]; ];
ports = [ "8096:8096" ]; ports = [ "8096:8096" ];
environment = { environment = { JELLYFIN_LOG_DIR = "/log"; };
JELLYFIN_LOG_DIR = "/log";
};
}; };
} }

View File

@@ -4,33 +4,30 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" ]; boot.initrd.availableKernelModules = [ "xhci_pci" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/ec969af6-d557-408a-a149-ba23d31fd8a2"; device = "/dev/disk/by-uuid/ec969af6-d557-408a-a149-ba23d31fd8a2";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/media/T5" = fileSystems."/media/T5" = {
{ device = "/dev/disk/by-uuid/191ce486-899d-4718-81e3-5c9b3ea860e4"; device = "/dev/disk/by-uuid/191ce486-899d-4718-81e3-5c9b3ea860e4";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/FIRMWARE" = fileSystems."/FIRMWARE" = {
{ device = "/dev/disk/by-uuid/5A9F-FC90"; device = "/dev/disk/by-uuid/5A9F-FC90";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = 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 # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.collabora;
cfg = config.nas-apps.collabora;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -16,9 +13,9 @@ in {
# ... # ...
]; ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.collabora = { options.nas-apps.collabora = {
enable = mkEnableOption "collabora docker service"; enable = mkEnableOption "collabora docker service";

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.jellyfin;
cfg = config.nas-apps.jellyfin;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.jellyfin = { options.nas-apps.jellyfin = {
enable = mkEnableOption "jellyfin docker service"; enable = mkEnableOption "jellyfin docker service";

View File

@@ -1,24 +1,19 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.jellyseerr;
cfg = config.nas-apps.jellyseerr;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${cfg.port}:5055" ]; ports = [ "${cfg.port}:5055" ];
volumes = [ volumes = [ "${cfg.configPath}:/config" ];
"${cfg.configPath}:/config"
];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.jellyseerr = { options.nas-apps.jellyseerr = {
enable = mkEnableOption "jellyseerr docker service"; enable = mkEnableOption "jellyseerr docker service";

View File

@@ -1,28 +1,23 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.mariadb;
cfg = config.nas-apps.mariadb;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${cfg.port}:3306" ]; ports = [ "${cfg.port}:3306" ];
volumes = [ volumes = [ "${cfg.configPath}:/config" ];
"${cfg.configPath}:/config"
];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
MYSQL_ROOT_PASSWORD = cfg.rootPassword; MYSQL_ROOT_PASSWORD = cfg.rootPassword;
MYSQL_DATABASE = cfg.databaseName; MYSQL_DATABASE = cfg.databaseName;
MYSQL_USER = cfg.databaseUser; MYSQL_USER = cfg.databaseUser;
MYSQL_PASSWORD = cfg.databasePassword; MYSQL_PASSWORD = cfg.databasePassword;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.mariadb = { options.nas-apps.mariadb = {
enable = mkEnableOption "mariadb docker service"; enable = mkEnableOption "mariadb docker service";

View File

@@ -1,25 +1,19 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.nextcloud;
cfg = config.nas-apps.nextcloud;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ]; ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ];
volumes = [ volumes = [ "${cfg.configPath}:/config" "${cfg.dataPath}:/data" ];
"${cfg.configPath}:/config"
"${cfg.dataPath}:/data"
];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.nextcloud = { options.nas-apps.nextcloud = {
enable = mkEnableOption "nextcloud docker service"; enable = mkEnableOption "nextcloud docker service";

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.radarr;
cfg = config.nas-apps.radarr;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -13,14 +10,14 @@ in {
image = cfg.image; image = cfg.image;
ports = [ "${cfg.port}:7878" ]; ports = [ "${cfg.port}:7878" ];
volumes = [ volumes = [
"${cfg.configPath}:/config" "${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies" "${cfg.moviesPath}:/movies"
"${cfg.downloadsPath}:/downloads" "${cfg.downloadsPath}:/downloads"
]; ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.radarr = { options.nas-apps.radarr = {
enable = mkEnableOption "radarr docker service"; enable = mkEnableOption "radarr docker service";

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.sabnzbd;
cfg = config.nas-apps.sabnzbd;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -13,16 +10,16 @@ in {
image = cfg.image; image = cfg.image;
ports = [ "${cfg.port}:8080" ]; ports = [ "${cfg.port}:8080" ];
volumes = [ volumes = [
"${cfg.configPath}:/config" "${cfg.configPath}:/config"
"${cfg.moviesPath}:/movies" "${cfg.moviesPath}:/movies"
"${cfg.tvPath}:/tv" "${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads" "${cfg.downloadsPath}:/downloads"
"${cfg.downloadsIncompletePath}:/downloads-incomplete" "${cfg.downloadsIncompletePath}:/downloads-incomplete"
]; ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.sabnzbd = { options.nas-apps.sabnzbd = {
enable = mkEnableOption "sabnzbd docker service"; enable = mkEnableOption "sabnzbd docker service";

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.sonarr;
cfg = config.nas-apps.sonarr;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = { virtualisation.oci-containers.containers."${cfg.name}" = {
@@ -13,14 +10,14 @@ in {
image = cfg.image; image = cfg.image;
ports = [ "${cfg.port}:8989" ]; ports = [ "${cfg.port}:8989" ];
volumes = [ volumes = [
"${cfg.configPath}:/config" "${cfg.configPath}:/config"
"${cfg.tvPath}:/tv" "${cfg.tvPath}:/tv"
"${cfg.downloadsPath}:/downloads" "${cfg.downloadsPath}:/downloads"
]; ];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.sonarr = { options.nas-apps.sonarr = {
enable = mkEnableOption "sonarr docker service"; enable = mkEnableOption "sonarr docker service";

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-apps.swag;
cfg = config.nas-apps.swag;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
@@ -18,17 +15,15 @@ in {
autoStart = cfg.autoStart; autoStart = cfg.autoStart;
image = cfg.image; image = cfg.image;
ports = [ "${toString cfg.httpPort}:80" "${toString cfg.httpsPort}:443" ]; ports = [ "${toString cfg.httpPort}:80" "${toString cfg.httpsPort}:443" ];
volumes = [ volumes = [ "${cfg.configPath}:/config" ];
"${cfg.configPath}:/config"
];
environment = { environment = {
PUID = cfg.puid; PUID = cfg.puid;
PGID = cfg.pgid; PGID = cfg.pgid;
TZ = cfg.timeZone; TZ = cfg.timeZone;
EMAIL = cfg.email; EMAIL = cfg.email;
URL = cfg.url; URL = cfg.url;
VALIDATION = cfg.validation; VALIDATION = cfg.validation;
SUBDOMAINS = cfg.subdomains; SUBDOMAINS = cfg.subdomains;
}; };
}; };
}; };

View File

@@ -1,6 +1,5 @@
{lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-apps.swag = { options.nas-apps.swag = {
enable = mkEnableOption "swag docker service"; enable = mkEnableOption "swag docker service";

View File

@@ -1,5 +1,4 @@
{ ... }: { ... }: {
{
imports = [ imports = [
./samba ./samba
./apps/collabora ./apps/collabora

View File

@@ -1,11 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.nas-samba;
cfg = config.nas-samba;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
# make shares visible for Windows clients # make shares visible for Windows clients
@@ -42,26 +39,26 @@ in {
guest account = nobody guest account = nobody
map to guest = bad user map to guest = bad user
''; '';
shares = shares = let
let make = name: share:
make = name: share: nameValuePair "${name}" nameValuePair "${name}" {
{ path = share.sharePath;
path = share.sharePath; public = if share.enableTimeMachine then false else share.public;
public = if share.enableTimeMachine then false else share.public; private =
private = if !share.public || share.enableTimeMachine then "yes" else "no"; if !share.public || share.enableTimeMachine then "yes" else "no";
browseable = if share.browseable then "yes" else "no"; browseable = if share.browseable then "yes" else "no";
writable = "yes"; writable = "yes";
"read only" = if share.readOnly then "yes" else "no"; "read only" = if share.readOnly then "yes" else "no";
"guest ok" = if share.guestOk then "yes" else "no"; "guest ok" = if share.guestOk then "yes" else "no";
"create mask" = share.createMask; "create mask" = share.createMask;
"directory mask" = share.directoryMask; "directory mask" = share.directoryMask;
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no"; "fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no"; "fruit:time machine" =
"vfs objects" = "catia fruit streams_xattr"; if share.enableTimeMachine then "yes" else "no";
"fruit:time machine max size" = share.timeMachineMaxSize; "vfs objects" = "catia fruit streams_xattr";
}; "fruit:time machine max size" = share.timeMachineMaxSize;
in };
mapAttrs' make cfg.shares; in mapAttrs' make cfg.shares;
}; };
}; };
} }

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.nas-samba = { options.nas-samba = {
enable = mkEnableOption "nas samba service"; enable = mkEnableOption "nas samba service";
@@ -22,48 +21,46 @@ with lib;
}; };
shares = mkOption { shares = mkOption {
type = types.attrsOf (types.submodule type = types.attrsOf (types.submodule {
{ options = {
options = { public = mkOption {
public = mkOption { type = types.bool;
type = types.bool; default = false;
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";
};
}; };
} 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 = { }; default = { };
}; };
}; };

View File

@@ -1,14 +1,13 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.share.hardware.amd;
cfg = config.share.hardware.amd;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { 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 # Configure programs
programs.corectrl.enable = cfg.corectrl.enable; programs.corectrl.enable = cfg.corectrl.enable;
@@ -42,7 +41,7 @@ in {
return polkit.Result.YES; return polkit.Result.YES;
} }
}); });
''; '';
}; };
}; };
} }

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.share.hardware.amd = { options.share.hardware.amd = {
enable = mkEnableOption "amd hardware config"; enable = mkEnableOption "amd hardware config";

View File

@@ -1,7 +1 @@
{ ... }: { ... }: { imports = [ ./amd ./nvidia ]; }
{
imports = [
./amd
./nvidia
];
}

View File

@@ -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 # 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. # 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" "/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections" "/etc/NetworkManager/system-connections"
"/etc/secureboot" "/etc/secureboot"
{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; } {
]; directory = "/var/lib/colord";
files = [ user = "colord";
{ file = "/etc/nix/id_rsa"; parentDirectory = { mode = "u=rwx,g=,o="; }; } group = "colord";
mode = "u=rwx,g=rx,o=";
}
]; ];
files = [{
file = "/etc/nix/id_rsa";
parentDirectory = { mode = "u=rwx,g=,o="; };
}];
}; };
} }

View File

@@ -1,17 +1,17 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let cfg = config.share.hardware.nvidia;
cfg = config.share.hardware.nvidia;
in { in {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = mkIf cfg.enable { config = mkIf cfg.enable {
hardware = { hardware = {
# Nvidia # Nvidia
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 is required.
modesetting.enable = true; modesetting.enable = true;
@@ -45,14 +45,12 @@ in {
}; };
}; };
# Services configs # Services configs
services.xserver = { services.xserver = {
# Load nvidia driver for Xorg and Wayland # Load nvidia driver for Xorg and Wayland
videoDrivers = ["nvidia"]; videoDrivers = [ "nvidia" ];
}; };
# Virtualisation # Virtualisation
virtualisation.docker.enableNvidia = cfg.enableNvidiaDocker; virtualisation.docker.enableNvidia = cfg.enableNvidiaDocker;
}; };

View File

@@ -1,6 +1,5 @@
{ lib, ... }: { lib, ... }:
with lib; with lib; {
{
options.share.hardware.nvidia = { options.share.hardware.nvidia = {
enable = mkEnableOption "nvidia hardware config"; enable = mkEnableOption "nvidia hardware config";