Last active
June 14, 2021 21:26
-
-
Save tfc/1c9dc7d819a0514ac66fe8e09a1f6fa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
let | |
cfg = config.installHello; | |
in | |
{ | |
options = { | |
installHello.enable = lib.mkEnableOption "Some way to install GNU hello"; | |
}; | |
config = lib.mkIf cfg.enable { | |
environment.systemPackages = [ pkgs.hello ]; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> { }; | |
eval = import <nixpkgs/nixos/lib/eval-config.nix> { | |
system = builtins.currentSystem; | |
modules = [ | |
{ | |
# got this from https://github.com/NixOS/mobile-nixos/blob/3baf77089e7793f9322d7b28710f43ed5f8b886d/doc/_support/options/default.nix#L25-L39 | |
disabledModules = [ | |
<nixpkgs/nixos/modules/services/networking/blockbook-frontend.nix> | |
]; | |
} | |
]; | |
extraModules = [ ./my-module.nix ]; | |
}; | |
optionsDoc = pkgs.nixosOptionsDoc { options = eval.options; }; | |
in | |
optionsDoc.optionsJSON | |
# not using that disabledModules line results in: | |
#$ nix-build options.nix | |
#error: Package ‘blockbook-0.3.4’ in /nix/store/zqnsghhc12321212h5hvsrvclc4g8aci-nixos-21.05.650.eaba7870ffc/nixos/pkgs/servers/blockbook/default.nix:63 is marked as broken, refusing to evaluate. | |
# | |
# a) To temporarily allow broken packages, you can use an environment variable | |
# for a single invocation of the nix tools. | |
# | |
# $ export NIXPKGS_ALLOW_BROKEN=1 | |
# | |
# b) For `nixos-rebuild` you can set | |
# { nixpkgs.config.allowBroken = true; } | |
# in configuration.nix to override this. | |
# | |
# c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add | |
# { allowBroken = true; } | |
# to ~/.config/nixpkgs/config.nix. | |
#(use '--show-trace' to show detailed location information) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment