fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1# Adapted from Nixpkgs. 2 3{ config , lib , pkgs , pkgsPath , ...} : 4 5with lib ; 6 7let 8 9isConfig = x :builtins . isAttrs x || builtins . isFunction x ; 10 11optCall = f :x :if builtins . isFunction f then f x else f ; 12 13mergeConfig = lhs_ :rhs_ : 14let 15lhs = optCall lhs_ { inherit pkgs ; }; 16rhs = optCall rhs_ { inherit pkgs ; }; 17in lhs // rhs // optionalAttrs ( lhs ?packageOverrides ) { 18packageOverrides = pkgs : 19optCall lhs . packageOverrides pkgs 20// optCall ( attrByPath [ "packageOverrides" ] ({ }) rhs ) pkgs ; 21} // optionalAttrs ( lhs ?perlPackageOverrides ) { 22perlPackageOverrides = pkgs : 23optCall lhs . perlPackageOverrides pkgs 24// optCall ( attrByPath [ "perlPackageOverrides" ] ({ }) rhs ) pkgs ; 25}; 26 27configType = mkOptionType { 28name = "nixpkgs-config" ; 29description = "nixpkgs config" ; 30check = x : 31let traceXIfNot = c :if c x then true else lib . traceSeqN 1 x false ; 32in traceXIfNot isConfig ; 33merge = args :fold ( def :mergeConfig def . value ) { }; 34}; 35 36overlayType = mkOptionType { 37name = "nixpkgs-overlay" ; 38description = "nixpkgs overlay" ; 39check = builtins . isFunction ; 40merge = lib . mergeOneOption ; 41}; 42 43_pkgs = import pkgsPath ( filterAttrs ( n :v :v != null ) config . nixpkgs ); 44 45in { 46options . nixpkgs = { 47config = mkOption { 48default = null ; 49example = { allowBroken = true ; }; 50type = types . nullOr configType ; 51description = '' 52The configuration of the Nix Packages collection. (For 53details, see the Nixpkgs documentation.) It allows you to set 54package configuration options. 55 56If `null`, then configuration is taken from 57the fallback location, for example, 58{file}`~/.config/nixpkgs/config.nix`. 59 60Note, this option will not apply outside your Home Manager 61configuration like when installing manually through 62{command}`nix-env`. If you want to apply it both 63inside and outside Home Manager you can put it in a separate 64file and include something like 65 66```nix 67nixpkgs.config = import ./nixpkgs-config.nix; 68xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix; 69``` 70 71in your Home Manager configuration. 72'' ; 73}; 74 75overlays = mkOption { 76default = null ; 77example = literalExpression '' 78[ 79(final: prev: { 80openssh = prev.openssh.override { 81hpnSupport = true; 82withKerberos = true; 83kerberos = final.libkrb5; 84}; 85}) 86] 87'' ; 88type = types . nullOr ( types . listOf overlayType ); 89description = '' 90List of overlays to use with the Nix Packages collection. (For 91details, see the Nixpkgs documentation.) It allows you to 92override packages globally. This is a function that takes as 93an argument the *original* Nixpkgs. The 94first argument should be used for finding dependencies, and 95the second should be used for overriding recipes. 96 97If `null`, then the overlays are taken from 98the fallback location, for example, 99{file}`~/.config/nixpkgs/overlays`. 100 101Like {var}`nixpkgs.config` this option only 102applies within the Home Manager configuration. See 103{var}`nixpkgs.config` for a suggested setup that 104works both internally and externally. 105'' ; 106}; 107 108system = mkOption { 109type = types . str ; 110example = "i686-linux" ; 111internal = true ; 112description = '' 113Specifies the Nix platform type for which the user environment 114should be built. If unset, it defaults to the platform type of 115your host system. Specifying this option is useful when doing 116distributed multi-platform deployment, or when building 117virtual machines. 118'' ; 119}; 120}; 121 122config = { 123_module . args = { 124# We use a no-op override to make sure that the option can be merged without evaluating 125# `_pkgs`, see https://github.com/nix-community/home-manager/pull/993 126pkgs = mkOverride modules . defaultOverridePriority _pkgs ; 127pkgs_i686 = 128if _pkgs . stdenv . isLinux && _pkgs . stdenv . hostPlatform . isx86 then 129_pkgs . pkgsi686Linux 130else 131{ }; 132}; 133}; 134}