-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
95 lines (86 loc) · 2.42 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
future.url = "github:NixOS/nixpkgs/nixos-unstable";
outdated.url = "github:NixOS/nixpkgs/nixos-21.05";
};
outputs =
{ self, nixpkgs, future, outdated, flake-utils, bundlers }:
let
version = "1.2.0";
base_libs = pkgs:
with pkgs; [
cli11
cmake
fmt_8
fmt_8.dev
gsl
hdf5-cpp.dev
ninja
zlib
];
in
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
next = import future { inherit system; };
in
{
devShells.default = pkgs.stdenv.mkDerivation {
name = "np-shell";
buildInputs = base_libs pkgs
++ (with pkgs; [
(pkgs.clang-tools.override {
llvmPackages = pkgs.llvmPackages_13;
})
ccache
ccls
cmake-format
cmake-language-server
distcc
gdb
valgrind
]);
CMAKE_CXX_COMPILER_LAUNCHER = "${pkgs.ccache}/bin/ccache";
CMAKE_CXX_FLAGS_DEBUG = "-g -O0";
CXXL = "${pkgs.stdenv.cc.cc.lib}";
};
apps = {
default =
flake-utils.lib.mkApp { drv = self.packages.${system}.np; };
};
packages = {
np = pkgs.stdenv.mkDerivation ({
inherit version;
pname = "np";
src = builtins.path {
path = ./.;
name = "np-src";
};
buildInputs = base_libs pkgs;
nativeBuildInputs = [ pkgs.wrapGAppsHook ];
cmakeFlags = [ "-G Ninja -DCONAN:bool=Off" ];
installPhase = ''
mkdir -p $out/bin
mv np $out/bin/
'';
meta = with pkgs.lib; {
description = "Processor for NeXuS files";
homepage = "https://github.com/disorderedmaterials/np";
license = licenses.gpl3;
maintainers = with maintainers; [ rprospero ];
};
});
singularity =
nixpkgs.legacyPackages.${system}.singularity-tools.buildImage {
name = "np-${version}";
diskSize = 1024 * 50;
memSize = 1024 * 2;
contents = [
self.packages.${system}.np
];
runScript = "${self.packages.${system}.np}/bin/np $@";
};
};
});
}