Skip to content

Commit 549b457

Browse files
authored
Merge pull request #88 from mitchellh/remove-flake-utils
flake: inputs: remove flake-utils
2 parents c5a67f8 + 3040127 commit 549b457

File tree

2 files changed

+58
-66
lines changed

2 files changed

+58
-66
lines changed

flake.lock

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

flake.nix

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
inputs = {
55
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
6-
flake-utils.url = "github:numtide/flake-utils";
6+
systems = {
7+
url = "github:nix-systems/default";
8+
flake = false;
9+
};
710

811
# Used for shell.nix
912
flake-compat = {
@@ -15,59 +18,65 @@
1518
outputs = {
1619
self,
1720
nixpkgs,
18-
flake-utils,
21+
systems,
1922
...
2023
}: let
21-
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
22-
outputs = flake-utils.lib.eachSystem systems (system: let
23-
pkgs = nixpkgs.legacyPackages.${system};
24-
in rec {
25-
# The packages exported by the Flake:
26-
# - default - latest /released/ version
27-
# - <version> - tagged version
28-
# - master - latest nightly (updated daily)
29-
# - master-<date> - nightly by date
30-
packages = import ./default.nix {inherit system pkgs;};
24+
inherit (nixpkgs) lib;
3125

32-
# "Apps" so that `nix run` works. If you run `nix run .` then
33-
# this will use the latest default.
34-
apps = {
35-
default = apps.zig;
36-
zig = flake-utils.lib.mkApp {drv = packages.default;};
37-
};
26+
eachSystem = lib.genAttrs (import systems);
3827

39-
# nix fmt
40-
formatter = pkgs.alejandra;
28+
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system});
29+
in {
30+
# The packages exported by the Flake:
31+
# - default - latest /released/ version
32+
# - <version> - tagged version
33+
# - master - latest nightly (updated daily)
34+
# - master-<date> - nightly by date
35+
packages = lib.mapAttrs (system: pkgs: import ./default.nix {inherit system pkgs;}) pkgsFor;
4136

42-
devShells.default = pkgs.mkShell {
43-
nativeBuildInputs = with pkgs; [
44-
curl
45-
jq
46-
minisign
47-
];
48-
};
37+
# Overlay that can be imported so you can access the packages
38+
# using zigpkgs.master or whatever you'd like.
39+
overlays.default = final: prev: {
40+
zigpkgs = self.packages.${prev.system};
41+
};
4942

50-
# For compatibility with older versions of the `nix` binary
51-
devShell = self.devShells.${pkgs.stdenv.hostPlatform.system}.default;
52-
});
53-
in
54-
outputs
55-
// {
56-
# Overlay that can be imported so you can access the packages
57-
# using zigpkgs.master or whatever you'd like.
58-
overlays.default = final: prev: {
59-
zigpkgs = outputs.packages.${prev.stdenv.hostPlatform.system};
43+
# "Apps" so that `nix run` works. If you run `nix run .` then
44+
# this will use the latest default.
45+
apps = eachSystem (system: {
46+
default = self.apps.${system}.zig;
47+
zig = {
48+
type = "app";
49+
program = self.packages.${system}.default.outPath;
6050
};
51+
});
6152

62-
# Templates for use with nix flake init
63-
templates.compiler-dev = {
64-
path = ./templates/compiler-dev;
65-
description = "A development environment for Zig compiler development.";
66-
};
53+
# nix fmt
54+
formatter = lib.mapAttrs (_: pkgs: pkgs.alejandra) pkgsFor;
6755

68-
templates.init = {
69-
path = ./templates/init;
70-
description = "A basic, empty development environment.";
71-
};
56+
devShells =
57+
lib.mapAttrs (system: pkgs: {
58+
default = pkgs.mkShell {
59+
nativeBuildInputs = with pkgs; [
60+
curl
61+
jq
62+
minisign
63+
];
64+
};
65+
})
66+
pkgsFor;
67+
68+
# For compatibility with older versions of the `nix` binary
69+
devShell = eachSystem (system: self.devShells.${system}.default);
70+
71+
# Templates for use with nix flake init
72+
templates.compiler-dev = {
73+
path = ./templates/compiler-dev;
74+
description = "A development environment for Zig compiler development.";
7275
};
76+
77+
templates.init = {
78+
path = ./templates/init;
79+
description = "A basic, empty development environment.";
80+
};
81+
};
7382
}

0 commit comments

Comments
 (0)