Skip to content

Commit

Permalink
Unify NixOS and Nixpkgs channel structure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edolstra committed Aug 5, 2015
1 parent 91e7172 commit 2cd7c1f
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 41 deletions.
8 changes: 4 additions & 4 deletions doc/haskell-users-guide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nixos/doc/manual/configuration/ad-hoc-packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions nixos/doc/manual/configuration/declarative-packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion nixos/lib/build-vms.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 0 additions & 6 deletions nixos/lib/channel-expr.nix

This file was deleted.

8 changes: 2 additions & 6 deletions nixos/lib/make-channel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions nixos/lib/nixpkgs.nix

This file was deleted.

17 changes: 8 additions & 9 deletions nixos/modules/installer/cd-dvd/channel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/installer/tools/nixos-checkout.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/misc/extra-arguments.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
_module.args = {
pkgs_i686 = import ../../lib/nixpkgs.nix {
pkgs_i686 = import ../../.. {
system = "i686-linux";
config.allowUnfree = true;
};
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/misc/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nixos/tests/containers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

6 comments on commit 2cd7c1f

@vcunat
Copy link
Member

@vcunat vcunat commented on 2cd7c1f Aug 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we mention this change in the release notes? nixos/doc/manual/release-notes/rl-unstable.xml

@edolstra
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vcunat Well, it's not an incompatible change.

@vcunat
Copy link
Member

@vcunat vcunat commented on 2cd7c1f Aug 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, well it's more of a "new feature", no big deal.

@jagajaga
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for mentioning.

@vcunat
Copy link
Member

@vcunat vcunat commented on 2cd7c1f Aug 6, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, currently I don't see a suitable place in the notes. In general, we might create such a section at the end for "mentioning" or linking to such minor enhancements.

@vcunat
Copy link
Member

@vcunat vcunat commented on 2cd7c1f Aug 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned in a new section at the end f4dc055.

Please sign in to comment.