aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDylan <boss@tehbox.org>2025-09-16 16:43:55 +1200
committerDylan <boss@tehbox.org>2025-09-16 16:43:55 +1200
commitd1395f9e6768551967f85128ccab19d12dec4c6f (patch)
tree804d86634796edd5e378cb05ee2fda0a71d02497 /modules
parentc1b48e9f2bfc4ae0e48d0c8e35ad1f4a2189ec30 (diff)
downloadnixos-configuration-d1395f9e6768551967f85128ccab19d12dec4c6f.tar.gz
nixos-configuration-d1395f9e6768551967f85128ccab19d12dec4c6f.zip
feat: added server configuration and setup sops-nix
Diffstat (limited to 'modules')
-rw-r--r--modules/nix.nix29
-rw-r--r--modules/nvidia.nix27
2 files changed, 56 insertions, 0 deletions
diff --git a/modules/nix.nix b/modules/nix.nix
new file mode 100644
index 0000000..2c4ef83
--- /dev/null
+++ b/modules/nix.nix
@@ -0,0 +1,29 @@
+{ inputs, ... }:
+{
+ nix.nixPath = [ "/etc/nix/path" ];
+ nix.registry.nixpkgs.flake = inputs.nixpkgs;
+ environment.etc."nix/path/nixpkgs".source = inputs.nixpkgs;
+
+ nix = {
+ settings = {
+ experimental-features = [ "nix-command" "flakes" ];
+ auto-optimise-store = true;
+
+ trusted-users = [ "boss" ];
+
+ substituters = [
+ "https://cache.nixos.org"
+ ];
+
+ # trusted-public-keys = [
+ # "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
+ # ];
+ };
+ gc = {
+ automatic = true;
+ dates = "weekly";
+ options = "--delete-older-than +7";
+ };
+ optimise.automatic = true;
+ };
+}
diff --git a/modules/nvidia.nix b/modules/nvidia.nix
new file mode 100644
index 0000000..ba71df9
--- /dev/null
+++ b/modules/nvidia.nix
@@ -0,0 +1,27 @@
+{ config, pkgs, inputs, ... }:
+let
+ nvidia-offload = pkgs.writeShellScriptBin "prime-run" ''
+export __NV_PRIME_RENDER_OFFLOAD=1
+export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
+export __GLX_VENDOR_LIBRARY_NAME=nvidia
+export __VK_LAYER_NV_optimus=NVIDIA_only
+exec "$@"
+'';
+in
+{
+ nixpkgs.config.allowUnfree = true;
+ hardware.graphics.enable = true;
+ hardware.nvidia.modesetting.enable = true;
+ hardware.nvidia.open = true;
+ hardware.nvidia.prime = {
+ offload.enable = true;
+
+ nvidiaBusId = "PCI:1:0:0";
+ intelBusId = "PCI:5:0:0";
+ };
+ hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
+
+ services.xserver.videoDrivers = [ "nvidia" ];
+
+ environment.systemPackages = [ nvidia-offload ];
+}