blob: 0733e33f1de9034e788d75961bf65b4ca5e4b504 (
plain)
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
|
{
description = "oh yeah. we're getting ziggy with it now.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
zig-overlay = {
url = "github:mitchellh/zig-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
zig-overlay,
...
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
# https://github.com/mitchellh/zig-overlay?tab=readme-ov-file#usage
zigVersion = "master-2024-05-08";
zigFor = system: zig-overlay.packages.${system}.${zigVersion};
in {
devShells = forAllSystems ({
pkgs,
system,
...
}: {
default = pkgs.mkShellNoCC {
inputsFrom = [self.packages.${system}.ziggy-with-it];
};
});
packages = forAllSystems ({
lib,
pkgs,
system,
...
}: rec {
default = ziggy-with-it;
ziggy-with-it = pkgs.stdenvNoCC.mkDerivation {
pname = "ziggy-with-it";
version = self.shortRev or self.dirtyShortRev or "waaaa";
src = with lib.fileset;
toSource {
root = ./.;
fileset = unions [
(gitTracked ./src)
./build.zig
./build.zig.zon
];
};
# `deps.nix` is generated with by running `zon2nix`
# https://github.com/nix-community/zon2nix
postPatch = ''
ln -s ${pkgs.callPackage ./deps.nix {}} $ZIG_GLOBAL_CACHE_DIR/p
'';
nativeBuildInputs = [
(pkgs.zig.hook.override {
# FIXME: `zig.hook` requires `zig` to have it's `meta` attribute
# zig-overlay requires this `meta` attribute..yay
zig = zigFor system // {inherit (pkgs.zig) meta;};
})
];
};
});
};
}
|