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

[DOCUMENTATION] Setting the number of cores for rebuild using nh #55

Open
dwilliam62 opened this issue Jan 14, 2025 · 3 comments
Open

Comments

@dwilliam62
Copy link

In the installation instructions regarding limiting cores you have :

For some computers, the default rebuild command might get stuck due to CPU cores running out of RAM. To fix that modify the install script line: sudo nixos-rebuild switch --flake .#${HOST} to sudo nixos-rebuild switch --cores <less than your max number of cores> --flake .#${HOST}

However you are now calling nh to do the rebuild. I didn't see online where I can set nh to limit cores. I changed that line to the nixos-rebuild as shown on the page, and I am trying the build now. As it did fail using nh. It's a VM on a proxmox server it has 2x processors and a total of 24 cores. but only 8GB of RAM.

If you know of a way to limit nh please add that to the instructions or maybe leave a commented version of the old command in the file if not.

Thanks and regards,

@Frost-Phoenix
Copy link
Owner

Hi, your right I completely forgot about that.
I think I fount how to do it: nix-shell -p nh --run "nh os switch -H ${HOST} . -- --cores <nb_cores>" with <nb_cores> the number of cores you want to use and ${HOST} beeing vm in your case, it should give the same result as the old one.
Let me know if this works for you, if not then I will simply put back the old command in a comment as you suggested.

@dwilliam62
Copy link
Author

OK I will try that. I did end up using the old command and it worked well and I dbl'd the ram to 16GB as well. Thanks! I did look on nh page.

@dwilliam62
Copy link
Author

Hi, your right I completely forgot about that. I think I fount how to do it: nix-shell -p nh --run "nh os switch -H ${HOST} . -- --cores <nb_cores>" with <nb_cores> the number of cores you want to use and ${HOST} beeing vm in your case, it should give the same result as the old one. Let me know if this works for you, if not then I will simply put back the old command in a comment as you suggested.

this does work, however, you seem to have to cut the number in 1/2. I have a 16 core VM. If I set it to 8 it still spawned builds on all 16 cores I had to drop it to 4. Thanks !

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

No branches or pull requests

2 participants