From 51575e020e901273a2ce09045b3fa331b787548e Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 4 Jul 2023 16:32:09 +0200 Subject: [PATCH] stuff --- README.md | 1 + flake.nix | 2 ++ hardware/gpu/cuda.nix | 4 ++++ profiles/desktop/gnome/default.nix | 1 - profiles/no-suspend.nix | 2 ++ profiles/remote-builders/default.nix | 14 ++++++++++++++ profiles/web/default.nix | 12 ++++++++++++ users/pbsds/home/profiles/desktop.nix | 3 +++ 8 files changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f6e77d8..b6a7119 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ # TODOs: +* [ ] http health monitoring `services.netdata.httpcheck.checks.` * [x] Split stuff into multiple files * [x] Make a flake * [x] merge hosted docs into a single subdomain diff --git a/flake.nix b/flake.nix index 21f010e..3730b5d 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,8 @@ #https://github.com/numtide/system-manager #nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions" #https://github.com/numtide/nixpkgs-unfree # has a cache + #https://github.com/matthewbauer/nixiosk + #inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; # used to host old docs #nixpkgs-22.url = "github:NixOS/nixpkgs/nixos-22.11"; diff --git a/hardware/gpu/cuda.nix b/hardware/gpu/cuda.nix index 188f538..94af955 100644 --- a/hardware/gpu/cuda.nix +++ b/hardware/gpu/cuda.nix @@ -5,8 +5,10 @@ # https://nixos.wiki/wiki/Nvidia + #https://nixpk.gs/pr-tracker.html?pr=235481 #nixpkgs.config.cudaSupport = true; # TODO: TOO SLOW, BREAKS #nixpkgs.config.nvidiaSupport = true; # TODO: slow? used only by zenith + nixpkgs.config.allowUnfreePredicate = pkg: lib.any (x: x) [ (lib.hasInfix "nvidia" (lib.toLower (lib.getName pkg))) (lib.hasInfix "cuda" (lib.toLower (lib.getName pkg))) @@ -27,6 +29,8 @@ #hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest; # only do this per-host hardware.nvidia.powerManagement.enable = true; # Fix graphical corruption on suspend/resume + + # add this to the host in question: #hardware.nvidia.prime = { # offload.enable = true; diff --git a/profiles/desktop/gnome/default.nix b/profiles/desktop/gnome/default.nix index 049c4d1..37a0b13 100644 --- a/profiles/desktop/gnome/default.nix +++ b/profiles/desktop/gnome/default.nix @@ -4,7 +4,6 @@ services.xserver.displayManager.gdm.enable = true; services.xserver.displayManager.gdm.wayland = true; services.xserver.desktopManager.gnome.enable = true; - services.xserver.displayManager.gdm.autoSuspend = !config.services.openssh.enable; #services.printing.enable = true; # CUPS programs.xwayland.enable = true; xdg.portal.enable = true; diff --git a/profiles/no-suspend.nix b/profiles/no-suspend.nix index 2ae65c5..dbed9cf 100644 --- a/profiles/no-suspend.nix +++ b/profiles/no-suspend.nix @@ -3,4 +3,6 @@ systemd.targets.suspend.enable = false; systemd.targets.hibernate.enable = false; systemd.targets.hybrid-sleep.enable = false; + + services.xserver.displayManager.gdm.autoSuspend = true; } diff --git a/profiles/remote-builders/default.nix b/profiles/remote-builders/default.nix index b65da63..b05c251 100644 --- a/profiles/remote-builders/default.nix +++ b/profiles/remote-builders/default.nix @@ -131,6 +131,11 @@ let programs.ssh.knownHosts.${proxy.host or "IGNORE"} = lib.mkIf (proxy != null) { publicKey = proxy.publicKey; }; }; + remoteMap = lib.listToAttrs (lib.forEach remotes (remote: { + name = remote.hostName; + value = remote; + })); + in { nix.distributedBuilds = true; @@ -141,6 +146,15 @@ in { # useful when the builder has a faster internet connection than i do nix.settings.builders-use-substitutes = true; + /** / + nix.buildMachines = let cfg = remoteMap.${config.networking.fqdn}; in [{ + hostName = "localhost"; # https://github.com/NixOS/nix/pull/4938 + systems = [ config.nixpkgs.system "builtin" ] ++ config.boot.binfmt.emulatedSystems; + supportedFeatures = ["builtin" "local" "kvm" "nixos-test" "big-parallel" "benchmark"]; + inherit (cfg) maxJobs speedFactor; + }]; + /**/ + # TIL: this can be a list of configurations and lambdas, not just file paths imports = builtins.map mkRemoteConfig remotes; diff --git a/profiles/web/default.nix b/profiles/web/default.nix index 9c237a6..5b1ca99 100644 --- a/profiles/web/default.nix +++ b/profiles/web/default.nix @@ -8,6 +8,7 @@ in #(lib.mapAttrsToList (domain: vhost: [ domain ] ++ vhost.serverAliases)) (lib.mapAttrsToList (domain: vhost: [ domain ])) lib.flatten + #(builtins.filter (domain: domain != "")) (lib.sort (x: y: x + no + ''; + }; + /**/ # Website tunnel # TODO: remove diff --git a/users/pbsds/home/profiles/desktop.nix b/users/pbsds/home/profiles/desktop.nix index 023b334..eb5ebd5 100644 --- a/users/pbsds/home/profiles/desktop.nix +++ b/users/pbsds/home/profiles/desktop.nix @@ -11,6 +11,9 @@ home.packages = with pkgs; [ atom # TODO: config pulsar # TODO: config, transition into this + # TODO: nodePackages.bash-language-server + # TODO: python-lsp-server, somehow + discord element-desktop#-wayland slack