Skip to content

Conversation

hgl
Copy link

@hgl hgl commented Jul 30, 2025

This is a different way of fixing nix-community/disko#1091

Nixos-anywhere will run commands like:

jq -r -f /nix/store/fpwn44vygjj6bfn8s1jj9p8yh6jhfxni-disk-deactivate/zfs-swap-deactivate.jq
...
jq -r --arg disk_to_clear /dev/sda -f /nix/store/fpwn44vygjj6bfn8s1jj9p8yh6jhfxni-disk-deactivate/disk-deactivate.jq

During installation, and with --no-disko-deps, jq isn't available on the official nixos-installer, and these command can fail.

@Mic92
Copy link
Member

Mic92 commented Jul 30, 2025

--no-disko-deps means the user is responsible for using an installer that has all the tools necessary installed. The machine in question might not have internet or not enough memory to download a nixpkgs channel. For example it breaks our NixOS test this way.

@Mic92
Copy link
Member

Mic92 commented Jul 30, 2025

We also provide https://github.com/nix-community/nixos-images?tab=readme-ov-file where jq is available for booting from USB or you just don't pass this flag.

@hgl
Copy link
Author

hgl commented Jul 31, 2025

Thanks for the tip.

In my case, the remote machine is in a cloud environment that

  1. Has very limited amount of ram
  2. Can only mount predetermined official nixos iso

Which requires --no-disko-deps.

I sent the PR because it seems the official installer already contains every tool needed by nixos-anywhere, except for jq, and I assumed if jq could be added, we could use --no-disko-deps transparently at least with the official installer, but maybe this isn't true?

I'm writing a downstream tool that uses nixos-anywhere to install nixos to remote machines, and I hoped to make the official installer a first class citizen where even if the ram is limited, nixos could still be successfully installed without user intervention. I wonder if this goal is feasible?

If the design goal is that no deps disko should not trigger network download, which makes sense, then maybe it's not?

I've fixed the build error though.

@Mic92
Copy link
Member

Mic92 commented Jul 31, 2025

Could you check if jq is included in the nixos installer closure? Maybe we can just expose jq in the NixOS image.

@Mic92
Copy link
Member

Mic92 commented Jul 31, 2025

@Enzime
Copy link
Member

Enzime commented Jul 31, 2025

@Mic92
Copy link
Member

Mic92 commented Jul 31, 2025

It's actually always in the installer: https://github.com/NixOS/nixpkgs/blob/531ef345f82f4fcaf04646b961963ed69f9c1f09/nixos/modules/profiles/installation-device.nix#L115

Are you sure you are using the official nixos installer? If you are using a nix installer it should be easy to just include additional lines to install missing tools.

@Mic92
Copy link
Member

Mic92 commented Jul 31, 2025

Ah maybe extraDependencies doesn't get propageted into the $PATH. But in that case we might as well just include it environment.systemPackages as well.

@hgl
Copy link
Author

hgl commented Jul 31, 2025

Yep, it's not in the PATH, but is in the store already, confirmed with the 24.11 image.

@Mic92
Copy link
Member

Mic92 commented Jul 31, 2025

Okay, than please open a pull request in nixpkgs and link it here.

@hgl
Copy link
Author

hgl commented Jul 31, 2025

NixOS/nixpkgs#429759

@hgl
Copy link
Author

hgl commented Aug 2, 2025

PR has been merged.

@hgl hgl closed this Aug 2, 2025
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

Successfully merging this pull request may close these issues.

3 participants