Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / microbin / default.nix
blob55ebc572b686e457d161fcb5f7b2bf3675686e4a
1 { darwin
2 , fetchFromGitHub
3 , fetchpatch
4 , lib
5 , oniguruma
6 , openssl
7 , pkg-config
8 , rustPlatform
9 , stdenv
12 rustPlatform.buildRustPackage rec {
13   pname = "microbin";
14   version = "2.0.4";
16   src = fetchFromGitHub {
17     owner = "szabodanika";
18     repo = "microbin";
19     rev = "v${version}";
20     hash = "sha256-fsRpqSYDsuV0M6Xar2GVoyTgCPT39dcKJ6eW4YXCkQ0=";
21   };
23   cargoHash = "sha256-7GSgyh2aJ2f8pozoh/0Yxzbk8Wg3JYuqSy/34ywAc2s=";
25   patches = [
26     # Prefix some URLs with args.public_path_as_str() by PeterUpfold
27     # https://github.com/szabodanika/microbin/pull/194
28     # MicroBin returns wrong URLs on deployments with non-root URLs.
29     (fetchpatch {
30       name = "0001-fixup-explicit-urls.patch";
31       url = "https://github.com/szabodanika/microbin/compare/b8a0c5490d681550d982ad02d67a1aaa0897f503..df062134cbaf3fd0ebcb67af8453a4c66844cd13.patch";
32       hash = "sha256-h13FBuzu2O4AwdhRHF5EX5LaKyPeWJAcaV6SGTaYzTg=";
33     })
35     # Minor fixups by LuK1337
36     # https://github.com/szabodanika/microbin/pull/211
37     # Fixup styling, password protected and private pastas.
38     (fetchpatch {
39       name = "0002-minor-fixups.patch";
40       url = "https://github.com/szabodanika/microbin/compare/b8a0c5490d681550d982ad02d67a1aaa0897f503..3b0c025e9b6dc1ca69269541940bdb53032a048a.patch";
41       hash = "sha256-cZB/jx5d6F+C4xOn49TQ1at/Z4ov26efo9PTtWEdCHw=";
42     })
44     # Fix MICROBIN_ETERNAL_PASTA by SouthFox-D
45     # https://github.com/szabodanika/microbin/pull/215
46     # MICROBIN_ETERNAL_PASTA config doesn't work without this.
47     (fetchpatch {
48       name = "0003-fix-microbin-eternal-pasta.patch";
49       url = "https://github.com/szabodanika/microbin/compare/b8a0c5490d681550d982ad02d67a1aaa0897f503..c7c846c64344b8d51500aa9a4b2e9a92de8d09d8.patch";
50       hash = "sha256-gCio73Jt0F7YCFtQxtf6pPBDLNcyOAcfSsiyjLFzEzY=";
51     })
53     # Fix raw pastes returning 404 by GizmoTjaz
54     # https://github.com/szabodanika/microbin/pull/218
55     # Existing pastas return code 404 even when they exist.
56     (fetchpatch {
57       name = "0004-fix-raw-pastas-returning-404.patch";
58       url = "https://github.com/szabodanika/microbin/compare/b8a0c5490d681550d982ad02d67a1aaa0897f503..e789901520824d4bf610d28923097affe85ead7d.patch";
59       hash = "sha256-R47ozwu/FD1kCu5nx4Gf1cOFeLVFdS67K8RNDygwoZM=";
60     })
61   ];
63   nativeBuildInputs = [
64     pkg-config
65   ];
67   buildInputs = [
68     oniguruma
69     openssl
70   ] ++ lib.optionals stdenv.isDarwin [
71     darwin.apple_sdk.frameworks.Security
72   ];
74   env = {
75     OPENSSL_NO_VENDOR = true;
76     RUSTONIG_SYSTEM_LIBONIG = true;
77   };
79   meta = with lib; {
80     description = "Tiny, self-contained, configurable paste bin and URL shortener written in Rust";
81     homepage = "https://github.com/szabodanika/microbin";
82     changelog = "https://github.com/szabodanika/microbin/releases/tag/v${version}";
83     license = licenses.bsd3;
84     maintainers = with maintainers; [ dit7ya figsoda ];
85     mainProgram = "microbin";
86   };