Skip to content

Commit 7edadce

Browse files
committed
switch from mitchellh/zig-overlay to silversquirl/zig-flake
1 parent f510075 commit 7edadce

File tree

3 files changed

+30
-130
lines changed

3 files changed

+30
-130
lines changed

deps.nix

Lines changed: 0 additions & 27 deletions
This file was deleted.

flake.lock

Lines changed: 9 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,33 @@
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
44

5-
zig-overlay.url = "github:mitchellh/zig-overlay";
6-
zig-overlay.inputs.nixpkgs.follows = "nixpkgs";
5+
zig.url = "github:silversquirl/zig-flake";
6+
zig.inputs.nixpkgs.follows = "nixpkgs";
77

88
gitignore.url = "github:hercules-ci/gitignore.nix";
99
gitignore.inputs.nixpkgs.follows = "nixpkgs";
1010
};
1111

1212
outputs = {
13-
self,
1413
nixpkgs,
15-
zig-overlay,
14+
zig,
1615
gitignore,
17-
}:
18-
builtins.abort "This flake is currently broken because Zig 0.15.1 is temporarily unavailable in https://github.com/mitchellh/zig-overlay. Apologies for the disturbance, this will be addressed as soon as possible."
19-
builtins.foldl' nixpkgs.lib.recursiveUpdate {} (
20-
builtins.map
21-
(
22-
system: let
23-
pkgs = nixpkgs.legacyPackages.${system};
24-
zig = zig-overlay.packages.${system}.master;
25-
gitignoreSource = gitignore.lib.gitignoreSource;
26-
target = builtins.replaceStrings ["darwin"] ["macos"] system;
27-
revision = self;
28-
in {
29-
formatter.${system} = pkgs.alejandra;
30-
packages.${system} = rec {
31-
default = zls;
32-
zls = pkgs.stdenvNoCC.mkDerivation {
33-
name = "zls";
34-
version = "master";
35-
meta.mainProgram = "zls";
36-
src = gitignoreSource ./.;
37-
nativeBuildInputs = [zig];
38-
dontInstall = true;
39-
doCheck = true;
40-
configurePhase = ''
41-
export ZIG_GLOBAL_CACHE_DIR=$TEMP/.cache
42-
'';
43-
buildPhase = ''
44-
PACKAGE_DIR=${pkgs.callPackage ./deps.nix {}}
45-
zig build install --system $PACKAGE_DIR -Dtarget=${target} -Doptimize=ReleaseSafe --color off --prefix $out
46-
'';
47-
checkPhase = ''
48-
zig build test --system $PACKAGE_DIR -Dtarget=${target} --color off
49-
'';
50-
};
51-
};
52-
}
53-
)
54-
["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]
55-
);
16+
...
17+
}: let
18+
forAllSystems = f: builtins.mapAttrs f nixpkgs.legacyPackages;
19+
in {
20+
formatter = forAllSystems (system: pkgs: pkgs.alejandra);
21+
22+
packages = forAllSystems (system: pkgs: {
23+
default = zig.packages.${system}.zig_0_15_1.makePackage {
24+
pname = "zls";
25+
version = "0.15.1";
26+
meta.mainProgram = "zls";
27+
src = gitignore.lib.gitignoreSource ./.;
28+
doCheck = true;
29+
zigReleaseMode = "safe";
30+
depsHash = "sha256-ji4qpx3WEEIaW8/Ps5uNJHvMEA+tl6wWj3dZx0RWQpo=";
31+
};
32+
});
33+
};
5634
}

0 commit comments

Comments
 (0)