Update the release expressions and the channel generators

This commit is contained in:
Eelco Dolstra 2013-10-01 15:48:39 +02:00
parent 041da5a6f9
commit 31203732b3
8 changed files with 39 additions and 63 deletions

View File

@ -1,12 +1,11 @@
{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config> { configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
, system ? builtins.currentSystem , system ? builtins.currentSystem
, nixpkgs ? <nixpkgs>
}: }:
let let
eval = import ./lib/eval-config.nix { eval = import ./lib/eval-config.nix {
inherit system nixpkgs; inherit system;
modules = [ configuration ]; modules = [ configuration ];
}; };
@ -14,13 +13,13 @@ let
# This is for `nixos-rebuild build-vm'. # This is for `nixos-rebuild build-vm'.
vmConfig = (import ./lib/eval-config.nix { vmConfig = (import ./lib/eval-config.nix {
inherit system nixpkgs; inherit system;
modules = [ configuration ./modules/virtualisation/qemu-vm.nix ]; modules = [ configuration ./modules/virtualisation/qemu-vm.nix ];
}).config; }).config;
# This is for `nixos-rebuild build-vm-with-bootloader'. # This is for `nixos-rebuild build-vm-with-bootloader'.
vmWithBootLoaderConfig = (import ./lib/eval-config.nix { vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
inherit system nixpkgs; inherit system;
modules = modules =
[ configuration [ configuration
./modules/virtualisation/qemu-vm.nix ./modules/virtualisation/qemu-vm.nix

View File

@ -1,6 +1,6 @@
{ system, minimal ? false }: { system, minimal ? false }:
let pkgs = import <nixpkgs> { 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;

View File

@ -7,7 +7,6 @@
, baseModules ? import ../modules/module-list.nix , baseModules ? import ../modules/module-list.nix
, extraArgs ? {} , extraArgs ? {}
, modules , modules
, nixpkgs ? <nixpkgs>
}: }:
let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in
@ -31,7 +30,7 @@ rec {
extraArgs = extraArgs_ // { extraArgs = extraArgs_ // {
inherit pkgs modules baseModules; inherit pkgs modules baseModules;
modulesPath = ../modules; modulesPath = ../modules;
pkgs_i686 = import nixpkgs { system = "i686-linux"; }; pkgs_i686 = import ../.. { system = "i686-linux"; };
utils = import ./utils.nix pkgs; utils = import ./utils.nix pkgs;
}; };
@ -48,7 +47,7 @@ rec {
pkgs = pkgs =
if pkgs_ != null if pkgs_ != null
then pkgs_ then pkgs_
else import nixpkgs ( else import ../.. (
let let
system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_; system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_;
nixpkgsOptions = (import ./eval-config.nix { nixpkgsOptions = (import ./eval-config.nix {
@ -56,7 +55,7 @@ rec {
# For efficiency, leave out most NixOS modules; they don't # For efficiency, leave out most NixOS modules; they don't
# define nixpkgs.config, so it's pointless to evaluate them. # define nixpkgs.config, so it's pointless to evaluate them.
baseModules = [ ../modules/misc/nixpkgs.nix ]; baseModules = [ ../modules/misc/nixpkgs.nix ];
pkgs = import nixpkgs { system = system_; config = {}; }; pkgs = import ../.. { system = system_; config = {}; };
}).optionDefinitions.nixpkgs; }).optionDefinitions.nixpkgs;
in in
{ {

View File

@ -14,11 +14,15 @@ let
{ expr = builtins.readFile ../../../lib/channel-expr.nix; } { expr = builtins.readFile ../../../lib/channel-expr.nix; }
'' ''
mkdir -p $out/nixos mkdir -p $out/nixos
cp -prd ${cleanSource ../../..} $out/nixos/nixos # FIXME: should use ../../../.. instead of <nixpkgs>, but that
cp -prd ${cleanSource <nixpkgs>} $out/nixos/nixpkgs # doesn't work properly if <nixos> is a symlink to
chmod -R u+w $out/nixos/nixos # nixpkgs/nixos.
echo -n ${config.system.nixosVersion} > $out/nixos/nixos/.version cp -prd ${<nixpkgs>} $out/nixos/nixpkgs
echo -n "" > $out/nixos/nixos/.version-suffix 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 echo "$expr" > $out/nixos/default.nix
''; '';

View File

@ -57,7 +57,7 @@ fi
# Mount some stuff in the target root directory. We bind-mount /etc # Mount some stuff in the target root directory. We bind-mount /etc
# into the chroot because we need networking and the nixbld user # into the chroot because we need networking and the nixbld user
# accounts in /etc/passwd. But we do need the target's /etc/nixos. # accounts in /etc/passwd. But we do need the target's /etc/nixos.
mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixos $mountPoint/mnt-nixpkgs $mountPoint/etc /etc/nixos mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixpkgs $mountPoint/etc /etc/nixos
mount --make-private / # systemd makes / shared, which is annoying mount --make-private / # systemd makes / shared, which is annoying
mount --bind / $mountPoint/mnt mount --bind / $mountPoint/mnt
mount --bind /nix $mountPoint/mnt/nix mount --bind /nix $mountPoint/mnt/nix
@ -76,7 +76,6 @@ cleanup() {
mountpoint -q $mountPoint/etc/nixos && umount $mountPoint/etc/nixos mountpoint -q $mountPoint/etc/nixos && umount $mountPoint/etc/nixos
mountpoint -q $mountPoint/etc && umount $mountPoint/etc mountpoint -q $mountPoint/etc && umount $mountPoint/etc
umount $mountPoint/mnt2 umount $mountPoint/mnt2
umount $mountPoint/mnt-nixos
umount $mountPoint/mnt-nixpkgs umount $mountPoint/mnt-nixpkgs
umount $mountPoint/sys/firmware/efi/efivars &>/dev/null || true umount $mountPoint/sys/firmware/efi/efivars &>/dev/null || true
umount $mountPoint/sys umount $mountPoint/sys
@ -86,7 +85,7 @@ cleanup() {
umount $mountPoint/mnt/nix/store umount $mountPoint/mnt/nix/store
umount $mountPoint/mnt/nix umount $mountPoint/mnt/nix
umount $mountPoint/mnt umount $mountPoint/mnt
rmdir $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixos $mountPoint/mnt-nixpkgs rmdir $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixpkgs
} }
trap "cleanup" EXIT trap "cleanup" EXIT
@ -189,13 +188,12 @@ done
# Get the absolute path to the NixOS/Nixpkgs sources. # Get the absolute path to the NixOS/Nixpkgs sources.
mount --bind $(readlink -f $(nix-instantiate --find-file nixpkgs)) $mountPoint/mnt-nixpkgs mount --bind $(readlink -f $(nix-instantiate --find-file nixpkgs)) $mountPoint/mnt-nixpkgs
mount --bind $(readlink -f $(nix-instantiate --find-file nixos)) $mountPoint/mnt-nixos
# Build the specified Nix expression in the target store and install # Build the specified Nix expression in the target store and install
# it into the system configuration profile. # it into the system configuration profile.
echo "building the system configuration..." echo "building the system configuration..."
NIX_PATH="nixpkgs=/mnt-nixpkgs:nixos=/mnt-nixos:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \ NIX_PATH="nixpkgs=/mnt-nixpkgs:nixos=/mnt-nixpkgs/nixos:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \
chroot $mountPoint @nix@/bin/nix-env \ chroot $mountPoint @nix@/bin/nix-env \
"${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system --show-trace "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system --show-trace

View File

@ -23,7 +23,6 @@ in
NIX_PATH = NIX_PATH =
[ "/nix/var/nix/profiles/per-user/root/channels/nixos" [ "/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixpkgs=/etc/nixos/nixpkgs" "nixpkgs=/etc/nixos/nixpkgs"
"nixos=/etc/nixos/nixos"
"nixos-config=/etc/nixos/configuration.nix" "nixos-config=/etc/nixos/configuration.nix"
"services=/etc/nixos/services" "services=/etc/nixos/services"
]; ];

View File

@ -1,13 +1,12 @@
{ nixosSrc ? { outPath = ./.; revCount = 1234; shortRev = "abcdefg"; } { nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; }
, nixpkgs ? { outPath = <nixpkgs>; revCount = 5678; shortRev = "gfedcba"; }
, officialRelease ? false , officialRelease ? false
}: }:
let let
nixpkgs' = nixpkgs; # urgh nixpkgsSrc = nixpkgs; # urgh
pkgs = import <nixpkgs> {}; pkgs = import ./.. {};
removeMaintainers = set: if builtins.isAttrs set removeMaintainers = set: if builtins.isAttrs set
then if (set.type or "") == "derivation" then if (set.type or "") == "derivation"
@ -18,19 +17,19 @@ let
in rec { in rec {
nixos = removeMaintainers (import ./release.nix { nixos = removeMaintainers (import ./release.nix {
inherit nixosSrc officialRelease; inherit officialRelease;
nixpkgs = nixpkgs'; nixpkgs = nixpkgsSrc;
}); });
nixpkgs = builtins.removeAttrs (removeMaintainers (import <nixpkgs/pkgs/top-level/release.nix> { nixpkgs = builtins.removeAttrs (removeMaintainers (import ../pkgs/top-level/release.nix {
inherit officialRelease; inherit officialRelease;
nixpkgs = nixpkgs'; nixpkgs = nixpkgsSrc;
# Only do Linux builds. # Only do Linux builds.
supportedSystems = [ "x86_64-linux" "i686-linux" ]; supportedSystems = [ "x86_64-linux" "i686-linux" ];
})) [ "unstable" ]; })) [ "unstable" ];
tested = pkgs.releaseTools.aggregate { tested = pkgs.releaseTools.aggregate {
name = "nixos-${nixos.tarball.version}"; name = "nixos-${nixos.channel.version}";
meta = { meta = {
description = "Release-critical builds for the NixOS unstable channel"; description = "Release-critical builds for the NixOS unstable channel";
maintainers = [ pkgs.lib.maintainers.eelco pkgs.lib.maintainers.shlevy ]; maintainers = [ pkgs.lib.maintainers.eelco pkgs.lib.maintainers.shlevy ];

View File

@ -1,5 +1,4 @@
{ nixosSrc ? { outPath = ./.; revCount = 1234; shortRev = "abcdefg"; } { nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; }
, nixpkgs ? { outPath = <nixpkgs>; revCount = 5678; shortRev = "gfedcba"; }
, officialRelease ? false , officialRelease ? false
}: }:
@ -10,7 +9,7 @@ let
systems = [ "x86_64-linux" "i686-linux" ]; systems = [ "x86_64-linux" "i686-linux" ];
pkgs = import <nixpkgs> { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };
versionModule = versionModule =
@ -20,7 +19,7 @@ let
makeIso = makeIso =
{ module, type, description ? type, maintainers ? ["eelco"], system }: { module, type, description ? type, maintainers ? ["eelco"], system }:
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
let let
@ -50,7 +49,7 @@ let
makeSystemTarball = makeSystemTarball =
{ module, maintainers ? ["viric"], system }: { module, maintainers ? ["viric"], system }:
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
let let
@ -73,36 +72,13 @@ let
in { in {
tarball =
pkgs.releaseTools.makeSourceTarball {
name = "nixos-tarball";
src = nixosSrc;
inherit officialRelease version;
versionSuffix = pkgs.lib.optionalString (!officialRelease) versionSuffix;
distPhase = ''
echo -n $VERSION_SUFFIX > .version-suffix
releaseName=nixos-$VERSION$VERSION_SUFFIX
mkdir -p $out/tarballs
mkdir ../$releaseName
cp -prd . ../$releaseName
cd ..
chmod -R u+w $releaseName
tar cfvj $out/tarballs/$releaseName.tar.bz2 $releaseName
''; # */
};
channel = channel =
pkgs.releaseTools.makeSourceTarball { pkgs.releaseTools.makeSourceTarball {
name = "nixos-channel"; name = "nixos-channel";
src = nixosSrc; src = nixpkgs;
inherit officialRelease version; inherit officialRelease version versionSuffix;
versionSuffix = pkgs.lib.optionalString (!officialRelease) versionSuffix;
buildInputs = [ pkgs.nixUnstable ]; buildInputs = [ pkgs.nixUnstable ];
@ -113,8 +89,10 @@ in {
releaseName=nixos-$VERSION$VERSION_SUFFIX releaseName=nixos-$VERSION$VERSION_SUFFIX
mkdir -p $out/tarballs mkdir -p $out/tarballs
mkdir ../$releaseName mkdir ../$releaseName
cp -prd . ../$releaseName/nixos
cp -prd ${nixpkgs} ../$releaseName/nixpkgs cp -prd ${nixpkgs} ../$releaseName/nixpkgs
chmod -R u+w ../$releaseName
rm -rf .git
ln -s nixpkgs/nixos ../$releaseName/nixos
echo "$expr" > ../$releaseName/default.nix 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 ..
@ -125,7 +103,7 @@ in {
manual = manual =
(import "${nixosSrc}/doc/manual" { (import ./doc/manual {
inherit pkgs; inherit pkgs;
options = options =
(import lib/eval-config.nix { (import lib/eval-config.nix {
@ -134,7 +112,7 @@ in {
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
} ]; } ];
}).options; }).options;
revision = toString (nixosSrc.rev or nixosSrc.shortRev); revision = toString (nixpkgs.rev or nixpkgs.shortRev);
}).manual; }).manual;
@ -177,7 +155,7 @@ in {
# A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
ova = pkgs.lib.genAttrs systems (system: ova = pkgs.lib.genAttrs systems (system:
with import <nixpkgs> { inherit system; }; with import nixpkgs { inherit system; };
let let