Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profiles/minimal.nix module forces big rebuilds of packages #319102

Closed
qaristote opened this issue Jun 11, 2024 · 2 comments
Closed

profiles/minimal.nix module forces big rebuilds of packages #319102

qaristote opened this issue Jun 11, 2024 · 2 comments

Comments

@qaristote
Copy link

Describe the bug

Importing the profiles/minimal.nix module forces some packages to be built locally because their derivations change. For some of these packages the build process is very resource consuming, hence not feasible for small machines, which are one of the targets of the profiles/minimal.nix module.

Additional context

Here's an example: I have a router with low resources (4GB of RAM and a 2GB swap file) running NixOS under nixpkgs release-24.05, on which I enabled the Kea DHCP server. I have the profiles/minimal.nix module imported, and building my configuration locally results in the machine crashing as it runs out of memory. This happens because NixOS tries to build Kea locally, as it needs a version that is not cached:

❯ nixos-rebuild dry-build --flake . --impure 2>&1 >/dev/null | grep kea
  /nix/store/6klgj1gdd6y2i94ijkd4q8h8qhraxga3-kea-2.4.1.drv
  ...

When I disable the profiles/minimal.nix module, NixOS correctly fetches Kea from the cachix instance:

❯ nixos-rebuild dry-build --flake . --impure 2>&1 >/dev/null | grep kea
  ...
  /nix/store/jb5s4ifjiw4ajgjirylxg7v18j5zshk8-kea-2.4.1
  ...

This version is indeed the one that's cached:

❯ nix build github:NixOS/nixpkgs/release-24.05#kea
❯ ls -l result
result -> /nix/store/jb5s4ifjiw4ajgjirylxg7v18j5zshk8-kea-2.4.1

Here's the result of comparing the two derivations with nix-diff: I don't understand all the differences but for instance one of them is the flag --without-x which is enabled because the minimal profile disables X.

Steps To Reproduce

Build a NixOS configuration with Kea enabled and the profiles/minimal.nix module imported.

Expected behavior

While it is expected that the derivations differ, small machines shouldn't have to build these kinds of big packages locally, so I would expect that packages built with the minimal profile imported be cached as well. Unless I'm mistaken and the point of this minimal profile isn't to be used on small machines ? In that case I feel like this should be documented here for instance.

Notify maintainers

Not sure who to notify here, @SuperSandro2000 perhaps ? Sorry for the noise.


Add a 👍 reaction to issues you find important.

@qaristote qaristote changed the title profiles/minimal.nix module forces big rebuild of packages profiles/minimal.nix module forces big rebuilds of packages Jun 11, 2024
@SuperSandro2000
Copy link
Member

You can use the minimal profile on small machines, you just should build the configuration on a more powerful machine.

Can you do a PR to update the documentation?

@emilazy
Copy link
Member

emilazy commented Sep 14, 2024

Solved by #341681.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants