From 0060e25fde4b4082a7e44f2c6800b98ccd0bbb2b Mon Sep 17 00:00:00 2001 From: Jimbo Date: Mon, 26 Aug 2024 19:43:59 -0400 Subject: [PATCH] Switch to unfree NVIDIA drivers and use Blender-bin to use CUDA --- flake.lock | 67 +++++++++++++++++------------ flake.nix | 14 +++--- home-manager/home.nix | 1 + home-manager/jimbo_desktop.nix | 2 +- home-manager/misc/production.nix | 2 +- home-manager/sway/rules.nix | 2 +- nixos/hardware/machines/desktop.nix | 8 +--- nixos/hardware/nvidia.nix | 19 +++----- 8 files changed, 57 insertions(+), 58 deletions(-) diff --git a/flake.lock b/flake.lock index 8166207..8666dc7 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,22 @@ { "nodes": { + "blender-bin": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1724347557, + "narHash": "sha256-0eqXNM4mulNroWyx5h1ICDJQfY79jwW9KqMFHRstjP0=", + "rev": "9062c70ff62d9718485733f5cd5b25cd87875772", + "revCount": 120, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/blender-bin/1.0.8/01917b20-9eba-7b35-90c8-a4db33d22a81/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/blender-bin/1.0.8.tar.gz" + } + }, "blobs": { "flake": false, "locked": { @@ -32,26 +49,6 @@ "type": "gitlab" } }, - "disko": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1724349583, - "narHash": "sha256-zgB1Cfk46irIsto8666yLdKjqKdBrjR48Dd3lhQ0CnQ=", - "owner": "nix-community", - "repo": "disko", - "rev": "435737144be0259559ca3b43f7d72252b1fdcc1b", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "disko", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -125,7 +122,7 @@ "inputs": { "blobs": "blobs", "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-24_05": "nixpkgs-24_05" }, "locked": { @@ -146,7 +143,7 @@ "inputs": { "blobs": "blobs_2", "flake-compat": "flake-compat_2", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-24_05": "nixpkgs-24_05_2", "utils": "utils" }, @@ -167,16 +164,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717602782, - "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", + "lastModified": 1722221733, "owner": "NixOS", "repo": "nixpkgs", - "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", + "rev": "12bf09802d77264e441f48e25459c10c93eada2e", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-unstable", + "ref": "nixos-24.05", "type": "indirect" } }, @@ -242,6 +238,21 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1717602782, + "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1724242322, "narHash": "sha256-HMpK7hNjhEk4z5SFg5UtxEio9OWFocHdaQzCfW1pE7w=", @@ -274,12 +285,12 @@ }, "root": { "inputs": { - "disko": "disko", + "blender-bin": "blender-bin", "hardware": "hardware", "home-manager": "home-manager", "mail": "mail", "nixos-mailserver": "nixos-mailserver", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur" } diff --git a/flake.nix b/flake.nix index 59c55ce..fca2cf9 100644 --- a/flake.nix +++ b/flake.nix @@ -8,13 +8,10 @@ nur.url = "github:nix-community/NUR"; mail.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05"; + blender-bin.url = "https://flakehub.com/f/edolstra/blender-bin/1.0.8.tar.gz"; # NixOS utils hardware.url = "github:nixos/nixos-hardware/master"; - disko = { - url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs"; - }; # Home manager home-manager = { @@ -24,16 +21,17 @@ }; outputs = { - self, - nixpkgs, - home-manager, + self, + nixpkgs, nur, + blender-bin, nixos-mailserver, + home-manager, ... } @inputs: let inherit (self) outputs; forAllSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" + "aarch64-linux" "x86_64-linux" ]; in rec { diff --git a/home-manager/home.nix b/home-manager/home.nix index a05935b..02747e4 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -21,6 +21,7 @@ outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages + inputs.blender-bin.overlays.default ]; # Configure your nixpkgs instance config = { diff --git a/home-manager/jimbo_desktop.nix b/home-manager/jimbo_desktop.nix index d2466df..126f757 100644 --- a/home-manager/jimbo_desktop.nix +++ b/home-manager/jimbo_desktop.nix @@ -18,7 +18,7 @@ ./guiapps/easyeffects.nix ./tuiapps/ncmpcpp.nix - # Misc Apps + # Misc apps and tools ./misc/useful.nix ./misc/avtools.nix ./misc/filemanager.nix diff --git a/home-manager/misc/production.nix b/home-manager/misc/production.nix index add7334..c5a8967 100644 --- a/home-manager/misc/production.nix +++ b/home-manager/misc/production.nix @@ -3,7 +3,7 @@ krita inkscape audacity - blender + blender_4_2 sunvox ]; } diff --git a/home-manager/sway/rules.nix b/home-manager/sway/rules.nix index 638dbd7..7aaa375 100644 --- a/home-manager/sway/rules.nix +++ b/home-manager/sway/rules.nix @@ -98,7 +98,7 @@ # Communication "${ws.w3a}" = [{class = "zoom";}]; "${ws.w7}" = [{app_id = "MiscBrowser";} {app_id = "vesktop";}]; - "${ws.w8}" = [{class = "Element";}]; + "${ws.w8}" = [{app_id = "Element";}]; "${ws.w9}" = [{app_id = "thunderbird";}]; # Else diff --git a/nixos/hardware/machines/desktop.nix b/nixos/hardware/machines/desktop.nix index 75c4545..667bdda 100644 --- a/nixos/hardware/machines/desktop.nix +++ b/nixos/hardware/machines/desktop.nix @@ -1,11 +1,5 @@ # This file was initially made by 'nixos-generate-config', try not to edit too much -{ - config, - lib, - pkgs, - modulesPath, - ... -}: let +{ config, lib, pkgs, modulesPath, ... }: let # Set common boot paramaters commonKernelParams = [ # Nvidia settings diff --git a/nixos/hardware/nvidia.nix b/nixos/hardware/nvidia.nix index 553cf10..90b016b 100644 --- a/nixos/hardware/nvidia.nix +++ b/nixos/hardware/nvidia.nix @@ -1,4 +1,4 @@ -{config, ... }: { +{pkgs, config, ... }: { # Enable video drivers services.xserver.videoDrivers = ["nvidia"]; @@ -6,17 +6,12 @@ modesetting.enable = true; nvidiaSettings = false; package = config.boot.kernelPackages.nvidiaPackages.beta; - open = true; + open = false; }; - pkgs.stdenv.mkDerivation { - name = "cuda-env-shell"; - buildInputs = with pkgs; [ - cudatoolkit - ]; - shellHook = '' - export CUDA_PATH=${pkgs.cudatoolkit} - export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib" - export EXTRA_CCFLAGS="-I/usr/include" - ''; + environment.sessionVariables = { + CUDA_PATH = "${pkgs.cudatoolkit}"; + EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"; + EXTRA_CCFLAGS = "-I/usr/include"; + }; }