NsightSystems fails to build in nix develop but runs with nix-shell -p

flake.nix:

{
  description = "CUDA development environment";
  outputs = {
    self,
    nixpkgs,
  }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      config.allowUnfree = true;
      config.cudaSupport = true;
      config.cudaVersion = "13";
    };
    nvidiaPackage = pkgs.linuxPackages.nvidiaPackages.stable;
  in {
    # alejandra is a nix formatter with a beautiful output
    formatter."${system}" = nixpkgs.legacyPackages.${system}.alejandra;
    devShells.${system}.default = pkgs.mkShell {
      buildInputs = with pkgs; [
        ffmpeg
        fmt.dev
        cudaPackages.cuda_cudart
        cudaPackages.libcurand
        cudaPackages.libcurand.dev
        (cudaPackages.nsight_compute.overrideAttrs (old: {
          libPath = "${cudaPackages.cuda_cudart}/lib";
        }))
        # cudaPackages.nsight_systems
        cudaPackages.cuda_gdb
        cudatoolkit
        nvidiaPackage
        cudaPackages.cudnn
        libGLU
        libGL
        xorg.libXi
        xorg.libXmu
        freeglut
        xorg.libXext
        xorg.libX11
        xorg.libXv
        xorg.libXrandr
        zlib
        ncurses
        stdenv.cc
        binutils
        uv
      ];

      shellHook = ''
        export LD_LIBRARY_PATH="${nvidiaPackage}/lib:$LD_LIBRARY_PATH"
        export CUDA_PATH=${pkgs.cudatoolkit}
        export EXTRA_LDFLAGS="-L/lib -L${nvidiaPackage}/lib"
        export EXTRA_CCFLAGS="-I/usr/include"
        export CMAKE_PREFIX_PATH="${pkgs.fmt.dev}:$CMAKE_PREFIX_PATH"
        export PKG_CONFIG_PATH="${pkgs.fmt.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
      '';
    };
  };
}

Those are rather different commands, if I imagine how you are using them correctly. nix-shell -p cudaPackages.nsight_systems gets that package from nixpkgs, and puts it into your PATH. nix develop uses your flake to make a devshell, and activates it.

Anyways: using your flake.nix, I can successfully run nix develop with and without the line uncommented. What is your nixpkgs pinned to? My flake.lock is:

{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1762943920,
        "narHash": "sha256-ITeH8GBpQTw9457ICZBddQEBjlXMmilML067q0e6vqY=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "91c9a64ce2a84e648d0cf9671274bb9c2fb9ba60",
        "type": "github"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}
{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1762482733,
        "narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc",
        "type": "github"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

ok seems like a nix flake update solves the problem

1 Like