如何禁用解包阶段以防止错误“不知道如何解包源存档”?

srg*_*hma 5 nix

带推导

let
  pkgs = import <nixpkgs> {};
in

with pkgs;

stdenv.mkDerivation {
  name = "asdfasdf";

  version = "0.1";

  src = /home/srghma/opt/foxitsoftware/foxitreader/FoxitReader; # this is executeable file

  dontUnpack = true; # not fu**** working

  installPhase = ''
    echo "not even executed"
  '';
}
Run Code Online (Sandbox Code Playgroud)

我有一个错误

nix-build tmp.nix
these derivations will be built:
  /nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv
building '/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv'...
unpacking sources
unpacking source archive /nix/store/3hnf69pky6mqaxv4jxly9fyywqpq6iml-FoxitReader
do not know how to unpack source archive /nix/store/3hnf69pky6mqaxv4jxly9fyywqpq6iml-FoxitReader
builder for '/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv' failed with exit code 1
error: build of '/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv' failed
Run Code Online (Sandbox Code Playgroud)

为什么dontUnpack不工作?


更新:在 nixpkgs https://github.com/NixOS/nixpkgs/issues/65434创建错误问题

Emm*_*osa 8

尝试这个:

let
  pkgs = import <nixpkgs> {};
in

with pkgs;

stdenv.mkDerivation {
  name = "asdfasdf";

  version = "0.1";

  # Renamed to imply that 'src' functionality is not being used.
  executable = /home/srghma/opt/foxitsoftware/foxitreader/FoxitReader; # this is executeable file

  phases = [ "installPhase" ]; # Removes all phases except installPhase

  installPhase = ''
    mkdir -p $out/bin
    cp ${executable} $out/bin
  '';
}
Run Code Online (Sandbox Code Playgroud)

  • 您是否能够重现该问题,或者在没有重现器的情况下建议使用此解决方案。 (2认同)

srg*_*hma 3

@FRidh 写道

许多 dont 属性在当前和过去的稳定版本中尚未实现。因此,如果您打算将其与当前稳定版或更旧的稳定版一起使用,请改用 unpackPhase = ":"。