~/.nixpkgs -> ~/.config/nixpkgs

The former is still respected as a fallback for config.nix for
backwards compatibility (but not for overlays because they're a new
feature).
This commit is contained in:
Eelco Dolstra 2017-02-01 16:03:42 +01:00
parent 7dacca324d
commit 9d6a55aefd
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE
11 changed files with 24 additions and 22 deletions

View File

@ -2,12 +2,12 @@
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-packageconfig"> xml:id="chap-packageconfig">
<title><filename>~/.nixpkgs/config.nix</filename>: global configuration</title> <title>Global configuration</title>
<para>Nix packages can be configured to allow or deny certain options.</para> <para>Nix packages can be configured to allow or deny certain options.</para>
<para>To apply the configuration edit <para>To apply the configuration edit
<filename>~/.nixpkgs/config.nix</filename> and set it like <filename>~/.config/nixpkgs/config.nix</filename> and set it like
<programlisting> <programlisting>
{ {
@ -89,7 +89,7 @@ packages via <literal>packageOverrides</literal></title>
<para>You can define a function called <para>You can define a function called
<varname>packageOverrides</varname> in your local <varname>packageOverrides</varname> in your local
<filename>~/.nixpkgs/config.nix</filename> to overide nix packages. It <filename>~/.config/nixpkgs/config.nix</filename> to overide nix packages. It
must be a function that takes pkgs as an argument and return modified must be a function that takes pkgs as an argument and return modified
set of packages. set of packages.

View File

@ -119,7 +119,7 @@
evaluation-per-function application incurs a performance penalty, evaluation-per-function application incurs a performance penalty,
which can become a problem if many overrides are used. which can become a problem if many overrides are used.
It is only intended for ad-hoc customisation, such as in It is only intended for ad-hoc customisation, such as in
<filename>~/.nixpkgs/config.nix</filename>. <filename>~/.config/nixpkgs/config.nix</filename>.
</para> </para>
</warning> </warning>

View File

@ -195,7 +195,7 @@ its normal core packages:
mtl-2.2.1 mtl-2.2.1
This function allows users to define their own development environment by means This function allows users to define their own development environment by means
of an override. After adding the following snippet to `~/.nixpkgs/config.nix`, of an override. After adding the following snippet to `~/.config/nixpkgs/config.nix`,
{ {
packageOverrides = super: let self = super.pkgs; in packageOverrides = super: let self = super.pkgs; in
@ -522,7 +522,7 @@ file with `cabal2nix`:
$ cd ~/src/foo && cabal2nix . >default.nix $ cd ~/src/foo && cabal2nix . >default.nix
$ cd ~/src/bar && cabal2nix . >default.nix $ cd ~/src/bar && cabal2nix . >default.nix
Then edit your `~/.nixpkgs/config.nix` file to register those builds in the Then edit your `~/.config/nixpkgs/config.nix` file to register those builds in the
default Haskell package set: default Haskell package set:
{ {
@ -554,7 +554,7 @@ Every Haskell package set takes a function called `overrides` that you can use
to manipulate the package as much as you please. One useful application of this to manipulate the package as much as you please. One useful application of this
feature is to replace the default `mkDerivation` function with one that enables feature is to replace the default `mkDerivation` function with one that enables
library profiling for all packages. To accomplish that, add configure the library profiling for all packages. To accomplish that, add configure the
following snippet in your `~/.nixpkgs/config.nix` file: following snippet in your `~/.config/nixpkgs/config.nix` file:
{ {
packageOverrides = super: let self = super.pkgs; in packageOverrides = super: let self = super.pkgs; in
@ -583,7 +583,7 @@ The first step is to generate Nix build instructions with `cabal2nix`:
$ cabal2nix cabal://ghc-events-0.4.3.0 >~/.nixpkgs/ghc-events-0.4.3.0.nix $ cabal2nix cabal://ghc-events-0.4.3.0 >~/.nixpkgs/ghc-events-0.4.3.0.nix
Then add the override in `~/.nixpkgs/config.nix`: Then add the override in `~/.config/nixpkgs/config.nix`:
{ {
packageOverrides = super: let self = super.pkgs; in packageOverrides = super: let self = super.pkgs; in

View File

@ -278,7 +278,7 @@ packageOverrides = pkgs: {
</screen> </screen>
to your Nixpkgs configuration to your Nixpkgs configuration
(<filename>~/.nixpkgs/config.nix</filename>) and install it by (<filename>~/.config/nixpkgs/config.nix</filename>) and install it by
running <command>nix-env -f '&lt;nixpkgs&gt;' -iA running <command>nix-env -f '&lt;nixpkgs&gt;' -iA
myEclipse</command> and afterward run Eclipse as usual. It is myEclipse</command> and afterward run Eclipse as usual. It is
possible to find out which plugins are available for installation possible to find out which plugins are available for installation

View File

@ -15,10 +15,10 @@ rec {
the original derivation attributes. the original derivation attributes.
`overrideDerivation' allows certain "ad-hoc" customisation `overrideDerivation' allows certain "ad-hoc" customisation
scenarios (e.g. in ~/.nixpkgs/config.nix). For instance, if you scenarios (e.g. in ~/.config/nixpkgs/config.nix). For instance,
want to "patch" the derivation returned by a package function in if you want to "patch" the derivation returned by a package
Nixpkgs to build another version than what the function itself function in Nixpkgs to build another version than what the
provides, you can do something like this: function itself provides, you can do something like this:
mySed = overrideDerivation pkgs.gnused (oldAttrs: { mySed = overrideDerivation pkgs.gnused (oldAttrs: {
name = "sed-4.2.2-pre"; name = "sed-4.2.2-pre";

View File

@ -316,10 +316,10 @@ https://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides
<para> <para>
If you are not on NixOS or want to install this particular If you are not on NixOS or want to install this particular
Emacs only for yourself, you can do so by adding it to your Emacs only for yourself, you can do so by adding it to your
<filename>~/.nixpkgs/config.nix</filename> <filename>~/.config/nixpkgs/config.nix</filename>
(see <link xlink:href="http://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides">Nixpkgs manual</link>): (see <link xlink:href="http://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides">Nixpkgs manual</link>):
<example> <example>
<title>Custom Emacs in <filename>~/.nixpkgs/system.nix</filename></title> <title>Custom Emacs in <filename>~/.config/nixpkgs/config.nix</filename></title>
<programlisting><![CDATA[ <programlisting><![CDATA[
{ {
packageOverrides = super: let self = super.pkgs; in { packageOverrides = super: let self = super.pkgs; in {

View File

@ -4,7 +4,7 @@ R packages
## Installation ## Installation
Define an environment for R that contains all the libraries that you'd like to Define an environment for R that contains all the libraries that you'd like to
use by adding the following snippet to your $HOME/.nixpkgs/config.nix file: use by adding the following snippet to your $HOME/.config/nixpkgs/config.nix file:
```nix ```nix
{ {

View File

@ -6,7 +6,7 @@ assert ((config.planetary_annihilation or null).url or null) != null;
assert ((config.planetary_annihilation or null).sha256 or null) != null; assert ((config.planetary_annihilation or null).sha256 or null) != null;
/* to setup: /* to setup:
$ cat ~/.nixpkgs/config.nix $ cat ~/.config/nixpkgs/config.nix
{ {
planetary_annihilation = { planetary_annihilation = {
url = "file:///home/user/PA_Linux_62857.tar.bz2"; url = "file:///home/user/PA_Linux_62857.tar.bz2";

View File

@ -183,7 +183,7 @@ rec {
This adapter can be defined on the defaultStdenv definition. You can This adapter can be defined on the defaultStdenv definition. You can
use it by patching the all-packages.nix file or by using the override use it by patching the all-packages.nix file or by using the override
feature of ~/.nixpkgs/config.nix . feature of ~/.config/nixpkgs/config.nix .
*/ */
validateLicenses = licensePred: stdenv: stdenv // validateLicenses = licensePred: stdenv: stdenv //
{ mkDerivation = args: { mkDerivation = args:

View File

@ -153,7 +153,7 @@ let
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allow${up reason} = true; } { allow${up reason} = true; }
to ~/.nixpkgs/config.nix. to ~/.config/nixpkgs/config.nix.
'')); ''));
# Check if a derivation is valid, that is whether it passes checks for # Check if a derivation is valid, that is whether it passes checks for

View File

@ -17,13 +17,15 @@ in
system ? builtins.currentSystem system ? builtins.currentSystem
, # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or , # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or
# $HOME/.nixpkgs/config.nix. # $HOME/.config/nixpkgs/config.nix.
config ? let config ? let
configFile = getEnv "NIXPKGS_CONFIG"; configFile = getEnv "NIXPKGS_CONFIG";
configFile2 = homeDir + "/.nixpkgs/config.nix"; configFile2 = homeDir + "/.config/nixpkgs/config.nix";
configFile3 = homeDir + "/.nixpkgs/config.nix"; # obsolete
in in
if configFile != "" && pathExists configFile then import configFile if configFile != "" && pathExists configFile then import configFile
else if homeDir != "" && pathExists configFile2 then import configFile2 else if homeDir != "" && pathExists configFile2 then import configFile2
else if homeDir != "" && pathExists configFile3 then import configFile3
else {} else {}
, # Overlays are used to extend Nixpkgs collection with additional , # Overlays are used to extend Nixpkgs collection with additional
@ -31,7 +33,7 @@ in
# fix-point made by Nixpkgs. # fix-point made by Nixpkgs.
overlays ? let overlays ? let
dirPath = try (if pathExists <nixpkgs-overlays> then <nixpkgs-overlays> else "") ""; dirPath = try (if pathExists <nixpkgs-overlays> then <nixpkgs-overlays> else "") "";
dirHome = homeDir + "/.nixpkgs/overlays"; dirHome = homeDir + "/.config/nixpkgs/overlays";
dirCheck = dir: dir != "" && pathExists (dir + "/."); dirCheck = dir: dir != "" && pathExists (dir + "/.");
overlays = dir: overlays = dir:
let content = readDir dir; in let content = readDir dir; in