migration: packages: netgen
This commit is contained in:
parent
3ce10d2e35
commit
c673be029f
@ -11,4 +11,5 @@ in forAllSystems(system: let
|
|||||||
|
|
||||||
example = blib.mkApp { drv = bpkgs.example; name = "hello-nix"; };
|
example = blib.mkApp { drv = bpkgs.example; name = "hello-nix"; };
|
||||||
|
|
||||||
|
netgen = blib.mkApp { drv = bpkgs.netgen; };
|
||||||
})
|
})
|
||||||
|
13
devShells/default.nix
Normal file
13
devShells/default.nix
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{ self, nixpkgs, ... }:
|
||||||
|
let
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
|
||||||
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
|
|
||||||
|
in forAllSystems(system: let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
bpkgs = self.packages.${system};
|
||||||
|
blib = self.lib;
|
||||||
|
in {
|
||||||
|
|
||||||
|
netgen = import ./netgen.nix { inherit pkgs bpkgs; };
|
||||||
|
})
|
15
devShells/netgen.nix
Normal file
15
devShells/netgen.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{ pkgs, bpkgs, ... }:
|
||||||
|
let
|
||||||
|
python = pkgs.python3.withPackages(ps: []);
|
||||||
|
|
||||||
|
in pkgs.mkShellNoCC {
|
||||||
|
packages = with pkgs; [
|
||||||
|
bpkgs.netgen
|
||||||
|
python
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export PYTHONPATH="${python}/${python.sitePackages}"
|
||||||
|
export PYTHONPATH="$PYTHONPATH:${bpkgs.netgen}/${python.sitePackages}"
|
||||||
|
'';
|
||||||
|
}
|
@ -36,5 +36,7 @@
|
|||||||
packages = import ./packages { inherit self nixpkgs; };
|
packages = import ./packages { inherit self nixpkgs; };
|
||||||
|
|
||||||
apps = import ./apps { inherit self nixpkgs; };
|
apps = import ./apps { inherit self nixpkgs; };
|
||||||
|
|
||||||
|
devShells = import ./devShells { inherit self nixpkgs; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,7 @@ let
|
|||||||
in forAllSystems(system: let pkgs = nixpkgsFor.${system}; in {
|
in forAllSystems(system: let pkgs = nixpkgsFor.${system}; in {
|
||||||
|
|
||||||
example = pkgs.callPackage ./example {};
|
example = pkgs.callPackage ./example {};
|
||||||
|
|
||||||
|
netgen = pkgs.callPackage ./netgen {};
|
||||||
|
|
||||||
})
|
})
|
||||||
|
27
packages/example/flake.lock
generated
27
packages/example/flake.lock
generated
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1694422566,
|
|
||||||
"narHash": "sha256-lHJ+A9esOz9vln/3CJG23FV6Wd2OoOFbDeEs4cMGMqc=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "3a2786eea085f040a66ecde1bc3ddc7099f6dbeb",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
{
|
|
||||||
description = "Example with hello nix.";
|
|
||||||
nixConfig.bash-prompt = "\[nix-develop\]$ ";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }:
|
|
||||||
let
|
|
||||||
systems = [ "x86_64-linux" ];
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
|
||||||
|
|
||||||
in {
|
|
||||||
packages = forAllSystems (system: {
|
|
||||||
example = let
|
|
||||||
pkgs = nixpkgsFor.${system};
|
|
||||||
pname = "example";
|
|
||||||
version = "1.0";
|
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
|
||||||
inherit pname version;
|
|
||||||
|
|
||||||
# local source
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ cmake ninja ];
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
|
||||||
homepage = "https://www.example.org/";
|
|
||||||
description = "Example with hello nix.";
|
|
||||||
license = licenses.cc0;
|
|
||||||
platforms = platforms.linux;
|
|
||||||
maintainers = [];
|
|
||||||
broken = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
default = self.packages.${system}.example;
|
|
||||||
});
|
|
||||||
|
|
||||||
devShells = forAllSystems (system: {
|
|
||||||
example = let
|
|
||||||
pkgs = nixpkgsFor.${system};
|
|
||||||
example = self.packages.${system}.example;
|
|
||||||
|
|
||||||
in pkgs.mkShellNoCC {
|
|
||||||
packages = [
|
|
||||||
example
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
default = self.devShells.${system}.example;
|
|
||||||
});
|
|
||||||
|
|
||||||
apps = forAllSystems (system: {
|
|
||||||
example = let
|
|
||||||
pkgs = nixpkgsFor.${system};
|
|
||||||
example = self.packages.${system}.example;
|
|
||||||
|
|
||||||
in {
|
|
||||||
type = "app";
|
|
||||||
program = "${example}/bin/hello-nix";
|
|
||||||
};
|
|
||||||
|
|
||||||
default = self.apps.${system}.example;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
63
packages/netgen/default.nix
Normal file
63
packages/netgen/default.nix
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
stdenv, lib, pkgs,
|
||||||
|
version ? "6.2.2304",
|
||||||
|
sha256 ? "sha256-Rd7G316oIDklVq4uo7pS+v9ZqL+oV+RtZVU6iKYJCjM=", ...
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "netgen";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "NGSolve";
|
||||||
|
repo = "netgen";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = sha256;
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./regex-version.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-G Ninja"
|
||||||
|
"-D CMAKE_BUILD_TYPE=Release"
|
||||||
|
"-D USE_NATIVE_ARCH:BOOL=OFF"
|
||||||
|
"-D USE_OCC:BOOL=ON"
|
||||||
|
"-D USE_PYTHON:BOOL=ON"
|
||||||
|
"-D USE_GUI:BOOL=ON"
|
||||||
|
"-D USE_MPI:BOOL=ON"
|
||||||
|
"-D USE_SUPERBUILD:BOOL=OFF"
|
||||||
|
"-D PREFER_SYSTEM_PYBIND11:BOOL=ON"
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cmake
|
||||||
|
ninja
|
||||||
|
git
|
||||||
|
(python3.withPackages (ps: with ps; [
|
||||||
|
pybind11
|
||||||
|
mpi4py
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
zlib
|
||||||
|
tcl
|
||||||
|
tk
|
||||||
|
mpi
|
||||||
|
opencascade-occt
|
||||||
|
libGL
|
||||||
|
libGLU
|
||||||
|
xorg.libXmu
|
||||||
|
metis
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with pkgs.lib; {
|
||||||
|
homepage = "https://github.com/NGSolve/netgen";
|
||||||
|
description = "NETGEN is an automatic 3d tetrahedral mesh generator";
|
||||||
|
license = licenses.lgpl21Only;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = [];
|
||||||
|
broken = pkgs.stdenv.isDarwin;
|
||||||
|
};
|
||||||
|
}
|
11
packages/netgen/regex-version.patch
Normal file
11
packages/netgen/regex-version.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- a/cmake/generate_version_file.cmake
|
||||||
|
+++ b/cmake/generate_version_file.cmake
|
||||||
|
@@ -39,7 +39,7 @@ string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-([0-9a-z]+).*" "\\1"
|
||||||
|
set(NETGEN_VERSION_SHORT ${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}.${NETGEN_VERSION_PATCH})
|
||||||
|
set(NETGEN_VERSION_LONG ${NETGEN_VERSION_SHORT}-${NETGEN_VERSION_TWEAK}-${NETGEN_VERSION_HASH})
|
||||||
|
|
||||||
|
-if(NETGEN_VERSION_TWEAK)
|
||||||
|
+if(NETGEN_VERSION_TWEAK AND NOT NETGEN_VERSION_TWEAK STREQUAL git_version_string)
|
||||||
|
# no release version - nightly build
|
||||||
|
set(NETGEN_VERSION ${NETGEN_VERSION_LONG})
|
||||||
|
else()
|
Loading…
Reference in New Issue
Block a user