blob: e86a61df20e239ae6e1a951b0104bb98bf53f8e7 (
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
|
{
description = "oh yeah. we're getting ziggy with it now.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig-overlay = {
url = "github:mitchellh/zig-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
# We don't use this
flake-compat.follows = "";
};
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
zig-overlay,
}:
let
# https://github.com/mitchellh/zig-overlay?tab=readme-ov-file#usage
zigVersion = "0.13.0";
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
zig = zig-overlay.packages.${system}.${zigVersion}.overrideAttrs {
# FIXME: `zig.hook` requires `zig` to have it's `meta` attribute
# zig-overlay doesn't provide this...yay
inherit (pkgs.zig) meta;
};
in
rec {
devShells.default = pkgs.mkShellNoCC {
packages = [ zig ];
};
formatter = pkgs.nixfmt-rfc-style;
packages = {
default = packages.ziggy-with-it;
# NOTE: We use `stdenvNoCC` here as `zig` is all we need
ziggy-with-it = pkgs.stdenvNoCC.mkDerivation {
pname = "ziggy-with-it";
version = self.shortRev or self.dirtyShortRev or "waaaa";
src = self;
# `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 = [
# We can use nixpkgs' `zig.hook`, but with our own `zig`
(pkgs.zig.hook.override { inherit zig; })
];
};
};
}
);
}
|