audiobookshelf: 2.18.1 -> 2.19.0 (#378967)
[NixPkgs.git] / pkgs / by-name / ni / nix-plugin-pijul / package.nix
blobc39ef22811182aded12519a1bbc726c7509e70b7
2   lib,
3   stdenv,
4   fetchzip,
5   meson,
6   ninja,
7   pkg-config,
8   boost,
9   howard-hinnant-date,
11   # for tests
12   runCommand,
13   pijul,
14   nixVersions,
15   nixOverride ? null,
16   nix-plugin-pijul,
18 let
19   nix = if nixOverride != null then nixOverride else nixVersions.nix_2_24;
21 stdenv.mkDerivation (finalAttrs: {
22   pname = "nix-plugin-pijul";
23   version = "0.1.6";
25   src = fetchzip {
26     url = "https://dblsaiko.net/pub/nix-plugin-pijul/nix-plugin-pijul-${finalAttrs.version}.tar.gz";
27     hash = "sha256-BOuBaFvejv1gffhBlAJADLtd5Df71oQbuCnniU07nF4=";
28   };
30   nativeBuildInputs = [
31     meson
32     ninja
33     pkg-config
34   ];
36   buildInputs = [
37     boost
38     howard-hinnant-date
39     nix
40   ];
42   passthru.tests =
43     let
44       localRepoCheck =
45         nixOverride:
46         runCommand "localRepoCheck-${nixOverride.name}"
47           {
48             nativeBuildInputs = [
49               pijul
50               nix
51             ];
52           }
53           ''
54             export HOME=$(mktemp -d)
55             export EDITOR=true
56             pijul identity new --no-link --no-prompt --display-name 'Test User' --email 'test@example.com'
58             pijul init repo
59             cd repo
61             echo "it works" > foo
62             pijul add foo
63             pijul record --message 'Add foo'
65             output=$(
66               nix \
67                 --option plugin-files ${
68                   nix-plugin-pijul.override { inherit nixOverride; }
69                 }/lib/nix/plugins/pijul.so \
70                 --extra-experimental-features 'nix-command flakes' \
71                 eval --impure --raw --expr "builtins.readFile ((builtins.fetchTree \"pijul+file://$PWD\") + \"/foo\")"
72             )
74             echo $output
76             [[ "$output" = "it works" ]]
78             mkdir $out
79           '';
80     in
81     {
82       stable = localRepoCheck nixVersions.stable;
83       latest = localRepoCheck nixVersions.latest;
84       git = localRepoCheck nixVersions.git;
85       nix_2_24 = localRepoCheck nixVersions.nix_2_24;
86     };
88   meta = {
89     description = "Plugin to add Pijul support to the Nix package manager";
90     homepage = "https://nest.pijul.com/dblsaiko/nix-plugin-pijul";
91     license = lib.licenses.lgpl3Plus;
92     maintainers = [ lib.maintainers.dblsaiko ];
93     platforms = lib.platforms.unix;
94   };