-
Notifications
You must be signed in to change notification settings - Fork 74
/
flake.nix
60 lines (45 loc) · 1.54 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
{
description = "A calculator program/website";
outputs = { self, nixpkgs }:
let
systems =
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in rec {
overlay = final: prev: {
kalker = final.rustPlatform.buildRustPackage {
pname = "kalker";
version = "unstable";
description = "A CLI calculator";
src = self;
nativeBuildInputs = with final; [ gcc ];
outputs = [ "out" "lib" ];
postInstall = ''
moveToOutput "lib" "$lib"
'';
cargoLock = { lockFile = self + "/Cargo.lock"; };
buildInputs = with final; [ gmp mpfr libmpc ];
CARGO_FEATURE_USE_SYSTEM_LIBS = "1";
};
};
packages =
forAllSystems (system: { inherit (nixpkgsFor.${system}) kalker; });
defaultPackage = forAllSystems (system: self.packages.${system}.kalker);
apps = forAllSystems (system: {
kalker = {
type = "app";
program = "${self.packages.${system}.kalker}/bin/kalker";
};
});
defaultApp = forAllSystems (system: self.apps.${system}.kalker);
devShell = forAllSystems (system:
nixpkgs.legacyPackages.${system}.mkShell {
inputsFrom = builtins.attrValues (packages.${system});
});
};
}