about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/pactorio/default.nix
blob: 3790440f1b8b0cafe1b96aa1cf86e3b0de8a39a7 (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
{ fetchFromGitHub, installShellFiles, lib, stdenv, rustPlatform, Security }:

rustPlatform.buildRustPackage rec {
  pname = "pactorio";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "figsoda";
    repo = pname;
    rev = "v${version}";
    sha256 = "07h9hywz0pc29411myhxjq6pks4p6q6czbqjv7fxf3xkb1mg9grq";
  };

  cargoSha256 = "1rac2s36j88vm231aji8d0ndfbaa2gzxwsrxrvsi0zp9cqisc6rh";

  nativeBuildInputs = [ installShellFiles ];
  buildInputs = lib.optional stdenv.isDarwin Security;

  preFixup = ''
    completions=($releaseDir/build/pactorio-*/out/completions)
    installShellCompletion ''${completions[0]}/pactorio.{bash,fish}
    installShellCompletion --zsh ''${completions[0]}/_pactorio
  '';

  GEN_COMPLETIONS = "1";

  meta = with lib; {
    description = "Mod package for factorio";
    homepage = "https://github.com/figsoda/pactorio";
    changelog = "https://github.com/figsoda/pactorio/blob/v${version}/CHANGELOG.md";
    license = licenses.mpl20;
    maintainers = with maintainers; [ figsoda ];
  };
}