-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfreecad-cfd.nix
75 lines (66 loc) · 2.29 KB
/
freecad-cfd.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# freecad.nix
let
# unstable
# nixpkgs_ball = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/master";
# nixgl_ball = fetchTarball "https://github.com/nix-community/nixGL/archive/main.tar.gz";
# pinned
# use this to get hash: nix-prefetch-url --unpack url
nixpkgs_ball = fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
sha256 = "1q7y5ygr805l5axcjhn0rn3wj8zrwbrr0c6a8xd981zh8iccmx0p";
};
nixgl_ball = fetchTarball {
url = "https://github.com/nix-community/nixGL/tarball/310f8e49a149e4c9ea52f1adf70cdc768ec53f8a";
sha256 = "1crnbv3mdx83xjwl2j63rwwl9qfgi2f1lr53zzjlby5lh50xjz4n";
};
# import the packages
nixgl = import nixgl_ball {};
pkgs = import nixpkgs_ball {
config = {
allowUnfree = true;
};
overlays = [ ];
};
# some bug hotfix, only for freecad 0.21.2
freecad-patched = pkgs.freecad.overrideAttrs (finalAttrs: previousAttrs: {
patches = previousAttrs.patches ++ [
./patches/0001-Fem-fix-searching-3rd-party-binaries-in-system-path.patch
];
});
custompkgs = import ./custompkgs { pkgs = pkgs; };
openfoam = custompkgs.openfoam-2306;
cfmesh = custompkgs.cfmesh-cfdof.override { openfoam = openfoam; };
hisa = custompkgs.hisa.override { openfoam = openfoam; };
in
pkgs.mkShell {
packages = [
pkgs.python3
pkgs.git
pkgs.curl
nixgl.nixGLIntel # Mesa OpenGL implementation (intel, amd, nouveau, ...).
# pkgs.freecad
freecad-patched
pkgs.calculix
pkgs.elmerfem
pkgs.gmsh
# pkgs.paraview # not necesary because the openfoam package carries it
openfoam
cfmesh
hisa
];
# What the hook does:
# add nixGL dynamic libs to LD_LIBRARY_PATH
# add hisa dynamic libs to LD_LIBRARY_PATH
# set FreeCAD storage locations
# some shorthands for shell access
# load OpenFOAM environment
shellHook = ''
export LD_LIBRARY_PATH=$(nixGLIntel printenv LD_LIBRARY_PATH):$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${hisa}/lib:$LD_LIBRARY_PATH
export FREECAD_USER_HOME=$(pwd)/freecad-state/home
export FREECAD_USER_DATA=$(pwd)/freecad-state/userdata
export FREECAD_USER_TEMP=$(pwd)/freecad-state/temp
alias freecad='nixGLIntel freecad'
source ${openfoam}/opt/OpenFOAM/OpenFOAM-v${openfoam.version}/etc/bashrc || true
'';
}