-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
144 lines (140 loc) · 3.9 KB
/
flake.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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
description = "High Performance Computing course project 2022";
inputs.nixpkgs.url = "nixpkgs/nixos-22.05";
outputs = { self, nixpkgs }:
let
pname = "pso";
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.x86_64-linux;
runtimeDeps = with pkgs; [
];
buildDeps = with pkgs; [
mpi
sqlite
gnumake
pkg-config
glib
llvmPackages_13.openmp
];
reportDeps = with pkgs; [
doxygen
gnumake
pandoc
pandoc-eqnos
pandoc-secnos
pandoc-fignos
pandoc-tablenos
(texlive.combine {
inherit (texlive)
scheme-small
adjustbox babel-german background bidi collectbox csquotes everypage filehook
footmisc footnotebackref framed fvextra letltxmacro ly1 mdframed mweights
needspace pagecolor sourcecodepro sourcesanspro titling ucharcat ulem
unicode-math upquote xecjk xurl zref algorithms algorithm2e ifoddpage
algpseudocodex algorithmicx hyperref ieeetran supertabular standalone preview
relsize babel;
})
];
shellDeps = with pkgs; [
python39
python39Packages.numpy
python39Packages.jupyterlab
python39Packages.pandas
python39Packages.matplotlib
python39Packages.scipy
python39Packages.tabulate
sqlite-web
doxygen
check
];
CPackage = pkgs.stdenv.mkDerivation {
name = pname;
src = ./.;
buildInputs = buildDeps;
buildPhase = ''
make CC=mpicc build
'';
installPhase = ''
mkdir -p $out
cp -r bin/particle-swarm-optimization $out
'';
};
report = pkgs.stdenv.mkDerivation rec {
name = "report";
src = ./.;
buildInputs = reportDeps;
buildPhase = ''
make report
'';
installPhase = ''
mkdir -p $out
cp report.pdf $out
'';
};
shortReport = pkgs.stdenv.mkDerivation rec {
name = "report";
src = ./.;
buildInputs = reportDeps;
buildPhase = ''
make REPORT_TYPE=short report
'';
installPhase = ''
mkdir -p $out
cp short-report.pdf $out
'';
};
presentation = pkgs.stdenv.mkDerivation rec {
name = "presentation";
src = ./.;
buildInputs = reportDeps;
buildPhase = ''
make slides
'';
installPhase = ''
mkdir -p $out
cp presentation.pdf $out
'';
};
doxygen-awesome = pkgs.fetchFromGitHub {
owner = "jothepro";
repo = "doxygen-awesome-css";
rev = "a3c119b4797be2039761ec1fa0731f038e3026f6";
sha256 = "sha256-kslmiwgezjPz7EuMBt3c12bAzGYLjIE1otetw2ccNzE=";
};
documentation = pkgs.stdenv.mkDerivation rec {
name = "documentation";
src = ./.;
buildInputs = reportDeps;
buildPhase = ''
mkdir -p doxygen-awesome-css
cp -r ${doxygen-awesome}/* doxygen-awesome-css/
make doc
touch docs/html/.nojekyll
make report
make REPORT_TYPE=short report
make slides
'';
installPhase = ''
mkdir -p $out
cp report.pdf $out/
cp short-report.pdf $out/
cp presentation.pdf $out/
cp -a docs/html/* $out/
'';
};
in
{
packages."${system}" = {
report = report;
shortReport = shortReport;
particle-swarm-optimization = CPackage;
documentation = documentation;
presentation = presentation;
default = CPackage;
};
devShell."${system}" = pkgs.mkShell {
name = "${pname}_shell";
nativeBuildInputs = buildDeps ++ runtimeDeps ++ shellDeps ++ reportDeps;
};
};
}