Skip to content

Commit 200fbd4

Browse files
authored
Merge pull request #421 from 9999years/fix-macos
Fix `nix flake check` on macOS
2 parents 7d47a32 + 5da7bab commit 200fbd4

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

flake.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
};
4949

5050
checks = lib.filterAttrs (k: v: v != null)
51-
(exposed.checks // exposed-stable.checks);
51+
(exposed.checks
52+
// (lib.mapAttrs' (name: value: lib.nameValuePair "stable-${name}" value)
53+
exposed-stable.checks));
5254

5355
lib = { inherit (exposed) run; };
5456
}

modules/hooks.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,14 +1580,15 @@ in
15801580
{
15811581
name = "ansible-lint";
15821582
description = "Ansible linter";
1583+
package = tools.ansible-lint;
15831584
entry =
15841585
let
15851586
cmdArgs =
15861587
mkCmdArgs [
15871588
[ (hooks.ansible-lint.settings.configPath != "") "-c ${hooks.ansible-lint.settings.configPath}" ]
15881589
];
15891590
in
1590-
"${tools.ansible-lint}/bin/ansible-lint ${cmdArgs}";
1591+
"${hooks.ansible-lint.package}/bin/ansible-lint ${cmdArgs}";
15911592
files = if hooks.ansible-lint.settings.subdir != "" then "${hooks.ansible-lint.settings.subdir}/" else "";
15921593
};
15931594
autoflake =

nix/default.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ let
77
overlay =
88
self: pkgs:
99
let
10+
inherit (pkgs) lib;
1011
tools = import ./call-tools.nix pkgs;
1112
run = pkgs.callPackage ./run.nix { inherit pkgs tools isFlakes gitignore-nix-src; };
1213
in
1314
{
1415
inherit tools run;
1516
# Flake style attributes
16-
packages = tools // {
17+
packages = (lib.filterAttrs (_name: value: value != null) tools) // {
1718
inherit (pkgs) pre-commit;
1819
};
1920
checks = self.packages // {
@@ -27,7 +28,7 @@ let
2728
};
2829
all-tools-eval =
2930
let
30-
config = pkgs.lib.evalModules {
31+
config = lib.evalModules {
3132
modules = [
3233
../modules/all-modules.nix
3334
{
@@ -37,7 +38,10 @@ let
3738
specialArgs = { inherit pkgs; };
3839
};
3940
allHooks = config.config.hooks;
40-
allEntryPoints = pkgs.lib.mapAttrsToList (_: v: v.entry) allHooks;
41+
allEntryPoints = lib.pipe allHooks [
42+
(lib.filterAttrs (_name: value: value.package != null))
43+
(lib.mapAttrsToList (_: value: value.entry))
44+
];
4145
in
4246
pkgs.runCommand "all-tools-eval"
4347
{
@@ -47,7 +51,6 @@ let
4751
'';
4852
doc-check =
4953
let
50-
inherit (pkgs) lib;
5154
# We might add that it keeps rendering fast and robust,
5255
# and we want to teach `defaultText` which is more broadly applicable,
5356
# but the message is long enough.
@@ -64,7 +67,7 @@ let
6467
If necessary, you can also find the offending option by evaluating with `--show-trace` and then look for occurrences of `option`.
6568
'';
6669
pkgsStub = lib.mapAttrs failPkgAttr pkgs;
67-
configuration = pkgs.lib.evalModules {
70+
configuration = lib.evalModules {
6871
modules = [
6972
../modules/all-modules.nix
7073
{

nix/headache/default.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
{ stdenv, lib, headache ? null, ocamlPackages }:
1+
{ stdenv, lib, darwin, headache ? null, ocamlPackages }:
22

33
## NOTE: `headache` moved from `ocamlPackages.headache` to top-level on 8 June
44
## 2023. Once this gets into a NixOS release, the following code will be
55
## useless.
6-
let the-headache = if headache != null then headache else ocamlPackages.headache; in
6+
let
7+
the-headache =
8+
(if headache != null then headache else ocamlPackages.headache).overrideAttrs (drv: {
9+
nativeBuildInputs = (drv.nativeBuildInputs or [ ]) ++ lib.optionals stdenv.isDarwin [
10+
darwin.sigtool
11+
];
12+
});
13+
in
714

815
## NOTE: The following derivation seems rather trivial, but it is used here to
916
## get rid of a runtime dependency in the whole OCaml compiler (~420M).

nix/tools.nix

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{ stdenv
2+
, lib
23

34
, actionlint
45
, alejandra
@@ -26,18 +27,14 @@
2627
, elixir
2728
, elmPackages
2829
, fprettify
29-
, git
3030
, git-annex
31-
, gitAndTools
3231
, gptcommit ? null
3332
, hadolint
34-
, haskell
3533
, haskellPackages
3634
, hindent
3735
, hlint
3836
, hpack
3937
, html-tidy
40-
, hunspell
4138
, luaPackages
4239
, lua-language-server
4340
, lychee
@@ -57,7 +54,6 @@
5754
, php82Packages
5855
, ripsecrets ? null
5956
, ruff ? null
60-
, runCommand
6157
, rustfmt
6258
, shellcheck
6359
, bats
@@ -69,15 +65,12 @@
6965
, tagref
7066
, taplo
7167
, texlive
72-
, tflint
7368
, topiary ? null ## Added in nixpkgs on Dec 2, 2022
7469
, treefmt
7570
, typos
7671
, typstfmt
7772
, zprint
7873
, yamllint
79-
, writeScript
80-
, writeText
8174
, go
8275
, go-tools
8376
, golangci-lint
@@ -115,7 +108,6 @@ in
115108
editorconfig-checker
116109
elixir
117110
fprettify
118-
git-annex
119111
go
120112
go-tools
121113
golangci-lint
@@ -132,7 +124,6 @@ in
132124
nil
133125
nixfmt
134126
nixpkgs-fmt
135-
opam
136127
ormolu
137128
pre-commit-hook-ensure-sops
138129
revive
@@ -183,6 +174,9 @@ in
183174
chktex = tex;
184175
commitizen = commitizen.overrideAttrs (_: _: { doCheck = false; });
185176
bats = if bats ? withLibraries then (bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])) else bats;
177+
git-annex = if stdenv.isDarwin then null else git-annex;
178+
# Note: Only broken in stable nixpkgs, works fine on latest master.
179+
opam = if stdenv.isDarwin then null else opam;
186180

187181
## NOTE: `checkmake` 0.2.2 landed in nixpkgs on 12 April 2023. Once this gets
188182
## into a NixOS release, the following code will be useless.

0 commit comments

Comments
 (0)