add basic nix flake

This commit is contained in:
LordGrimmauld 2024-04-16 20:28:28 +02:00
commit f4af57935e
2 changed files with 97 additions and 0 deletions

26
flake.lock Normal file
View File

@ -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
}

71
flake.nix Normal file
View File

@ -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
'';
};
});
};
}