summary refs log tree commit diff
path: root/default.nix
blob: 81d4916e0886804ba976e1d6041b1aa99b29e88d (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
{ crane, lib }:
let
  src = crane.cleanCargoSource ./.;

  args = {
    inherit src;
    strictDeps = true;

    meta = with lib.meta; {
      maintainers = with lib.maintainers; [ vikanezrimaya ];
      platforms = ["aarch64-linux" "x86_64-linux"];
    };
  };

  cargoArtifacts = crane.buildDepsOnly args;
  args' = args // {
    inherit cargoArtifacts;
  };
in crane.buildPackage (args' // {
  postInstall = ''
    install -Dm755 ${./xdg-desktop-portal-systemd.portal} $out/share/xdg-desktop-portal/portals/xdg-desktop-portal-systemd.portal

    mkdir -p $out/share/systemd/user/
    substituteAll ${./xdg-desktop-portal-systemd.service} $out/share/systemd/user/xdg-desktop-portal-systemd.service

    mkdir -p $out/share/dbus-1/services/
    substituteAll ${./xyz.vikanezrimaya.fdo.portal.Systemd.service} $out/share/dbus-1/services/xyz.vikanezrimaya.fdo.portal.Systemd.service

    mkdir -p $out/share/applications
    substituteAll ${./xdg-desktop-portal-systemd.desktop} $out/share/applications/xdg-desktop-portal-systemd.desktop
  '';
  passthru = {
    clippy = crane.cargoClippy (args' // {
      cargoClippyExtraArgs = "--all-targets -- --deny warnings";
    });
    fmt = crane.cargoFmt { inherit src; };
  };
})