-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathflake.nix
92 lines (80 loc) · 2.48 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
{
description = "Alternative Free Identity System";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
naersk.url = "github:nmattia/naersk";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, naersk }:
let
systems = [
"aarch64-linux"
"aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
"i686-windows"
"x86_64-windows"
];
in flake-utils.lib.eachSystem systems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
naersk-lib = naersk.lib.${system};
alfis = { webgui ? true, doh ? true, edge ? false }:
let
features = builtins.concatStringsSep " " (builtins.concatMap
({ option, features }: pkgs.lib.optionals option features) [
{
option = webgui;
features = [ "webgui" ];
}
{
option = doh;
features = [ "doh" ];
}
{
option = edge;
features = [ "edge" ];
}
]);
in naersk-lib.buildPackage {
pname = "alfis";
nativeBuildInputs = with pkgs; [ pkg-config webkitgtk kdialog ];
dontWrapQtApps = true;
cargoBuildOptions = opts:
opts ++ [ "--no-default-features" ]
++ [ "--features" ''"${features}"'' ];
root = ./.;
};
isWindows = builtins.elem system [ "i686-windows" "x86_64-windows" ];
in rec {
packages = {
alfis = alfis {
webgui = true;
doh = true;
edge = false;
};
alfisWithoutGUI = alfis {
webgui = false;
doh = true;
edge = false;
};
} // pkgs.lib.optionalAttrs isWindows {
alfisEdge = alfis {
webgui = false;
doh = true;
edge = true;
};
};
defaultPackage = packages.alfis;
apps = with flake-utils.lib;
{
alfis = mkApp { drv = packages.alfis; };
alfisWithoutGUI = mkApp { drv = packages.alfisWithoutGUI; };
} // pkgs.lib.optionalAttrs isWindows {
alfisEdge = mkApp { drv = packages.alfisEdge; };
};
defaultApp = apps.alfis;
devShell = import ./shell.nix { inherit pkgs; };
});
}