forked from nbfc-linux/nbfc-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
47 lines (43 loc) · 1.5 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
{
inputs = {
nixpkgs.url = github:nixOS/nixpkgs;
utils.url = github:numtide/flake-utils;
};
outputs = { nixpkgs, utils, ... }:
utils.lib.eachSystem [ "i686-linux" "x86_64-linux" ]
(system:
let
pkgs = import nixpkgs {
inherit system;
};
lib = nixpkgs.lib;
buildPackage = { client ? "py" }:
assert lib.assertMsg (builtins.elem client [ "py" "python" "c" ]) "Client implementation is only available in Python and C";
pkgs.stdenv.mkDerivation {
name = "nbfc-linux";
version = "0.1.6";
src = lib.cleanSource ./.;
buildInputs = lib.optional (builtins.elem client [ "py" "python" ]) pkgs.python3;
buildFlags = [ "PREFIX=$(out)" "confdir=/etc" ];
installPhase =
let
installFlags = [ "PREFIX=$out" ];
in
''
make ${builtins.concatStringsSep " " installFlags}\
install-core \
install-client-${if (client == "c") then "c" else "py" }\
install-configs\
install-docs\
install-completion
'';
};
in
rec {
packages = rec {
nbfc = buildPackage { client = "py"; };
nbfc-client-c = buildPackage { client = "c"; };
};
defaultPackage = packages.nbfc;
});
}