mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
e65131e69c
This process was automated by [my fork of `nix-doc-munge`]; thanks to @pennae for writing this tool! It automatically checks that the resulting documentation doesn't change, although my fork loosens this a little to ignore some irrelevant whitespace and typographical differences. As of this commit there is no DocBook remaining in the options documentation. You can play along at home if you want to reproduce this commit: $ NIX_PATH=nixpkgs=flake:nixpkgs/c1bca7fe84c646cfd4ebf3482c0e6317a0b13f22 \ nix shell nixpkgs#coreutils \ -c find . -name '*.nix' \ -exec nix run github:emilazy/nix-doc-munge/0a7190f600027bf7baf6cb7139e4d69ac2f51062 \ {} + [my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge
115 lines
3.2 KiB
Nix
115 lines
3.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
isConfig = x:
|
|
builtins.isAttrs x || lib.isFunction x;
|
|
|
|
optCall = f: x:
|
|
if lib.isFunction f
|
|
then f x
|
|
else f;
|
|
|
|
mergeConfig = lhs_: rhs_:
|
|
let
|
|
lhs = optCall lhs_ { inherit pkgs; };
|
|
rhs = optCall rhs_ { inherit pkgs; };
|
|
in
|
|
lhs // rhs //
|
|
optionalAttrs (lhs ? packageOverrides) {
|
|
packageOverrides = pkgs:
|
|
optCall lhs.packageOverrides pkgs //
|
|
optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs;
|
|
} //
|
|
optionalAttrs (lhs ? perlPackageOverrides) {
|
|
perlPackageOverrides = pkgs:
|
|
optCall lhs.perlPackageOverrides pkgs //
|
|
optCall (attrByPath ["perlPackageOverrides"] ({}) rhs) pkgs;
|
|
};
|
|
|
|
configType = mkOptionType {
|
|
name = "nixpkgs config";
|
|
check = x:
|
|
let traceXIfNot = c:
|
|
if c x then true
|
|
else lib.traceSeqN 1 x false;
|
|
in traceXIfNot isConfig;
|
|
merge = args: fold (def: mergeConfig def.value) {};
|
|
};
|
|
|
|
overlayType = mkOptionType {
|
|
name = "nixpkgs-overlay";
|
|
description = "nixpkgs overlay";
|
|
check = lib.isFunction;
|
|
merge = lib.mergeOneOption;
|
|
};
|
|
in
|
|
|
|
{
|
|
options = {
|
|
nixpkgs.config = mkOption {
|
|
default = {};
|
|
example = literalExpression
|
|
''
|
|
{ firefox.enableGeckoMediaPlayer = true;
|
|
packageOverrides = pkgs: {
|
|
firefox60Pkgs = pkgs.firefox60Pkgs.override {
|
|
enableOfficialBranding = true;
|
|
};
|
|
};
|
|
}
|
|
'';
|
|
type = configType;
|
|
description = lib.mdDoc ''
|
|
The configuration of the Nix Packages collection. (For
|
|
details, see the Nixpkgs documentation.) It allows you to set
|
|
package configuration options, and to override packages
|
|
globally through the {var}`packageOverrides`
|
|
option. The latter is a function that takes as an argument
|
|
the *original* Nixpkgs, and must evaluate
|
|
to a set of new or overridden packages.
|
|
'';
|
|
};
|
|
|
|
nixpkgs.overlays = mkOption {
|
|
type = types.listOf overlayType;
|
|
default = [];
|
|
example = literalExpression ''
|
|
[ (self: super: {
|
|
openssh = super.openssh.override {
|
|
hpnSupport = true;
|
|
withKerberos = true;
|
|
kerberos = self.libkrb5;
|
|
};
|
|
};
|
|
) ]
|
|
'';
|
|
description = lib.mdDoc ''
|
|
List of overlays to use with the Nix Packages collection.
|
|
(For details, see the Nixpkgs documentation.) It allows
|
|
you to override packages globally. This is a function that
|
|
takes as an argument the *original* Nixpkgs.
|
|
The first argument should be used for finding dependencies, and
|
|
the second should be used for overriding recipes.
|
|
'';
|
|
};
|
|
|
|
nixpkgs.system = mkOption {
|
|
type = types.str;
|
|
example = "x86_64-darwin";
|
|
description = lib.mdDoc ''
|
|
Specifies the Nix platform type for which NixOS should be built.
|
|
If unset, it defaults to the platform type of your host system.
|
|
Specifying this option is useful when doing distributed
|
|
multi-platform deployment, or when building virtual machines.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = {
|
|
|
|
# _module.args.pkgs is defined in ../../eval-config.nix
|
|
|
|
};
|
|
}
|