Skip to content

Instantly share code, notes, and snippets.

@rseward
Last active September 3, 2024 03:25
Show Gist options
  • Save rseward/f15a9820daf6b2046db2e6850932e693 to your computer and use it in GitHub Desktop.
Save rseward/f15a9820daf6b2046db2e6850932e693 to your computer and use it in GitHub Desktop.
Python 3.10 ML nix-shell
# export NIXPKGS_ALLOW_UNFREE=1
{ pkgs ? import <nixpkgs> { } }:
(pkgs.buildFHSUserEnv {
name = "pipzone";
targetPkgs = pkgs: (with pkgs; [
stdenv
portaudio
pkg-config
binutils
glibc
gcc
gfortran
gfortran.cc
python310
python310Packages.sounddevice
python310Packages.pip
python310Packages.virtualenv
cudaPackages.cudatoolkit
]);
runScript = "bash";
}).env
@rseward
Copy link
Author

rseward commented Sep 3, 2024

I can now find gcc, however a g++ fails to compile a small program such as this. :-(

test_g++.sh

#!/bin/bash

echo "nix-shell -p gcc # appears to be able to run and build this despite pkgconfig not being found!"

set -x
rm -f static
g++ -o static $(pkgconfig --libs --cflags openssl) -x c++ - <<EOF
#include <iostream>
int main() {
      std::cout << "Hello World!\n";
}
EOF

ls -l static

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment