Skip to content

Commit

Permalink
fix(.nix): allowUnsupportedSystem config for nixpkgs
Browse files Browse the repository at this point in the history
On Darwin/MacOS:

```
error: Package ‘libcap-2.48’ in /nix/store/f7h0k1cd902y5v7f5x16pkfm2c02k4lx-source/pkgs/os-specific/linux/libcap/default.nix:59 is not supported on ‘x86_64-darwin’, refusing to evaluate.

a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

b) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.
```
  • Loading branch information
Profpatsch committed Jun 21, 2021
1 parent da47be2 commit 266c620
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ nixpkgs ? ./nix/nixpkgs-stable.nix
, pkgs ? import nixpkgs
, pkgs ? import nixpkgs {
# This is a hack to work around something requiring libcap on MacOS
config.allowUnsupportedSystem = true;
}
}:
let
src = pkgs.nix-gitignore.gitignoreSource [
Expand Down
2 changes: 1 addition & 1 deletion nix/nixpkgs-1909.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ let
sha256 = srcDef.sha256;
};
in
import nixpkgs { overlays = [ (import ./overrides.nix) ]; }
args@{...}: import nixpkgs (args // { overlays = args.overlays or [] ++ [ (import ./overrides.nix) ]; })
2 changes: 1 addition & 1 deletion nix/nixpkgs-stable.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ let
sha256 = srcDef.sha256;
};
in
import nixpkgs { overlays = [ (import ./overrides.nix) ]; }
args@{...}: import nixpkgs (args // { overlays = args.overlays or [] ++ [ (import ./overrides.nix) ]; })
5 changes: 4 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# on CI). Only when this is enabled, Rust nightly is used.
isDevelopmentShell ? true
, nixpkgs ? ./nix/nixpkgs-stable.nix
, pkgs ? import nixpkgs
, pkgs ? import nixpkgs {
# This is a hack to work around something requiring libcap on MacOS
config.allowUnsupportedSystem = true;
}
}:

let
Expand Down

0 comments on commit 266c620

Please sign in to comment.