From f4af57935e39b5e1dbdbe1b7a86d7bd48e77d29b Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Tue, 16 Apr 2024 20:28:28 +0200 Subject: [PATCH] add basic nix flake --- flake.lock | 26 ++++++++++++++++++++ flake.nix | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..de96bd1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1713254108, + "narHash": "sha256-0TZIsfDbHG5zibtlw6x0yOp3jkInIGaJ35B7Y4G8Pec=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2fd19c8be2551a61c1ddc3d9f86d748f4db94f00", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..94dc6e1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,71 @@ +{ + description = "PBSA: Physikalisch Basierte Simulation und Animation"; + + inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + + outputs = + { nixpkgs + , self + , ... + }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); + in + { + devShells = forAllSystems + (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = + let + py-pkg = pkgs.python3.withPackages (python-pkgs: with python-pkgs; + [ + # glad2 # todo + glad + anyqt + eigenpy + pip + ]); + + in + pkgs.mkShell { + packages = with pkgs; [ + # base toolchain + gcc13 + gdb + clang + libgcc + qt6.full + qtcreator + cmake + nlohmann_json + qt6.qtwayland + icu + libcxx + nil + libGL + libGLU + eigen + py-pkg + ]; + + 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/${py-pkg.sitePackages}:$PYTHONPATH" + export PATH="$PIP_PREFIX/bin:$PATH" + unset SOURCE_DATE_EPOCH + ''; + }; + + }); + }; +}