about summary refs log tree commit diff
path: root/pkgs/by-name/is/iscc/package.nix
blob: 1f3472d288ca6ba39b21387f2cb2252176b4c7fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ stdenv
, fetchurl
, innoextract
, runtimeShell
, wineWow64Packages
, lib
}:

let
  version = "6.2.2";
  majorVersion = builtins.substring 0 1 version;
in
stdenv.mkDerivation rec {
  pname = "iscc";
  inherit version;
  src = fetchurl {
    url = "https://files.jrsoftware.org/is/${majorVersion}/innosetup-${version}.exe";
    hash = "sha256-gRfRDQCirTOhOQl46jhyhhwzDgh5FEEKY3eyLExbhWM=";
  };
  nativeBuildInputs = [
    innoextract
    wineWow64Packages.stable
  ];
  unpackPhase = ''
    runHook preUnpack
    innoextract $src
    runHook postUnpack
  '';
  dontBuild = true;
  installPhase = ''
    runHook preInstall
    mkdir -p "$out/bin"
    cp -r ./app/* "$out/bin"

    cat << 'EOF' > "$out/bin/${pname}"
    #!${runtimeShell}
    export PATH=${wineWow64Packages.stable}/bin:$PATH
    export WINEDLLOVERRIDES="mscoree=" # disable mono

    # Solves PermissionError: [Errno 13] Permission denied: '/homeless-shelter/.wine'
    export HOME=$(mktemp -d)

    wineInputFile=$(${wineWow64Packages.stable}/bin/wine winepath -w $1)
    ${wineWow64Packages.stable}/bin/wine "$out/bin/ISCC.exe" "$wineInputFile"
    EOF

    substituteInPlace $out/bin/${pname} \
      --replace "\$out" "$out"

    chmod +x "$out/bin/${pname}"

    runHook postInstall
  '';


  meta = with lib; {
    description = "A compiler for Inno Setup, a tool for creating Windows installers";
    homepage = "https://jrsoftware.org/isinfo.php";
    license = licenses.unfreeRedistributable;
    maintainers = with maintainers; [ ];
    platforms = wineWow64Packages.stable.meta.platforms;
  };
}