disko
disko copied to clipboard
Support flakes with local paths
It can be handy to iterate over the diskoConfiguration and just look at the outcome without having to push the flake code anywhere, in order for this to work the full URI of the flake must be resolved before passing it to nix-build so that it's possible to do something like disko -m create --dry-run -f '.#hostname'
Another usecase might be a flake in a private repository that is copied over manually on the target host, without having to configure nix to fetch it remotely.
In nixos-shell this is achieved by using nix flake metadata (https://github.com/Mic92/nixos-shell/blob/master/bin/nixos-shell#L32)
Originally posted by @zarelit in https://github.com/nix-community/disko/issues/58#issuecomment-1324948140
I think this works now in the new nix version?
Sort of. It seems to require prefixing, so --flake .#hostname doesn't work, but --flake git+file:.#hostname does.
Without git+file: I get:
error: syntax error, unexpected '.'
at «string»:1:1:
1| .
| ^
It seems to require prefixing, so
--flake .#hostnamedoesn't work, but--flake git+file:.#hostnamedoes.
I tried this out just now, and it seems to work fine:
nix run nixpkgs#disko -- -m format --dry-run -f .#junction
/nix/store/f0amzg55nv5j135mmqpyq1hbzm4izv5g-disko-format
nixpkgs in this case is locked to https://github.com/NixOS/nixpkgs/commit/5e0ca22929f3342b19569b21b2f3462f053e497b, so fairly recent.
I'll consider this fixed for now, but feel free to re-open if you witness this issue persisting on an up-to-date system.