-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathflake.nix
More file actions
119 lines (98 loc) · 3.2 KB
/
flake.nix
File metadata and controls
119 lines (98 loc) · 3.2 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
description = "The GAP package Digraphs";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gap = pkgs.gap;
gaproot = "${gap}/lib/gap";
in
{
default = self.packages.${system}.digraphs;
digraphs = pkgs.stdenv.mkDerivation {
pname = "gap-digraphs";
version = "1.14.0";
src = ./.;
nativeBuildInputs = with pkgs; [
autoconf
automake
gcc
gnumake
];
buildInputs = [
gap
];
configurePhase = ''
runHook preConfigure
# Generate the configure script
mkdir -p gen
aclocal -Wall --force
autoconf -Wall -f
autoheader -Wall -f
# Run configure, pointing at the GAP root
./configure --with-gaproot=${gaproot}
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
make
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/digraphs"
# Copy GAP source files
cp -r gap "$out/digraphs/"
cp -r lib "$out/digraphs/" 2>/dev/null || true
cp -r doc "$out/digraphs/" 2>/dev/null || true
cp -r data "$out/digraphs/" 2>/dev/null || true
cp -r tst "$out/digraphs/" 2>/dev/null || true
# Copy the compiled shared object
cp -r bin "$out/digraphs/"
# Copy package metadata files
cp PackageInfo.g "$out/digraphs/"
cp init.g "$out/digraphs/"
cp read.g "$out/digraphs/"
cp -r makedoc.g "$out/digraphs/" 2>/dev/null || true
cp LICENSE "$out/digraphs/" 2>/dev/null || true
cp CHANGELOG.md "$out/digraphs/" 2>/dev/null || true
cp README.md "$out/digraphs/" 2>/dev/null || true
runHook postInstall
'';
meta = with pkgs.lib; {
description = "GAP methods for graphs, digraphs, and multidigraphs";
homepage = "https://digraphs.github.io/Digraphs";
license = licenses.gpl3Plus;
platforms = platforms.unix;
};
};
}
);
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gap = pkgs.gap;
in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.digraphs ];
packages = with pkgs; [
gap-full
];
shellHook = ''
export GAPROOT="${gap}/lib/gap"
echo "\$GAPROOT=$GAPROOT"
'';
};
}
);
};
}