diff options
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/default.nix | 7 | ||||
-rw-r--r-- | nixos/lib/build-vms.nix | 2 | ||||
-rw-r--r-- | nixos/lib/eval-config.nix | 7 | ||||
-rw-r--r-- | nixos/modules/installer/cd-dvd/channel.nix | 14 | ||||
-rw-r--r-- | nixos/modules/installer/tools/nixos-install.sh | 8 | ||||
-rw-r--r-- | nixos/modules/programs/environment.nix | 1 | ||||
-rw-r--r-- | nixos/release-combined.nix | 17 | ||||
-rw-r--r-- | nixos/release.nix | 46 |
8 files changed, 39 insertions, 63 deletions
diff --git a/nixos/default.nix b/nixos/default.nix index d38e70d21f9..88f82a82482 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,12 +1,11 @@ { configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config> , system ? builtins.currentSystem -, nixpkgs ? <nixpkgs> }: let eval = import ./lib/eval-config.nix { - inherit system nixpkgs; + inherit system; modules = [ configuration ]; }; @@ -14,13 +13,13 @@ let # This is for `nixos-rebuild build-vm'. vmConfig = (import ./lib/eval-config.nix { - inherit system nixpkgs; + inherit system; modules = [ configuration ./modules/virtualisation/qemu-vm.nix ]; }).config; # This is for `nixos-rebuild build-vm-with-bootloader'. vmWithBootLoaderConfig = (import ./lib/eval-config.nix { - inherit system nixpkgs; + inherit system; modules = [ configuration ./modules/virtualisation/qemu-vm.nix diff --git a/nixos/lib/build-vms.nix b/nixos/lib/build-vms.nix index 59f05bfd104..aad85aedc48 100644 --- a/nixos/lib/build-vms.nix +++ b/nixos/lib/build-vms.nix @@ -1,6 +1,6 @@ { system, minimal ? false }: -let pkgs = import <nixpkgs> { 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/eval-config.nix b/nixos/lib/eval-config.nix index 47e7d1a0eaf..89f81cf70bd 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -7,7 +7,6 @@ , baseModules ? import ../modules/module-list.nix , extraArgs ? {} , modules -, nixpkgs ? <nixpkgs> }: let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in @@ -31,7 +30,7 @@ rec { extraArgs = extraArgs_ // { inherit pkgs modules baseModules; modulesPath = ../modules; - pkgs_i686 = import nixpkgs { system = "i686-linux"; }; + pkgs_i686 = import ../.. { system = "i686-linux"; }; utils = import ./utils.nix pkgs; }; @@ -48,7 +47,7 @@ rec { pkgs = if pkgs_ != null then pkgs_ - else import nixpkgs ( + else import ../.. ( let system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_; nixpkgsOptions = (import ./eval-config.nix { @@ -56,7 +55,7 @@ rec { # For efficiency, leave out most NixOS modules; they don't # define nixpkgs.config, so it's pointless to evaluate them. baseModules = [ ../modules/misc/nixpkgs.nix ]; - pkgs = import nixpkgs { system = system_; config = {}; }; + pkgs = import ../.. { system = system_; config = {}; }; }).optionDefinitions.nixpkgs; in { diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix index 8126ce46dd9..987b85d6165 100644 --- a/nixos/modules/installer/cd-dvd/channel.nix +++ b/nixos/modules/installer/cd-dvd/channel.nix @@ -14,11 +14,15 @@ let { expr = builtins.readFile ../../../lib/channel-expr.nix; } '' mkdir -p $out/nixos - cp -prd ${cleanSource ../../..} $out/nixos/nixos - cp -prd ${cleanSource <nixpkgs>} $out/nixos/nixpkgs - chmod -R u+w $out/nixos/nixos - echo -n ${config.system.nixosVersion} > $out/nixos/nixos/.version - echo -n "" > $out/nixos/nixos/.version-suffix + # FIXME: should use ../../../.. instead of <nixpkgs>, but that + # doesn't work properly if <nixos> is a symlink to + # nixpkgs/nixos. + cp -prd ${<nixpkgs>} $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 ''; diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index a4ac5b68dd7..19ce81983f1 100644 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -57,7 +57,7 @@ fi # Mount some stuff in the target root directory. We bind-mount /etc # into the chroot because we need networking and the nixbld user # 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 --bind / $mountPoint/mnt mount --bind /nix $mountPoint/mnt/nix @@ -76,7 +76,6 @@ cleanup() { mountpoint -q $mountPoint/etc/nixos && umount $mountPoint/etc/nixos mountpoint -q $mountPoint/etc && umount $mountPoint/etc umount $mountPoint/mnt2 - umount $mountPoint/mnt-nixos umount $mountPoint/mnt-nixpkgs umount $mountPoint/sys/firmware/efi/efivars &>/dev/null || true umount $mountPoint/sys @@ -86,7 +85,7 @@ cleanup() { umount $mountPoint/mnt/nix/store umount $mountPoint/mnt/nix 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 @@ -189,13 +188,12 @@ done # 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 nixos)) $mountPoint/mnt-nixos # Build the specified Nix expression in the target store and install # it into the system configuration profile. 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 \ "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system --show-trace diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix index f42df351422..683f6b54b10 100644 --- a/nixos/modules/programs/environment.nix +++ b/nixos/modules/programs/environment.nix @@ -23,7 +23,6 @@ in NIX_PATH = [ "/nix/var/nix/profiles/per-user/root/channels/nixos" "nixpkgs=/etc/nixos/nixpkgs" - "nixos=/etc/nixos/nixos" "nixos-config=/etc/nixos/configuration.nix" "services=/etc/nixos/services" ]; diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 9b914506215..f36f3fd9aba 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -1,13 +1,12 @@ -{ nixosSrc ? { outPath = ./.; revCount = 1234; shortRev = "abcdefg"; } -, nixpkgs ? { outPath = <nixpkgs>; revCount = 5678; shortRev = "gfedcba"; } +{ nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; } , officialRelease ? false }: let - nixpkgs' = nixpkgs; # urgh + nixpkgsSrc = nixpkgs; # urgh - pkgs = import <nixpkgs> {}; + pkgs = import ./.. {}; removeMaintainers = set: if builtins.isAttrs set then if (set.type or "") == "derivation" @@ -18,19 +17,19 @@ let in rec { nixos = removeMaintainers (import ./release.nix { - inherit nixosSrc officialRelease; - nixpkgs = nixpkgs'; + inherit officialRelease; + 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; - nixpkgs = nixpkgs'; + nixpkgs = nixpkgsSrc; # Only do Linux builds. supportedSystems = [ "x86_64-linux" "i686-linux" ]; })) [ "unstable" ]; tested = pkgs.releaseTools.aggregate { - name = "nixos-${nixos.tarball.version}"; + name = "nixos-${nixos.channel.version}"; meta = { description = "Release-critical builds for the NixOS unstable channel"; maintainers = [ pkgs.lib.maintainers.eelco pkgs.lib.maintainers.shlevy ]; diff --git a/nixos/release.nix b/nixos/release.nix index 458e17aef46..2af43ab5b87 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -1,5 +1,4 @@ -{ nixosSrc ? { outPath = ./.; revCount = 1234; shortRev = "abcdefg"; } -, nixpkgs ? { outPath = <nixpkgs>; revCount = 5678; shortRev = "gfedcba"; } +{ nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; } , officialRelease ? false }: @@ -10,7 +9,7 @@ let systems = [ "x86_64-linux" "i686-linux" ]; - pkgs = import <nixpkgs> { system = "x86_64-linux"; }; + pkgs = import nixpkgs { system = "x86_64-linux"; }; versionModule = @@ -20,7 +19,7 @@ let makeIso = { module, type, description ? type, maintainers ? ["eelco"], system }: - with import <nixpkgs> { inherit system; }; + with import nixpkgs { inherit system; }; let @@ -50,7 +49,7 @@ let makeSystemTarball = { module, maintainers ? ["viric"], system }: - with import <nixpkgs> { inherit system; }; + with import nixpkgs { inherit system; }; let @@ -73,36 +72,13 @@ let 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 = pkgs.releaseTools.makeSourceTarball { name = "nixos-channel"; - src = nixosSrc; + src = nixpkgs; - inherit officialRelease version; - versionSuffix = pkgs.lib.optionalString (!officialRelease) versionSuffix; + inherit officialRelease version versionSuffix; buildInputs = [ pkgs.nixUnstable ]; @@ -113,8 +89,10 @@ in { releaseName=nixos-$VERSION$VERSION_SUFFIX mkdir -p $out/tarballs mkdir ../$releaseName - cp -prd . ../$releaseName/nixos cp -prd ${nixpkgs} ../$releaseName/nixpkgs + chmod -R u+w ../$releaseName + rm -rf .git + 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 .. @@ -125,7 +103,7 @@ in { manual = - (import "${nixosSrc}/doc/manual" { + (import ./doc/manual { inherit pkgs; options = (import lib/eval-config.nix { @@ -134,7 +112,7 @@ in { boot.loader.grub.device = "/dev/sda"; } ]; }).options; - revision = toString (nixosSrc.rev or nixosSrc.shortRev); + revision = toString (nixpkgs.rev or nixpkgs.shortRev); }).manual; @@ -177,7 +155,7 @@ in { # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). ova = pkgs.lib.genAttrs systems (system: - with import <nixpkgs> { inherit system; }; + with import nixpkgs { inherit system; }; let |