main
 1{
 2  lib,
 3  stdenv,
 4  rustPlatform,
 5  fetchFromGitHub,
 6  libcosmicAppHook,
 7  pkg-config,
 8  libxkbcommon,
 9  nix-update-script,
10}:
11rustPlatform.buildRustPackage (finalAttrs: {
12  pname = "cosmic-enroll";
13  version = "1.2.10";
14
15  src = fetchFromGitHub {
16    owner = "cosmic-utils";
17    repo = "enroll";
18    tag = "v${finalAttrs.version}";
19    hash = "sha256-Z2LMoTZbV/9tXRZcz96evN24pmJ8DH1DZAi3GNK+crQ=";
20  };
21
22  cargoHash = "sha256-RW4dZgq77WuDFLvQNoZ2622Qo5GCoGx6cr592yBEIMY=";
23  doCheck = false;
24
25  nativeBuildInputs = [
26    libcosmicAppHook
27    pkg-config
28  ];
29
30  buildInputs = [libxkbcommon];
31
32  env.VERGEN_GIT_SHA = finalAttrs.src.tag;
33
34  installPhase = ''
35    runHook preInstall
36
37    install -Dm0755 "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-utils-enroll" \
38      "$out/bin/cosmic-utils-enroll"
39    install -Dm0644 resources/org.cosmic_utils.enroll.desktop \
40      "$out/share/applications/org.cosmic_utils.enroll.desktop"
41    install -Dm0644 resources/org.cosmic_utils.enroll.metainfo.xml \
42      "$out/share/metainfo/org.cosmic_utils.enroll.metainfo.xml"
43    install -Dm0644 resources/icons/hicolor/scalable/apps/enroll.svg \
44      "$out/share/icons/hicolor/scalable/apps/org.cosmic_utils.enroll.svg"
45
46    runHook postInstall
47  '';
48
49  passthru.updateScript = nix-update-script {};
50
51  meta = {
52    description = "COSMIC GUI for enrolling fingerprints with fprintd";
53    homepage = "https://github.com/cosmic-utils/enroll";
54    license = lib.licenses.mpl20;
55    mainProgram = "cosmic-utils-enroll";
56    platforms = lib.platforms.linux;
57  };
58})