1{ lib
2, rustPlatform
3, fetchFromGitHub
4, installShellFiles
5, pkg-config
6, bzip2
7, stdenv
8, Security
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "pactorio";
13 version = "0.6.0";
14
15 src = fetchFromGitHub {
16 owner = "figsoda";
17 repo = pname;
18 rev = "v${version}";
19 sha256 = "sha256-3+irejeDltf7x+gyJxWBgvPgpQx5uU3DewU23Z4Nr/A=";
20 };
21
22 cargoHash = "sha256-sAFsG+EPSmvPDFR9R0fZ5f+y/PXVpTJlMzL61vwf4SY=";
23
24 nativeBuildInputs = [ installShellFiles pkg-config ];
25
26 buildInputs = [ bzip2 ] ++ lib.optional stdenv.isDarwin Security;
27
28 postInstall = ''
29 installManPage artifacts/pactorio.1
30 installShellCompletion artifacts/pactorio.{bash,fish} --zsh artifacts/_pactorio
31 '';
32
33 GEN_ARTIFACTS = "artifacts";
34
35 meta = with lib; {
36 description = "Mod packager for factorio";
37 mainProgram = "pactorio";
38 homepage = "https://github.com/figsoda/pactorio";
39 changelog = "https://github.com/figsoda/pactorio/blob/v${version}/CHANGELOG.md";
40 license = licenses.mpl20;
41 maintainers = with maintainers; [ figsoda ];
42 };
43}