(I have seen similar question here but there was no answer there)
I have been trying to package the qt application Penguin Subtitle Player and I have solved some of the errors (I think) but I can’t seem to get the last step of installing the app.
The following are the files I created. The directory tree looks as such:
.
├── build
│ └── myapp
│ └── default.nix
├── default.nix
└── penguin.nix
2 directories, 3 files
(The contents of the .nix files are at the end)
When I try to run the nix-build -A penguinsub
, it seems the application is built but I seem to get the following error:
> make: *** No rule to make target 'install'. Stop.
Looking into nix.dev manual for Install Phase, I believe I have to add the following lines:
# penguinsub.nix
# ...
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp PenguinSubtitlePlayer $out/bin # Not sure about this line
runHook postInstall
'';]
# ...
Though adding the lines continues to give me the same error. I think something in the InstallPhase
needs to be different for packaging Qt apps? Can someone help me here?
(The following are the contents of the .nix files:)
# ./build/myapp/default.nix
{
lib,
stdenv,
fetchFromGitHub,
qtbase,
wrapQtAppsHook,
}:
stdenv.mkDerivation {
pname = "penguinsub";
version = "v1.6.0";
src = fetchFromGitHub {
owner = "carsonip";
repo = "Penguin-Subtitle-Player";
rev = "v1.6.0";
sha256 = "1gqzcrfr73bzrr0ymkmhmvwz6hnq087f2lvk24m7ivzl24vhbjf4";
};
buildInputs = [ qtbase ];
nativeBuildInputs = [ wrapQtAppsHook ];
}
# ./default.nix
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
{
hello = pkgs.callPackage ./hello.nix { };
icat = pkgs.callPackage ./icat.nix { };
penguinsub = pkgs.libsForQt5.callPackage ./build/myapp/default.nix { };
}
# ./penguinsub.nix
{
lib,
stdenv,
fetchFromGitHub,
qtbase,
wrapQtAppsHook,
}:
stdenv.mkDerivation {
pname = "penguinsub";
version = "v1.6.0";
src = fetchFromGitHub {
owner = "carsonip";
repo = "Penguin-Subtitle-Player";
rev = "v1.6.0";
sha256 = "1gqzcrfr73bzrr0ymkmhmvwz6hnq087f2lvk24m7ivzl24vhbjf4";
};
buildInputs = [ qtbase ];
nativeBuildInputs = [ wrapQtAppsHook qmake ];
qtWrapperArgs = [ ''--prefix PATH : $out/bin'' ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp PenguinSubtitlePlayer $out/bin
runHook postInstall
'';
}