This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathflake.nix
79 lines (64 loc) · 2.04 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
{
description = "A Zig package manager with an index, build runner, and build dependencies.";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
zig.url = github:mitchellh/zig-overlay;
utils.url = github:numtide/flake-utils;
# Used for shell.nix
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
};
outputs = {self, nixpkgs, zig, utils, ...} @ inputs: with utils.lib;
eachSystem allSystems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
zigpkgs = inputs.zig.packages.${prev.system};
# zig = inputs.zig.packages.${zigVersion}.${prev.system};
})
];
};
# Our supported systems are the same supported systems as the Zig binaries
systems = builtins.attrNames inputs.zig.packages;
pname = "gyro";
version = "0.7.0";
zigVersion = "0.10.0";
z = pkgs.zigpkgs.${zigVersion};
gyro = pkgs.stdenv.mkDerivation {
inherit pname version;
src = ./.;
nativeBuildInputs = with pkgs; [ z ];
buildInputs = with pkgs; [ ];
dontConfigure = true;
preBuild = ''
export HOME=$TMPDIR
'';
installPhase = ''
runHook preInstall
zig build -Drelease-safe --prefix $out install
runHook postInstall
'';
installFlags = ["DESTDIR=$(out)"];
meta = with pkgs.lib; {
description = "A Zig package manager with an index, build runner, and build dependencies.";
license = licenses.mit;
platforms = with platforms; linux ++ darwin;
maintainers = with maintainers; [ jakeisnt ];
};
};
in rec {
packages = {
gyro = gyro;
default = gyro;
};
defaultPackage = gyro;
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ ];
buildInputs = with pkgs; [ z ];
};
devShell = self.devShells.${system}.default;
});
}