Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
102 lines (85 loc) · 2.97 KB
/
Copy pathflake.nix
File metadata and controls
102 lines (85 loc) · 2.97 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
description = "C++ partial differential equation framework";
inputs = {
# NOTE: Using 26.05 to support intel macs
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
flake-parts.url = "github:hercules-ci/flake-parts";
dealii.url = "git+https://codeberg.org/landinjm/dealii-flake.git";
};
outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
perSystem = {
pkgs,
system,
...
}: {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
pkg-config
# Main packages
cmake
gnumake
ninja
gcc
mpi
inputs.dealii.packages.${system}.default
# Optional packages
python3
vtk
(pkgs.callPackage ./contrib/nix/caliper.nix {})
# Pre-commit
llvmPackages_18.clang-tools
pre-commit
# Documentation
doxygen
graphviz
];
shellHook = ''
# Grab submodules
git submodule update --init --recursive
# Use half the available jobs so we don't run out of memory
jobs=$(( $(nproc) / 2 ))
[ "$jobs" -lt 1 ] && jobs=1
export CMAKE_BUILD_PARALLEL_LEVEL=$jobs
export PRISMS_PF_DIR="$PWD/install"
alias prisms_build="cmake --workflow --preset debugrelease"
alias prisms_test="cmake --workflow --preset test"
alias prisms_docs="cmake --workflow --preset docs"
alias prisms_prm_format="./contrib/utilities/prm_format.sh"
alias prisms_copyright="./contrib/utilities/update_copyright.sh"
prisms_serve_docs() {
local docs_dir="build/docs/doc/$(git branch --show-current)"
if [ ! -d "$docs_dir" ]; then
echo "Error: Documentation directory not found: $docs_dir" >&2
return 1
fi
(
cd "$docs_dir" || exit 1
echo "Serving docs at http://localhost:8000"
python3 -m http.server 8000
)
}
prisms_help() {
echo "Available development commands:"
echo " prisms_build Build debug and release configurations"
echo " prisms_test Build and run the tests"
echo " prisms_docs Build the docs"
echo " prisms_serve_docs Serve docs at localhost:8000"
echo " prisms_prm_format Format .prm files"
echo " prisms_copyright Update copyright headers"
echo ""
echo "Run prisms_help to display this list again."
}
echo "Dev shell loaded!"
prisms_help
'';
};
};
};
}