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.

+4 -4
doc/haskell-users-guide.xml
···
</para>
<programlisting>
$ nix-env -qaP coreutils
-
nixos.pkgs.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
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
</programlisting>
<para>
Our current default compiler is GHC 7.10.x and the
···
</para>
<programlisting>
$ nix-env -qaP coreutils
+
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.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.haskellPackages
+
$ nix-env -iA nixos.haskellPackages.cabal-install
</programlisting>
<para>
Our current default compiler is GHC 7.10.x and the
+1 -1
nixos/doc/manual/configuration/ad-hoc-packages.xml
···
Mozilla Thunderbird:
<screen>
-
$ nix-env -iA nixos.pkgs.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
···
Mozilla 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
+2 -2
nixos/doc/manual/configuration/declarative-packages.xml
···
<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
<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</literal> prefix allows distinguishing between
different channels that you might have.)</para>
···
<para>You can get a list of the available packages as follows:
<screen>
$ nix-env -qaP '*' --description
+
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.thunderbird</literal>. (The
<literal>nixos</literal> prefix allows distinguishing between
different channels that you might have.)</para>
+1 -1
nixos/lib/build-vms.nix
···
{ system, minimal ? false }:
-
let pkgs = import ./nixpkgs.nix { config = {}; inherit system; }; in
with pkgs.lib;
with import ../lib/qemu-flags.nix;
···
{ system, minimal ? false }:
+
let pkgs = import ../.. { config = {}; inherit system; }; in
with pkgs.lib;
with import ../lib/qemu-flags.nix;
-6
nixos/lib/channel-expr.nix
···
-
{ system ? builtins.currentSystem }:
-
-
{ pkgs =
-
(import nixpkgs/default.nix { inherit system; })
-
// { recurseForDerivations = true; };
-
}
···
+2 -6
nixos/lib/make-channel.nix
···
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
chmod -R u+w ../$releaseName
-
ln -s nixpkgs/nixos ../$releaseName/nixos
-
echo "$expr" > ../$releaseName/default.nix
NIX_STATE_DIR=$TMPDIR nix-env -f ../$releaseName/default.nix -qaP --meta --xml \* > /dev/null
cd ..
chmod -R u+w $releaseName
···
buildInputs = [ pkgs.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
+
cp -prd . ../$releaseName
chmod -R u+w ../$releaseName
+
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
-8
nixos/lib/nixpkgs.nix
···
-
/* 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’."
···
+8 -9
nixos/modules/installer/cd-dvd/channel.nix
···
# 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.
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
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
'';
in
···
# 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. FIXME: merge
+
# with make-channel.nix.
channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}"
+
{ }
''
+
mkdir -p $out
+
cp -prd ${pkgs.path} $out/nixos
chmod -R u+w $out/nixos
+
ln -s . $out/nixos/nixpkgs
+
rm -rf $out/nixos/.git
+
echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix
'';
in
+1 -1
nixos/modules/installer/tools/nixos-checkout.nix
···
if [ -z "$(type -P git)" ]; then
echo "installing Git..."
-
nix-env -iA nixos.pkgs.git || nix-env -i git
fi
# Move any old nixpkgs directories out of the way.
···
if [ -z "$(type -P git)" ]; then
echo "installing Git..."
+
nix-env -iA nixos.git
fi
# Move any old nixpkgs directories out of the way.
+1 -1
nixos/modules/misc/extra-arguments.nix
···
{
_module.args = {
-
pkgs_i686 = import ../../lib/nixpkgs.nix {
system = "i686-linux";
config.allowUnfree = true;
};
···
{
_module.args = {
+
pkgs_i686 = import ../../.. {
system = "i686-linux";
config.allowUnfree = true;
};
+1 -1
nixos/modules/misc/nixpkgs.nix
···
};
config = {
-
_module.args.pkgs = import ../../lib/nixpkgs.nix {
system = config.nixpkgs.system;
inherit (config.nixpkgs) config;
···
};
config = {
+
_module.args.pkgs = import ../../.. {
system = config.nixpkgs.system;
inherit (config.nixpkgs) config;
+1 -1
nixos/tests/containers.nix
···
$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");
# Create some containers imperatively.
my $id1 = $machine->succeed("nixos-container create foo --ensure-unique-name");
···
$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.hello >&2");
# Create some containers imperatively.
my $id1 = $machine->succeed("nixos-container create foo --ensure-unique-name");