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.
This commit is contained in:
parent
91e71725d4
commit
2cd7c1f198
|
@ -92,18 +92,18 @@ error: attribute ‘haskellPackages’ in selection path
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
$ nix-env -qaP coreutils
|
$ nix-env -qaP coreutils
|
||||||
nixos.pkgs.coreutils coreutils-8.23
|
nixos.coreutils coreutils-8.23
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
If your system responds like that (most NixOS installatios will),
|
If your system responds like that (most NixOS installatios will),
|
||||||
then the attribute path to <literal>haskellPackages</literal> is
|
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
|
use <literal>nix-env</literal> without giving an explicit
|
||||||
<literal>-f</literal> flag, then that's the way to do it:
|
<literal>-f</literal> flag, then that's the way to do it:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
$ nix-env -qaP -A nixos.pkgs.haskellPackages
|
$ nix-env -qaP -A nixos.haskellPackages
|
||||||
$ nix-env -iA nixos.pkgs.haskellPackages.cabal-install
|
$ nix-env -iA nixos.haskellPackages.cabal-install
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Our current default compiler is GHC 7.10.x and the
|
Our current default compiler is GHC 7.10.x and the
|
||||||
|
|
|
@ -11,7 +11,7 @@ uninstall packages from the command line. For instance, to install
|
||||||
Mozilla Thunderbird:
|
Mozilla Thunderbird:
|
||||||
|
|
||||||
<screen>
|
<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
|
If you invoke this as root, the package is installed in the Nix
|
||||||
profile <filename>/nix/var/nix/profiles/default</filename> and visible
|
profile <filename>/nix/var/nix/profiles/default</filename> and visible
|
||||||
|
|
|
@ -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:
|
<para>You can get a list of the available packages as follows:
|
||||||
<screen>
|
<screen>
|
||||||
$ nix-env -qaP '*' --description
|
$ 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>
|
<replaceable>...</replaceable>
|
||||||
</screen>
|
</screen>
|
||||||
|
|
||||||
The first column in the output is the <emphasis>attribute
|
The first column in the output is the <emphasis>attribute
|
||||||
name</emphasis>, such as
|
name</emphasis>, such as
|
||||||
<literal>nixos.pkgs.thunderbird</literal>. (The
|
<literal>nixos.thunderbird</literal>. (The
|
||||||
<literal>nixos</literal> prefix allows distinguishing between
|
<literal>nixos</literal> prefix allows distinguishing between
|
||||||
different channels that you might have.)</para>
|
different channels that you might have.)</para>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ system, minimal ? false }:
|
{ system, minimal ? false }:
|
||||||
|
|
||||||
let pkgs = import ./nixpkgs.nix { config = {}; inherit system; }; in
|
let pkgs = import ../.. { config = {}; inherit system; }; in
|
||||||
|
|
||||||
with pkgs.lib;
|
with pkgs.lib;
|
||||||
with import ../lib/qemu-flags.nix;
|
with import ../lib/qemu-flags.nix;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{ system ? builtins.currentSystem }:
|
|
||||||
|
|
||||||
{ pkgs =
|
|
||||||
(import nixpkgs/default.nix { inherit system; })
|
|
||||||
// { recurseForDerivations = true; };
|
|
||||||
}
|
|
|
@ -10,19 +10,15 @@ pkgs.releaseTools.makeSourceTarball {
|
||||||
|
|
||||||
buildInputs = [ pkgs.nix ];
|
buildInputs = [ pkgs.nix ];
|
||||||
|
|
||||||
expr = builtins.readFile ./channel-expr.nix;
|
|
||||||
|
|
||||||
distPhase = ''
|
distPhase = ''
|
||||||
rm -rf .git
|
rm -rf .git
|
||||||
echo -n $VERSION_SUFFIX > .version-suffix
|
echo -n $VERSION_SUFFIX > .version-suffix
|
||||||
echo -n ${nixpkgs.rev or nixpkgs.shortRev} > .git-revision
|
echo -n ${nixpkgs.rev or nixpkgs.shortRev} > .git-revision
|
||||||
releaseName=nixos-$VERSION$VERSION_SUFFIX
|
releaseName=nixos-$VERSION$VERSION_SUFFIX
|
||||||
mkdir -p $out/tarballs
|
mkdir -p $out/tarballs
|
||||||
mkdir ../$releaseName
|
cp -prd . ../$releaseName
|
||||||
cp -prd . ../$releaseName/nixpkgs
|
|
||||||
chmod -R u+w ../$releaseName
|
chmod -R u+w ../$releaseName
|
||||||
ln -s nixpkgs/nixos ../$releaseName/nixos
|
ln -s . ../$releaseName/nixpkgs # hack to make ‘<nixpkgs>’ work
|
||||||
echo "$expr" > ../$releaseName/default.nix
|
|
||||||
NIX_STATE_DIR=$TMPDIR nix-env -f ../$releaseName/default.nix -qaP --meta --xml \* > /dev/null
|
NIX_STATE_DIR=$TMPDIR nix-env -f ../$releaseName/default.nix -qaP --meta --xml \* > /dev/null
|
||||||
cd ..
|
cd ..
|
||||||
chmod -R u+w $releaseName
|
chmod -R u+w $releaseName
|
||||||
|
|
|
@ -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’."
|
|
|
@ -9,18 +9,17 @@ let
|
||||||
|
|
||||||
# We need a copy of the Nix expressions for Nixpkgs and NixOS on the
|
# 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
|
# 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}"
|
channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}"
|
||||||
{ expr = readFile ../../../lib/channel-expr.nix; }
|
{ }
|
||||||
''
|
''
|
||||||
mkdir -p $out/nixos
|
mkdir -p $out
|
||||||
cp -prd ${pkgs.path} $out/nixos/nixpkgs
|
cp -prd ${pkgs.path} $out/nixos
|
||||||
ln -s nixpkgs/nixos $out/nixos/nixos
|
|
||||||
chmod -R u+w $out/nixos
|
chmod -R u+w $out/nixos
|
||||||
rm -rf $out/nixos/nixpkgs/.git
|
ln -s . $out/nixos/nixpkgs
|
||||||
echo -n ${config.system.nixosVersion} > $out/nixos/nixpkgs/.version
|
rm -rf $out/nixos/.git
|
||||||
echo -n "" > $out/nixos/nixpkgs/.version-suffix
|
echo -n ${config.system.nixosVersionSuffix} > $out/nixos/.version-suffix
|
||||||
echo "$expr" > $out/nixos/default.nix
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
|
@ -27,7 +27,7 @@ let
|
||||||
|
|
||||||
if [ -z "$(type -P git)" ]; then
|
if [ -z "$(type -P git)" ]; then
|
||||||
echo "installing Git..."
|
echo "installing Git..."
|
||||||
nix-env -iA nixos.pkgs.git || nix-env -i git
|
nix-env -iA nixos.git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Move any old nixpkgs directories out of the way.
|
# Move any old nixpkgs directories out of the way.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
_module.args = {
|
_module.args = {
|
||||||
pkgs_i686 = import ../../lib/nixpkgs.nix {
|
pkgs_i686 = import ../../.. {
|
||||||
system = "i686-linux";
|
system = "i686-linux";
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,7 +72,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
_module.args.pkgs = import ../../lib/nixpkgs.nix {
|
_module.args.pkgs = import ../../.. {
|
||||||
system = config.nixpkgs.system;
|
system = config.nixpkgs.system;
|
||||||
|
|
||||||
inherit (config.nixpkgs) config;
|
inherit (config.nixpkgs) config;
|
||||||
|
|
|
@ -46,7 +46,7 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||||
$machine->fail("curl --fail --connect-timeout 2 http://$ip/ > /dev/null");
|
$machine->fail("curl --fail --connect-timeout 2 http://$ip/ > /dev/null");
|
||||||
|
|
||||||
# Make sure we have a NixOS tree (required by ‘nixos-container create’).
|
# 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.
|
# Create some containers imperatively.
|
||||||
my $id1 = $machine->succeed("nixos-container create foo --ensure-unique-name");
|
my $id1 = $machine->succeed("nixos-container create foo --ensure-unique-name");
|
||||||
|
|
Loading…
Reference in a new issue