summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-08-05 17:29:08 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-08-05 17:37:11 +0200
commit2cd7c1f19888ae73bf7ef0f41a45680cfb86334a (patch)
tree1d153e8744e4fb693b78f5a7c1ac445201b610a2
parent91e71725d49c185401f459f58062b02bcbf1651e (diff)
downloadnixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.tar
nixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.tar.gz
nixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.tar.bz2
nixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.tar.lz
nixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.tar.xz
nixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.tar.zst
nixpkgs-2cd7c1f19888ae73bf7ef0f41a45680cfb86334a.zip
Unify NixOS and Nixpkgs channel structure
This is primarily to ensure that

  -I nixpkgs=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz

and

  -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz

and

  -I nixpkgs=https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz

behave consistently.

It also allows installing packages via "nix-env -iA nixos.<pkg>"
rather than "nixos.pkgs.<pkg>". It would be even better to allow
"nixpkgs.<pkg>", but that requires a change to nix-channel.

Fixes #7659.
-rw-r--r--doc/haskell-users-guide.xml8
-rw-r--r--nixos/doc/manual/configuration/ad-hoc-packages.xml2
-rw-r--r--nixos/doc/manual/configuration/declarative-packages.xml4
-rw-r--r--nixos/lib/build-vms.nix2
-rw-r--r--nixos/lib/channel-expr.nix6
-rw-r--r--nixos/lib/make-channel.nix8
-rw-r--r--nixos/lib/nixpkgs.nix8
-rw-r--r--nixos/modules/installer/cd-dvd/channel.nix17
-rw-r--r--nixos/modules/installer/tools/nixos-checkout.nix2
-rw-r--r--nixos/modules/misc/extra-arguments.nix2
-rw-r--r--nixos/modules/misc/nixpkgs.nix2
-rw-r--r--nixos/tests/containers.nix2
12 files changed, 22 insertions, 41 deletions
diff --git a/doc/haskell-users-guide.xml b/doc/haskell-users-guide.xml
index e3903ddd411..e0dc89cc7ce 100644
--- a/doc/haskell-users-guide.xml
+++ b/doc/haskell-users-guide.xml
@@ -92,18 +92,18 @@ error: attribute ‘haskellPackages’ in selection path
   </para>
   <programlisting>
 $ nix-env -qaP coreutils
-nixos.pkgs.coreutils  coreutils-8.23
+nixos.coreutils  coreutils-8.23
 </programlisting>
   <para>
     If your system responds like that (most NixOS installatios will),
     then the attribute path to <literal>haskellPackages</literal> is
-    <literal>nixos.pkgs.haskellPackages</literal>. Thus, if you want to
+    <literal>nixos.haskellPackages</literal>. Thus, if you want to
     use <literal>nix-env</literal> without giving an explicit
     <literal>-f</literal> flag, then that's the way to do it:
   </para>
   <programlisting>
-$ nix-env -qaP -A nixos.pkgs.haskellPackages
-$ nix-env -iA nixos.pkgs.haskellPackages.cabal-install
+$ nix-env -qaP -A nixos.haskellPackages
+$ nix-env -iA nixos.haskellPackages.cabal-install
 </programlisting>
   <para>
     Our current default compiler is GHC 7.10.x and the
diff --git a/nixos/doc/manual/configuration/ad-hoc-packages.xml b/nixos/doc/manual/configuration/ad-hoc-packages.xml
index e237e20c4ff..a147291c4f3 100644
--- a/nixos/doc/manual/configuration/ad-hoc-packages.xml
+++ b/nixos/doc/manual/configuration/ad-hoc-packages.xml
@@ -11,7 +11,7 @@ uninstall packages from the command line.  For instance, to install
 Mozilla Thunderbird:
 
 <screen>
-$ nix-env -iA nixos.pkgs.thunderbird</screen>
+$ nix-env -iA nixos.thunderbird</screen>
 
 If you invoke this as root, the package is installed in the Nix
 profile <filename>/nix/var/nix/profiles/default</filename> and visible
diff --git a/nixos/doc/manual/configuration/declarative-packages.xml b/nixos/doc/manual/configuration/declarative-packages.xml
index 6de38b452e2..dc2fa715097 100644
--- a/nixos/doc/manual/configuration/declarative-packages.xml
+++ b/nixos/doc/manual/configuration/declarative-packages.xml
@@ -23,13 +23,13 @@ Nixpkgs will be built or downloaded as part of the system when you run
 <para>You can get a list of the available packages as follows:
 <screen>
 $ nix-env -qaP '*' --description
-nixos.pkgs.firefox   firefox-23.0   Mozilla Firefox - the browser, reloaded
+nixos.firefox   firefox-23.0   Mozilla Firefox - the browser, reloaded
 <replaceable>...</replaceable>
 </screen>
 
 The first column in the output is the <emphasis>attribute
 name</emphasis>, such as
-<literal>nixos.pkgs.thunderbird</literal>. (The
+<literal>nixos.thunderbird</literal>. (The
 <literal>nixos</literal> prefix allows distinguishing between
 different channels that you might have.)</para>
 
diff --git a/nixos/lib/build-vms.nix b/nixos/lib/build-vms.nix
index 01d6b21bba9..a97bae57d9b 100644
--- a/nixos/lib/build-vms.nix
+++ b/nixos/lib/build-vms.nix
@@ -1,6 +1,6 @@
 { system, minimal ? false }:
 
-let pkgs = import ./nixpkgs.nix { config = {}; inherit system; }; in
+let pkgs = import ../.. { config = {}; inherit system; }; in
 
 with pkgs.lib;
 with import ../lib/qemu-flags.nix;
diff --git a/nixos/lib/channel-expr.nix b/nixos/lib/channel-expr.nix
deleted file mode 100644
index 453bdd506b8..00000000000
--- a/nixos/lib/channel-expr.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ system ? builtins.currentSystem }:
-
-{ pkgs =
-    (import nixpkgs/default.nix { inherit system; })
-    // { recurseForDerivations = true; };
-}
diff --git a/nixos/lib/make-channel.nix b/nixos/lib/make-channel.nix
index 1c6bf0897f4..fd805f7f943 100644
--- a/nixos/lib/make-channel.nix
+++ b/nixos/lib/make-channel.nix
@@ -10,19 +10,15 @@ pkgs.releaseTools.makeSourceTarball {
 
   buildInputs = [ pkgs.nix ];
 
-  expr = builtins.readFile ./channel-expr.nix;
-
   distPhase = ''
     rm -rf .git
     echo -n $VERSION_SUFFIX > .version-suffix
     echo -n ${nixpkgs.rev or nixpkgs.shortRev} > .git-revision
     releaseName=nixos-$VERSION$VERSION_SUFFIX
     mkdir -p $out/tarballs
-    mkdir ../$releaseName
-    cp -prd . ../$releaseName/nixpkgs
+    cp -prd . ../$releaseName
     chmod -R u+w ../$releaseName
-    ln -s nixpkgs/nixos ../$releaseName/nixos
-    echo "$expr" > ../$releaseName/default.nix
+    ln -s . ../$releaseName/nixpkgs # hack to make ‘<nixpkgs>’ work
     NIX_STATE_DIR=$TMPDIR nix-env -f ../$releaseName/default.nix -qaP --meta --xml \* > /dev/null
     cd ..
     chmod -R u+w $releaseName
diff --git a/nixos/lib/nixpkgs.nix b/nixos/lib/nixpkgs.nix
deleted file mode 100644
index 10096f58c79..00000000000
--- a/nixos/lib/nixpkgs.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Terrible backward compatibility hack to get the path to Nixpkgs
-   from here.  Usually, that's the relative path ‘../..’.  However,
-   when using the NixOS channel, <nixos> resolves to a symlink to
-   nixpkgs/nixos, so ‘../..’ doesn't resolve to the top-level Nixpkgs
-   directory but one above it.  So check for that situation. */
-if builtins.pathExists ../../.version then import ../..
-else if builtins.pathExists ../../nixpkgs then import ../../nixpkgs
-else abort "Can't find Nixpkgs, please set ‘NIX_PATH=nixpkgs=/path/to/nixpkgs’."
diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix
index ca0e233f9e3..eccb19da5cb 100644
--- a/nixos/modules/installer/cd-dvd/channel.nix
+++ b/nixos/modules/installer/cd-dvd/channel.nix
@@ -9,18 +9,17 @@ let
 
   # We need a copy of the Nix expressions for Nixpkgs and NixOS on the
   # CD.  These are installed into the "nixos" channel of the root
-  # user, as expected by nixos-rebuild/nixos-install.
+  # user, as expected by nixos-rebuild/nixos-install. FIXME: merge
+  # with make-channel.nix.
   channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}"
-    { expr = readFile ../../../lib/channel-expr.nix; }
+    { }
     ''
-      mkdir -p $out/nixos
-      cp -prd ${pkgs.path} $out/nixos/nixpkgs
-      ln -s nixpkgs/nixos $out/nixos/nixos
+      mkdir -p $out
+      cp -prd ${pkgs.path} $out/nixos
       chmod -R u+w $out/nixos
-      rm -rf $out/nixos/nixpkgs/.git
-      echo -n ${config.system.nixosVersion} > $out/nixos/nixpkgs/.version
-      echo -n "" > $out/nixos/nixpkgs/.version-suffix
-      echo "$expr" > $out/nixos/default.nix
+      ln -s . $out/nixos/nixpkgs
+      rm -rf $out/nixos/.git
+      echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix
     '';
 
 in
diff --git a/nixos/modules/installer/tools/nixos-checkout.nix b/nixos/modules/installer/tools/nixos-checkout.nix
index 9cdd8a74a18..07274e139f7 100644
--- a/nixos/modules/installer/tools/nixos-checkout.nix
+++ b/nixos/modules/installer/tools/nixos-checkout.nix
@@ -27,7 +27,7 @@ let
 
         if [ -z "$(type -P git)" ]; then
             echo "installing Git..."
-            nix-env -iA nixos.pkgs.git || nix-env -i git
+            nix-env -iA nixos.git
         fi
 
         # Move any old nixpkgs directories out of the way.
diff --git a/nixos/modules/misc/extra-arguments.nix b/nixos/modules/misc/extra-arguments.nix
index ff2ff7cd432..02ac6e7a59d 100644
--- a/nixos/modules/misc/extra-arguments.nix
+++ b/nixos/modules/misc/extra-arguments.nix
@@ -2,7 +2,7 @@
 
 {
   _module.args = {
-    pkgs_i686 = import ../../lib/nixpkgs.nix {
+    pkgs_i686 = import ../../.. {
       system = "i686-linux";
       config.allowUnfree = true;
     };
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index fb5516c953c..5eb38c510b4 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -72,7 +72,7 @@ in
   };
 
   config = {
-    _module.args.pkgs = import ../../lib/nixpkgs.nix {
+    _module.args.pkgs = import ../../.. {
       system = config.nixpkgs.system;
 
       inherit (config.nixpkgs) config;
diff --git a/nixos/tests/containers.nix b/nixos/tests/containers.nix
index c429f9c7b71..ce36a7e0588 100644
--- a/nixos/tests/containers.nix
+++ b/nixos/tests/containers.nix
@@ -46,7 +46,7 @@ import ./make-test.nix ({ pkgs, ...} : {
       $machine->fail("curl --fail --connect-timeout 2 http://$ip/ > /dev/null");
 
       # Make sure we have a NixOS tree (required by ‘nixos-container create’).
-      $machine->succeed("PAGER=cat nix-env -qa -A nixos.pkgs.hello >&2");
+      $machine->succeed("PAGER=cat nix-env -qa -A nixos.hello >&2");
 
       # Create some containers imperatively.
       my $id1 = $machine->succeed("nixos-container create foo --ensure-unique-name");