From c83005983e5f0e842cf90eccaddebdd1671d3f71 Mon Sep 17 00:00:00 2001
From: Felix Albrigtsen <felix@albrigtsen.it>
Date: Sat, 15 Mar 2025 23:37:53 +0100
Subject: [PATCH] shells/cuda: Reformat, replace shellhook with env attr

---
 shells/cuda.nix | 58 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 39 insertions(+), 19 deletions(-)

diff --git a/shells/cuda.nix b/shells/cuda.nix
index b0af009..ae99b63 100644
--- a/shells/cuda.nix
+++ b/shells/cuda.nix
@@ -1,25 +1,45 @@
 # nix develop .#cuda
 # Copied from https://nixos.wiki/wiki/CUDA
-{ pkgs  }:
+{ pkgs }:
 
 pkgs.mkShell {
-   name = "cuda-env-shell";
-   buildInputs = with pkgs; [
-     git gitRepo gnupg autoconf curl
-     procps gnumake util-linux m4 gperf unzip
-     cudatoolkit linuxPackages.nvidia_x11
-     libGLU libGL
-     xorg.libXi xorg.libXmu freeglut
-     xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr zlib
-     ncurses5 stdenv.cc binutils
+  name = "cuda-env-shell";
+  buildInputs = with pkgs; [
+    autoconf
+    binutils
+    curl
+    freeglut
+    git
+    gitRepo
+    gnumake
+    gnupg
+    gperf
+    libGL
+    libGLU
+    m4
+    ncurses5
+    procps
+    stdenv.cc
+    unzip
+    util-linux
+    xorg.libX11
+    xorg.libXext
+    xorg.libXi
+    xorg.libXmu
+    xorg.libXrandr
+    xorg.libXv
+    zlib
 
-     # Other applications, like
-     hashcat
-   ];
-   shellHook = ''
-      export CUDA_PATH=${pkgs.cudatoolkit}
-      # export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib:${pkgs.ncurses5}/lib
-      export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
-      export EXTRA_CCFLAGS="-I/usr/include"
-   '';
+    cudatoolkit
+    linuxPackages.nvidia_x11
+
+    # Other applications, like
+    hashcat
+  ];
+
+  env = {
+    CUDA_PATH = pkgs.cudatoolkit;
+    EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib";
+    EXTRA_CCFLAGS = "-I/usr/include";
+  };
 }