Commit 806ff157 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

ferrishot: init at 0.1.0

parent b9ff86dc
Loading
Loading
Loading
Loading
+72 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  makeBinaryWrapper,
  writableTmpDirAsHomeHook,
  libGL,
  libX11,
  libxkbcommon,
  libxcb,
  wayland,
  nix-update-script,
}:

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "ferrishot";
  version = "0.1.0";

  src = fetchFromGitHub {
    owner = "nik-rev";
    repo = "ferrishot";
    tag = "v${finalAttrs.version}";
    hash = "sha256-1jKwbhn85KcIQrSakWTIfxPso7VZuuvPrUbTCF1NerM=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-NPReNHKOS4PQIt2lmY5w19lVHPDjznR9gv5vHDXyqaI=";

  nativeBuildInputs =
    [
      makeBinaryWrapper
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # error: unable to open output file '/homeless-shelter/.cache/clang/ModuleCache/354UBE8EJRBZ3/Cocoa-31YYBL2V1XGQP.pcm': 'No such file or directory'
      writableTmpDirAsHomeHook
    ];

  buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
    libxcb
  ];

  postInstall =
    let
      runtimeDeps =
        [
          libGL
        ]
        ++ lib.optionals stdenv.hostPlatform.isLinux [
          libX11
          libxkbcommon
          wayland
        ];
    in
    ''
      wrapProgram $out/bin/ferrishot \
        --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}"
    '';

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = {
    description = "Screenshot app written in Rust";
    homepage = "https://github.com/nik-rev/ferrishot";
    changelog = "https://github.com/nik-rev/ferrishot/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ GaetanLepage ];
    mainProgram = "ferrishot";
  };
})