From ac702dfa414c6b307e2b3efe0792aea3acc2cd51 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Mon, 4 Mar 2024 22:20:16 +0100 Subject: [PATCH] commit workign state, dunno. Kinda misc. --- debug/default.nix | 1 + development/default.nix | 33 ++++++++++++++++++++++++++++++- development/nix-cmake | 4 ++-- python/default.nix | 23 +++++++++++++++++++++ rust/default.nix | 44 +++++++++++++++++++++++++++++++++++++++++ rust/rust-toolchain | 1 + 6 files changed, 103 insertions(+), 3 deletions(-) mode change 100644 => 100755 development/default.nix create mode 100644 python/default.nix create mode 100644 rust/default.nix create mode 100644 rust/rust-toolchain diff --git a/debug/default.nix b/debug/default.nix index 0a434d5..149f81f 100644 --- a/debug/default.nix +++ b/debug/default.nix @@ -14,6 +14,7 @@ stdenv.mkDerivation rec { lshw pciutils usbutils + vulkan-tools powertop ]; } diff --git a/development/default.nix b/development/default.nix old mode 100644 new mode 100755 index bfafa74..d7deef5 --- a/development/default.nix +++ b/development/default.nix @@ -15,14 +15,45 @@ gcc11Stdenv.mkDerivation rec { jetbrains.idea-community scala_3 moreutils + unzip hotspot cmakeWithGui gnumake + clang ccache cudatoolkit_11 git python3 linuxPackages.perf + sbt + cudaPackages.cudnn + (writeShellScriptBin "patch-cuda" "patchelf --set-rpath '/run/opengl-driver/lib:'$(patchelf --print-rpath $@) $@") + pkg-config + rustc + rustfmt + rust-analyzer + cargo + llvmPackages.bintools + alsa-lib + atk + cairo + dbus + gdk-pixbuf + glib + gtk3 + pango + pkg-config + jetbrains.rust-rover + imgui + qt6.full + qtcreator + nlohmann_json +# qtwayland ] ; - shellHook = ''export CXXFLAGS="-march=native -O3"''; + shellHook = '' +export CXXFLAGS="-march=native -O3" +export PATH=$PATH:/run/current-system/sw/bin +export LD_LIBRARY_PATH=${pkgs.libGL}/lib:${pkgs.libGLU}/lib:${pkgs.freeglut}/lib:${pkgs.xorg.libX11}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.cudatoolkit_11}/lib:${pkgs.cudaPackages.cudnn}/lib:${pkgs.cudatoolkit_11.lib}/lib:$LD_LIBRARY_PATH +# export LD_DEBUG=libs +''; } diff --git a/development/nix-cmake b/development/nix-cmake index b575373..7c084ff 100755 --- a/development/nix-cmake +++ b/development/nix-cmake @@ -1,4 +1,4 @@ -#! /usr/bin/env cached-nix-shell +#! /usr/bin/env nix-shell #! nix-shell -p python3 -i python3 # let's say you have a C++ project in Nix that you want to work on with CLion so that the Nix dependencies are available @@ -25,7 +25,7 @@ cwd = shlex.quote(os.getcwd()) cmd = 'cd ' + cwd + ' && cmake ' + ' '.join(args) os.chdir(scriptDir) -os.execvp("cached-nix-shell", [ +os.execvp("nix-shell", [ 'nix-shell', '--pure', '--run', cmd diff --git a/python/default.nix b/python/default.nix new file mode 100644 index 0000000..6e8ab25 --- /dev/null +++ b/python/default.nix @@ -0,0 +1,23 @@ +let + pkgs = import {}; +# nanomsg-py = ...build expression for this python library...; +in pkgs.mkShell { + buildInputs = with pkgs; [ + python3 + python3.pkgs.requests + piper-tts + libopus + python3.pkgs.pip +# pkgs.python3.pkgs.simplemediawiki +# nanomsg-py + ]; + shellHook = '' + # Tells pip to put packages into $PIP_PREFIX instead of the usual locations. + # See https://pip.pypa.io/en/stable/user_guide/#environment-variables. + export PIP_PREFIX=$(pwd)/_build/pip_packages + export PYTHONPATH="$PIP_PREFIX/${pkgs.python3.sitePackages}:$PYTHONPATH" + export PATH="$PIP_PREFIX/bin:$PATH" + unset SOURCE_DATE_EPOCH + ''; +} + diff --git a/rust/default.nix b/rust/default.nix new file mode 100644 index 0000000..1069b0a --- /dev/null +++ b/rust/default.nix @@ -0,0 +1,44 @@ +{ pkgs ? import {} }: + pkgs.mkShell rec { + buildInputs = with pkgs; [ + clang + # Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16) + llvmPackages.bintools + rustup + alsa-lib + atk + cairo + dbus + gdk-pixbuf + glib + gtk3 + pango + pkg-config + ]; + RUSTC_VERSION = pkgs.lib.readFile ./rust-toolchain; + # https://github.com/rust-lang/rust-bindgen#environment-variables + LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ]; + shellHook = '' + export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin + export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ + ''; + # Add precompiled library to rustc search path + RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [ + # add libraries here (e.g. pkgs.libvmi) + ]); + # Add glibc, clang, glib and other headers to bindgen search path + BINDGEN_EXTRA_CLANG_ARGS = + # Includes with normal include path + (builtins.map (a: ''-I"${a}/include"'') [ + # add dev libraries here (e.g. pkgs.libvmi.dev) + pkgs.glibc.dev + ]) + # Includes with special directory paths + ++ [ + ''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"'' + ''-I"${pkgs.glib.dev}/include/glib-2.0"'' + ''-I${pkgs.glib.out}/lib/glib-2.0/include/'' + ]; + + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + } diff --git a/rust/rust-toolchain b/rust/rust-toolchain new file mode 100644 index 0000000..d2628f6 --- /dev/null +++ b/rust/rust-toolchain @@ -0,0 +1 @@ +nightly-2024-02-21