From 8a78dcc00ff87dc985ad15305b0ebd6739863827 Mon Sep 17 00:00:00 2001 From: Sebastian Jordan Date: Mon, 20 Apr 2015 17:54:39 +0200 Subject: [PATCH 1/3] Document about packageOverrides --- doc/packageconfig.xml | 124 +++++++++++++++++++++++++++--------------- 1 file changed, 79 insertions(+), 45 deletions(-) diff --git a/doc/packageconfig.xml b/doc/packageconfig.xml index b5e57df71ff..cebbd5bf772 100644 --- a/doc/packageconfig.xml +++ b/doc/packageconfig.xml @@ -1,70 +1,104 @@ + xmlns:xlink="http://www.w3.org/1999/xlink" + xml:id="chap-packageconfig"> <filename>~/.nixpkgs/config.nix</filename>: global configuration +
Allow unfree software + Nix packages can be configured to allow or deny certain options. - To apply the configuration edit ~/.nixpkgs/config.nix - and set it like + To apply the configuration edit ~/.nixpkgs/config.nix + and set it like { allowUnfree = true; } - and will allow the Nix package manager to install unfree licensed packages. + and will allow the Nix package manager to install unfree licensed packages. - The configuration as listed also applies to NixOS under set. + The configuration as listed also applies to NixOS under set. - - - Allow installing of packages that are distributed under unfree license by setting - allowUnfree = true; - or deny them by setting it to false. - - - Same can be achieved by setting the environment variable: - $ export NIXPKGS_ALLOW_UNFREE=1 - - + + + Allow installing of packages that are distributed under unfree license by setting + allowUnfree = true; + or deny them by setting it to false. + + + Same can be achieved by setting the environment variable: + $ export NIXPKGS_ALLOW_UNFREE=1 + + - - - Whenever unfree packages are not allowed, single packages can - still be allowed by a predicate function that accepts package - as an argument and should return a boolean: - allowUnfreePredicate = (pkg: ...); + + + Whenever unfree packages are not allowed, single packages can + still be allowed by a predicate function that accepts package + as an argument and should return a boolean: + allowUnfreePredicate = (pkg: ...); - Example to allow flash player only: - allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name); - - + Example to allow flash player only: + allowUnfreePredicate = (pkg: pkgs.lib.hasPrefix "flashplayer-" pkg.name); + + - - - Whenever unfree packages are not allowed, packages can still be - whitelisted by their license: - whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ]; - - + + + Whenever unfree packages are not allowed, packages can still be + whitelisted by their license: + whitelistedLicenses = with stdenv.lib.licenses; [ amd wtfpl ]; + + - - - In addition to whitelisting licenses which are denied by the - allowUnfree setting, you can also explicitely - deny installation of packages which have a certain license: - blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ]; - - + + + In addition to whitelisting licenses which are denied by the + allowUnfree setting, you can also explicitely + deny installation of packages which have a certain license: + blacklistedLicenses = with stdenv.lib.licenses; [ agpl3 gpl3 ]; + + - A complete list of licenses can be found in the file - lib/licenses.nix of the nix package tree. + A complete list of licenses can be found in the file + lib/licenses.nix of the nix package tree. +
-
\ No newline at end of file +
Overriding existing packages + + + ~/.nixpkgs/config.nix enables the user to + override package names without creating a fork of the Nixpkgs. + This is accomplished by defining a function called + packageOverrides. It takes the set of + packages, usually called pkgs, and returns a + modified set of packages. + + + Here is an example. Say we want to install + xbmc but we want to use another Python + version when running xbmc. + + +packageOverrides = pkgs: rec { + xbmc = pkgs.xbmc.override { + python = pkgs.python26; + }; +}; + + + Further information is available at the Nix + wiki + + + +
+ + From 20dadec2642c9b449dffd26aac50687ffeaef243 Mon Sep 17 00:00:00 2001 From: Sebastian Jordan Date: Mon, 20 Apr 2015 22:48:28 +0200 Subject: [PATCH 2/3] Reduce verbosity of packageOverrides description. --- doc/packageconfig.xml | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/doc/packageconfig.xml b/doc/packageconfig.xml index cebbd5bf772..ec65fea6cc4 100644 --- a/doc/packageconfig.xml +++ b/doc/packageconfig.xml @@ -4,8 +4,6 @@ <filename>~/.nixpkgs/config.nix</filename>: global configuration -
Allow unfree software - Nix packages can be configured to allow or deny certain options. @@ -68,37 +66,18 @@ A complete list of licenses can be found in the file lib/licenses.nix of the nix package tree. -
-
Overriding existing packages +
Modify packages via<literal>packageOverrides</literal> ~/.nixpkgs/config.nix enables the user to - override package names without creating a fork of the Nixpkgs. - This is accomplished by defining a function called - packageOverrides. It takes the set of - packages, usually called pkgs, and returns a - modified set of packages. + override package names without creating a fork of Nixpkgs. This is + accomplished by defining a function called + packageOverrides. It is expected to take the set + of packages, usually called pkgs, and returns a + modified set of packages. It is called when evaluating any nix + expression in the pkgs set. - - Here is an example. Say we want to install - xbmc but we want to use another Python - version when running xbmc. - - -packageOverrides = pkgs: rec { - xbmc = pkgs.xbmc.override { - python = pkgs.python26; - }; -}; - - - Further information is available at the Nix - wiki - - -
From 018062529aca9b83a6b03db163d121a8bd25ce01 Mon Sep 17 00:00:00 2001 From: Sebastian Jordan Date: Mon, 20 Apr 2015 23:09:45 +0200 Subject: [PATCH 3/3] Reduce verbosity of packageOverride docs further --- doc/packageconfig.xml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/packageconfig.xml b/doc/packageconfig.xml index ec65fea6cc4..44ce1974c6c 100644 --- a/doc/packageconfig.xml +++ b/doc/packageconfig.xml @@ -67,16 +67,20 @@ lib/licenses.nix of the nix package tree. -
Modify packages via<literal>packageOverrides</literal> +
Modify packages via <literal>packageOverrides</literal> - ~/.nixpkgs/config.nix enables the user to - override package names without creating a fork of Nixpkgs. This is - accomplished by defining a function called - packageOverrides. It is expected to take the set - of packages, usually called pkgs, and returns a - modified set of packages. It is called when evaluating any nix - expression in the pkgs set. + + You can define a function called packageOverrides + in your local ~/.nixpkgs/config to overide nix + packages. It must be a function that takes pkgs as an argument and + return modified set of packages. + + { + packageOverrides = pkgs: rec { + foo = pkgs.foo.override { ... }; + }; +}