Closed aim-nara closed 1 month ago
Could you explain how drv.squashfsArgs
would be set? I don't see how nix bundle
can set them.
I've like to use it like:
packages.x86_64-linux.build = stdenv.mkDerivation {
...
squashfsArgs = ["-comp" "zstd" "-Xcompression-level" "5"];
...
};
Or is there other better way to set it?
For nix bundle
, there's no way to set the squashfsArgs
introduced by this PR.
If you're using building an AppImage from nix code, e.g. in another flake, use lib.mkAppImage
, don't use bundlers.<system>.default
.
Being able to set squashfsArgs from the derivation doesn't seem like a good idea, even if it is convenient.
I've got your point and seems more reasonable. I'm not a nix expert so I've tried on my env and got code like following work:
{
inputs = {
nixpkgs.url = ...;
nix-appimage.url = "github:ralismark/nix-appimage";
};
outputs = { self, nixpkgs, nix-appimage }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; }
mkAppImage = nix-appimage.lib.x86_64-linux.mkAppImage;
in {
packages.x86_64-linux.default = pkgs.stdenv.mkDerivation {
...
}
packages.x86_64-linux.appimage = mkAppImage {
program = pkgs.lib.getExe self.packages.x86_64-linux.default;
squashfsArgs = ["-comp" "zstd" "-Xcompression-level" "5" ...];
};
};
}
by running nix build ./.#appimage
Is there any other better example to refer?
Also by using lib.mkAppImage
it's better since flake.nix will track specific nix-appimage with flake.lock which is more like "managed by nix"
I've like to specify compression level and compression type from derivation