disko icon indicating copy to clipboard operation
disko copied to clipboard

Support flakes with local paths

Open zarelit opened this issue 2 years ago • 2 comments

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

zarelit avatar Nov 24 '22 10:11 zarelit

I think this works now in the new nix version?

Lassulus avatar May 22 '23 11:05 Lassulus

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| .
             | ^

rummik avatar Jul 28 '23 01:07 rummik

It seems to require prefixing, so --flake .#hostname doesn't work, but --flake git+file:.#hostname does.

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.

iFreilicht avatar Sep 20 '24 19:09 iFreilicht