Skip to content

Nix tests can't run in a system with 512MiB of RAM #84

Closed

Description

@viric

Even having 100MiB of swap, the tests fail due to not being able to run 'xz -9' in corepkgs/nar.nix

# xz -9 > /dev/null 
xz: (stdin): Cannot allocate memory
# free
             total       used       free     shared    buffers     cached
Mem:        448744     265720     183024          0      23812     193500
-/+ buffers/cache:      48408     400336
Swap:       102396      50244      52152

As for nixpkgs, it makes the building of nix fail.

Activity

  1. viric commented on Jan 2, 2013

    @viric
    MemberAuthor

    'xz' alone runs fine.

  2. edolstra commented on Jan 2, 2013

    @edolstra
    Member

    Yes, "xz -9" uses a lot of memory. Maybe add more swap?

  3. viric commented on Jan 2, 2013

    @viric
    MemberAuthor

    Well, we all know that solution :) My concern was more about it being a big requirement, for the package manager tests.
    Of all NixOS pieces, only nix (its tests) requires that amount of memory.

  4. viric commented on Mar 31, 2013

    @viric
    MemberAuthor

    My solution has been, both in the raspberry pi and the sheevaplug, to use:

    nixpkgs.config.packageOverrides = p: {
          nix = p.lib.overrideDerivation p.nix (attrs: {
            patchPhase = "sed -i s/-9// corepkgs/nar.nix";
            });
          nixUnstable = p.lib.overrideDerivation p.nixUnstable (attrs: {
            patchPhase = "sed -i s/-9// corepkgs/nar.nix";
            });
      };
    }
    
  5. bjornfor commented on Apr 28, 2013

    @bjornfor
    Contributor

    +1 for reducing the memory footprint. (Why does a test need to use more memory than the actual system?)

    Interesting, "man xz" actually has lots of info about memory usage and ways to limit it. Search for memory or memlimit.

  6. edolstra commented on Apr 28, 2013

    @edolstra
    Member

    But the "actual system" does use this much memory because it (nix-push) calls "xz -9".

  7. added a commit that references this issue on Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions