diff --git a/env/flake.nix b/env/flake.nix new file mode 100644 index 00000000..c27b03fd --- /dev/null +++ b/env/flake.nix @@ -0,0 +1,150 @@ +{ + description = ""; + + inputs = { + nixpkgs.url = "nixpkgs"; # Use nixpkgs from system registry + flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { + inputs, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ + inputs.rust-overlay.overlays.default + ]; + }; + + python = pkgs.python313.withPackages (p: + with p; [ + pyside6 + ffmpeg-python + matplotlib + numpy + ]); + + rust = pkgs.rust-bin.stable.latest.default.override { + extensions = ["rust-src"]; # Include the Rust stdlib source (for IntelliJ) + }; + + # 64 bit C/C++ compilers that don't collide (use the same libc) + bintools = pkgs.wrapBintoolsWith { + bintools = pkgs.bintools.bintools; # Unwrapped bintools + libc = pkgs.glibc; + }; + gcc = pkgs.hiPrio (pkgs.wrapCCWith { + cc = pkgs.gcc15.cc; # Unwrapped gcc + libc = pkgs.glibc; + bintools = bintools; + }); + clang = pkgs.wrapCCWith { + cc = pkgs.clang_20.cc; # Unwrapped clang + libc = pkgs.glibc; + bintools = bintools; + }; + + # Multilib C/C++ compilers that don't collide (use the same libc) + bintools_multilib = pkgs.wrapBintoolsWith { + bintools = pkgs.bintools.bintools; # Unwrapped bintools + libc = pkgs.glibc_multi; + }; + gcc_multilib = pkgs.hiPrio (pkgs.wrapCCWith { + cc = pkgs.gcc15.cc; # Unwrapped gcc + libc = pkgs.glibc_multi; + bintools = bintools_multilib; + }); + clang_multilib = pkgs.wrapCCWith { + cc = pkgs.clang_20.cc; # Unwrapped clang + libc = pkgs.glibc_multi; + bintools = bintools_multilib; + }; + in { + # TODO: Add default packages for different languages + # TODO: check nixpkgs docs for buildPythonApplication + # packages.default = pkgs.buildPythonApplication { + # pname = "pyside6_image_viewer"; + # version = "0.1.0"; + # }; + + devShell = pkgs.mkShell { + name = "Development Environment"; + + # Comments on buildInputs, nativeBuildInputs, buildPackages: + # https://discourse.nixos.org/t/use-buildinputs-or-nativebuildinputs-for-nix-shell/8464 + # For our "nix develop" shell, buildInputs can be used for everything. + + # Stuff that's linked against. + # Architecture will be the host platform. + # Packages will be added to $PATH unless "strictDeps = true;". + buildInputs = with pkgs; [ + # Languages: + # python + # rust + # bintools + # gcc + # clang + # bintools_multilib + # gcc_multilib + # clang_multilib + + # C/C++: + # gdb + # valgrind + # gnumake + # cmake + # boost + # sfml + + # Qt: + # qt6.qtbase + # qt6.full + # qt6.wrapQtAppsHook # For the shellHook + ]; + + # Stuff ran at build-time (e.g. cmake, autoPatchelfHook). + # Architecture will be the build platform (relevant for e.g. cross-compilation). + # Packages will be added to $PATH. + nativeBuildInputs = with pkgs; [ + ]; + + # Rust stdlib source: + # RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library"; + + # Dynamic libraries example: + # LD_LIBRARY_PATH = builtins.concatStringsSep ":" [ + # # Rust Bevy GUI app + # "${pkgs.xorg.libX11}/lib" + # "${pkgs.xorg.libXcursor}/lib" + # "${pkgs.xorg.libXrandr}/lib" + # "${pkgs.xorg.libXi}/lib" + # "${pkgs.libGL}/lib" + # ]; + + # Dynamic libraries from buildinputs: + # LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs; + + # Setup the shell when entering the "nix develop" environment + shellHook = builtins.concatStringsSep "\n" [ + # Qt: Set the environment variables that Qt apps expect + # '' + # fishdir=$(mktemp -d) + # makeWrapper "$(type -p fish)" "$fishdir/fish" "''${qtWrapperArgs[@]}" + # exec "$fishdir/fish" + # '' + + # Add shell abbreviations specific to this build environment + # '' + # abbr -a build-release-windows "CARGO_FEATURE_PURE=1 cargo xwin build --release --target x86_64-pc-windows-msvc" + # '' + ]; + }; + }); +} diff --git a/env/flake_c++-with-libs.nix b/env/flake_c++-with-libs.nix deleted file mode 100644 index e20df2fb..00000000 --- a/env/flake_c++-with-libs.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - description = "C/C++ Environment with Libraries"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.devshell.url = "github:numtide/devshell"; - - outputs = { - self, - nixpkgs, - flake-utils, - devshell, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; # For clion - overlays = [devshell.overlays.default]; - }; - - # NOTE: Usual 64 bit compilers that don't collide - bintools = pkgs.wrapBintoolsWith { - bintools = pkgs.bintools.bintools; - libc = pkgs.glibc; - }; - gcc13 = pkgs.hiPrio (pkgs.wrapCCWith { - cc = pkgs.gcc13.cc; - libc = pkgs.glibc; - bintools = bintools; - }); - clang16 = pkgs.wrapCCWith { - cc = pkgs.clang_16.cc; - libc = pkgs.glibc; - bintools = bintools; - }; - - # NOTE: Multilib compilers that don't collide - bintools_multi = pkgs.wrapBintoolsWith { - bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper - libc = pkgs.glibc_multi; - }; - gcc13_multi = pkgs.hiPrio (pkgs.wrapCCWith { - cc = pkgs.gcc13.cc; # Get the unwrapped gcc from the wrapper - libc = pkgs.glibc_multi; - bintools = bintools_multi; - }); - clang16_multi = pkgs.wrapCCWith { - cc = pkgs.clang_16.cc; - libc = pkgs.glibc_multi; - bintools = bintools_multi; - }; - in { - # NOTE: We cannot use devshell, as it doesn't propagate library paths (yet?) - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - # Compilers - bintools - gcc13 - clang16 - # bintools_multi - # gcc13_multi - # clang15_multi - - # Native buildinputs - gnumake - cmake - # nasm - - # Development - # bear # To generate compilation database - gdb - # cling # To try out my bullshit implementations - # doxygen # Generate docs + graphs - - # C++ Libraries - # boost181 - # raylib - # sfml - - # C Libraries - # blas - # lapack - # libsvm - ]; - }; - }); -} diff --git a/env/flake_c++.nix b/env/flake_c++.nix deleted file mode 100644 index 77e4cf5c..00000000 --- a/env/flake_c++.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - description = "C/C++ Environment"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.devshell.url = "github:numtide/devshell"; - - outputs = { - self, - nixpkgs, - flake-utils, - devshell, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; # For clion - overlays = [devshell.overlays.default]; - }; - - # NOTE: Usual 64 bit compilers that don't collide - bintools = pkgs.wrapBintoolsWith { - bintools = pkgs.bintools.bintools; - libc = pkgs.glibc; - }; - gcc13 = pkgs.hiPrio (pkgs.wrapCCWith { - cc = pkgs.gcc13.cc; - libc = pkgs.glibc; - bintools = bintools; - }); - clang16 = pkgs.wrapCCWith { - cc = pkgs.clang_16.cc; - libc = pkgs.glibc; - bintools = bintools; - }; - - # NOTE: Multilib compilers that don't collide - bintools_multi = pkgs.wrapBintoolsWith { - bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper - libc = pkgs.glibc_multi; - }; - gcc13_multi = pkgs.hiPrio (pkgs.wrapCCWith { - cc = pkgs.gcc13.cc; # Get the unwrapped gcc from the wrapper - libc = pkgs.glibc_multi; - bintools = bintools_multi; - }); - clang16_multi = pkgs.wrapCCWith { - cc = pkgs.clang_16.cc; - libc = pkgs.glibc_multi; - bintools = bintools_multi; - }; - in { - # devShell = pkgs.devshell.mkShell ... - devShell = pkgs.devshell.mkShell { - name = "C/C++ Environment"; - - packages = with pkgs; [ - # Compilers - bintools - gcc13 - clang16 - # bintools_multi - # gcc13_multi - # clang15_multi - - # Native buildinputs - gnumake - cmake - # nasm - - # Development - # bear # To generate compilation database - gdb - # cling # To try out my bullshit implementations - # doxygen # Generate docs + graphs - ]; - - commands = [ - # { - # name = "ide"; - # help = "Run clion for project"; - # command = "clion &>/dev/null ./ &"; - # } - ]; - }; - }); -} diff --git a/env/flake_java.nix b/env/flake_java.nix deleted file mode 100644 index cb8e0e05..00000000 --- a/env/flake_java.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - description = "Java Environment"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.devshell.url = "github:numtide/devshell"; - - outputs = { - self, - nixpkgs, - flake-utils, - devshell, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; # For clion - overlays = [devshell.overlays.default]; - }; - in { - devShell = pkgs.devshell.mkShell { - name = "Java Environment"; - - packages = with pkgs; [ - jdk22 - jdt-language-server - gradle - ]; - - commands = []; - }; - }); -} diff --git a/env/flake_latex.nix b/env/flake_latex.nix deleted file mode 100644 index 1dbeed3d..00000000 --- a/env/flake_latex.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - description = "LaTeX Environment"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.devshell.url = "github:numtide/devshell"; - - outputs = { - self, - nixpkgs, - flake-utils, - devshell, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [devshell.overlays.default]; - }; - - latexPython = pkgs.python311.withPackages (p: - with p; [ - rich - pygments - ]); - in { - devShell = pkgs.devshell.mkShell { - name = "LaTeX Environment"; - - packages = with pkgs; [ - texlive.combined.scheme-full - inkscape - latexPython - texlab - ]; - - # Use $1 for positional args - # commands = [ - # ]; - }; - }); -} diff --git a/env/flake_python.nix b/env/flake_python.nix deleted file mode 100644 index a509f275..00000000 --- a/env/flake_python.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - description = "Python Environment"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.devshell.url = "github:numtide/devshell"; - - outputs = { - self, - nixpkgs, - flake-utils, - devshell, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [devshell.overlays.default]; - }; - - python-with-packages = pkgs.python311.withPackages (p: - with p; [ - # Basic - rich - # python-dotenv - - # Math - # numpy - # matplotlib - # sympy - - # Web - # flask - # flask-sqlalchemy - # sqlalchemy - - # Discord - # discordpy - # pynacl # discordpy voice support - - # Scraping - # beautifulsoup4 - # requests - ]); - in { - devShell = pkgs.devshell.mkShell { - name = "Python Environment"; - - packages = with pkgs; [ - python-with-packages - ]; - - # Use $1 for positional args - commands = [ - # { - # name = ""; - # help = ""; - # command = ""; - # } - ]; - }; - }); -} diff --git a/env/flake_rust.nix b/env/flake_rust.nix deleted file mode 100644 index 49d5e7a7..00000000 --- a/env/flake_rust.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - description = "Rust Environment"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.devshell.url = "github:numtide/devshell"; - inputs.rust-overlay.url = "github:oxalica/rust-overlay"; - - outputs = { - self, - nixpkgs, - flake-utils, - devshell, - rust-overlay, - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; # For clion - overlays = [ - devshell.overlays.default - rust-overlay.overlays.default - ]; - }; - - # Includes cargo, rustc, rustfmt - rust-stable = pkgs.rust-bin.stable.latest.default.override { - extensions = ["rust-src"]; # Include the rust stdlib source for intellij - }; - in { - devShell = pkgs.devshell.mkShell { - name = "Rust Environment"; - - packages = with pkgs; [ - rust-stable - rust-analyzer - ]; - - env = [ - # Allow for intellij to find the stdlib - # { - # name = "RUST_SRC_PATH"; - # value = "${rust-stable}/lib/rustlib/src/rust/library"; - # } - - # Use this if the rust binary needs additional libraries - # { - # name = "LD_LIBRARY_PATH"; - # value = "${pkgs.xorg.libX11}/lib:${pkgs.xorg.libXcursor}/lib:${pkgs.xorg.libXrandr}/lib:${pkgs.xorg.libXi}/lib:${pkgs.libGL}/lib"; - # } - ]; - - commands = [ - # { - # name = "ide"; - # help = "Run clion for project"; - # command = "clion &>/dev/null ./ &"; - # } - ]; - }; - }); -}