When trying to build an ISO image, my system memory (~12GB) and swap space (~16GB) gets completely filled. The build seems to freeze on the following:
evaluating file '/nix/store/*/nixos/lib/systems/platform.nix'
Using the following system configuration (file named iso.nix):
{config, pkgs, ...}:
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix>
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
];
nixpkgs.overlays = [
(self: super: { inherit (super.pkgsi686Linux) grub2_efi; })
];
}
Then run the following:
nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix
"x86_64-linux"Linux 5.0.2, NixOS, 19.09pre173080.1222e289b50 (Loris)yesyesnix-env (Nix) 2.2Appears to affect 19.03 channel as well.
This occurs here too. ulimit seems ineffective in preventing the freeze, but SysRq+F (may need SysRq+R too) is useful to invoke the OOM-killer manually.
I tested it against nixos-19.03, so it's not particular to nixos-unstable.
Can you try out 18.09 to see if this has been introduced recently?
config.system.build.toplevel has the same effect as config.system.build.isoImage-vv output differs:evaluating file '/nix/store/4wngdg5ri4n6950smk3swgxgrzpshqhd-source/lib/systems/platforms.nix'evaluating file '/nix/store/qv6wc1js0fqmjmvkn9qh8xxhx3f43wcm-source/pkgs/tools/filesystems/jfsutils/default.nix'So I just tried this on an EC2 m5a.24xlarge instance to see if it would actually complete.
It maxed out all 371GB of memory and only used a single core. After about ~30 minutes it finally crashed from a stack overflow.
I should also note that the issue does not occur if the overlay line is removed from the configuration.
Ah ok! It's probably an issue in pkgsi686Linux.
This can be resolved with this simple patch:
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 0ee5c25b010..0ef7cd4341e 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -151,6 +151,9 @@ let
# All packages built for i686 Linux.
# Used by wine, firefox with debugging version of Flash, ...
pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun {
+ overlays = [ (self': super': {
+ pkgsi686Linux = super';
+ })] ++ overlays;
${if stdenv.hostPlatform == stdenv.buildPlatform
then "localSystem" else "crossSystem"} = {
parsed = stdenv.hostPlatform.parsed // {
but I'd like to hear also @oxij's opinion, as he was last to touch this code.
Hey @Slabity! The issue is fixed in nixpkgs master and 19.03, but if you need it on 18.09, there is workaround:
nixpkgs.overlays = [
(self: super: super.lib.optionalAttrs (super.system != "i686-linux")
{ inherit (super.pkgsi686Linux) grub2_efi; })
];