-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathflake.nix
87 lines (75 loc) · 2.27 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
{
description = "tev — The EXR Viewer";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# Extract version from CMakeLists.txt
version = with builtins;
let
cmakeContents = readFile ./CMakeLists.txt;
versionMatch = match ".*VERSION[[:space:]]+([^[:space:]]+).*" cmakeContents;
in
if versionMatch == null then throw "Could not find version in CMakeLists.txt"
else head versionMatch;
# Common dependencies shared between dev shell and build
commonDeps = with pkgs;
if stdenv.isDarwin then [
darwin.apple_sdk.frameworks.Cocoa
darwin.apple_sdk.frameworks.OpenGL
] else [
xorg.libX11
xorg.libXcursor
xorg.libXinerama
xorg.libXrandr
xorg.libXi
libGL
zlib
];
# Common build inputs shared between dev shell and build
commonBuildInputs = with pkgs; [
cmake
];
tev = pkgs.stdenv.mkDerivation {
pname = "tev";
inherit version;
src = ./.;
nativeBuildInputs = commonBuildInputs;
buildInputs = commonDeps;
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DTEV_DEPLOY=ON"
];
meta = with pkgs.lib; {
description = "High dynamic range (HDR) image comparison tool for graphics people";
homepage = "https://github.com/Tom94/tev";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = [ ];
};
};
in
{
packages = {
default = tev;
tev = tev;
};
devShell = pkgs.mkShell {
buildInputs = commonDeps ++ commonBuildInputs ++ (with pkgs;
if stdenv.isDarwin then [ ] else [
gcc
gdb
binutils
]
);
};
apps.default = flake-utils.lib.mkApp {
drv = tev;
};
}
);
}