如何禁用解包阶段以防止错误 "do not know how to unpack source archive"?

How to disable unpack phase to prevent error "do not know how to unpack source archive"?

带推导

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"
  '';
}

我有一个错误

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

为什么 dontUnpack 不起作用?


更新:在 nixpkgs https://github.com/NixOS/nixpkgs/issues/65434

上创建了错误问题

试试这个:

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
  '';
}

@FRidh 写道

Many of the dont attributes were not yet implemented in the current and past stable releases. So, if you intend to use it with the current stable or older stables, use instead unpackPhase = ":".