nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 fetchNpmDeps,
6 npmHooks,
7 nodejs,
8 wails,
9 webkitgtk_4_1,
10 pkg-config,
11 copyDesktopItems,
12 makeDesktopItem,
13 autoPatchelfHook,
14 writeScript,
15}:
16
17buildGoModule (finalAttrs: {
18 pname = "tiny-rdm";
19 version = "1.2.5";
20
21 src = fetchFromGitHub {
22 owner = "tiny-craft";
23 repo = "tiny-rdm";
24 tag = "v${finalAttrs.version}";
25 hash = "sha256-LzZsnO14cyYzmEas23Mrf0I+ZZa7y4ZfLg/gPBLcNc8=";
26 };
27
28 postPatch = ''
29 substituteInPlace frontend/src/App.vue \
30 --replace-fail "prefStore.autoCheckUpdate" "false"
31 '';
32
33 vendorHash = "sha256-dv+1yRl0UUo6lkLjfYAgRDR8pMfuh4lM6JapIXNQG9Q=";
34
35 env = {
36 CGO_ENABLED = 1;
37 npmDeps = fetchNpmDeps {
38 src = "${finalAttrs.src}/frontend";
39 hash = "sha256-0QMakUr2QBDYb/BRMALOACsfknrzimgaNkdFMjg73og=";
40 };
41 npmRoot = "frontend";
42 };
43
44 nativeBuildInputs = [
45 wails
46 pkg-config
47 autoPatchelfHook
48 nodejs
49 npmHooks.npmConfigHook
50 copyDesktopItems
51 ];
52
53 buildInputs = [ webkitgtk_4_1 ];
54
55 buildPhase = ''
56 runHook preBuild
57
58 wails build -m -trimpath -devtools -tags webkit2_41 -o tiny-rdm
59
60 runHook postBuild
61 '';
62
63 desktopItems = [
64 (makeDesktopItem {
65 name = "tiny-rdm";
66 exec = "tiny-rdm %U";
67 icon = "tiny-rdm";
68 type = "Application";
69 terminal = false;
70 desktopName = "Tiny RDM";
71 startupWMClass = "tinyrdm";
72 categories = [ "Office" ];
73 mimeTypes = [ "x-scheme-handler/tinyrdm" ];
74 comment = "Tiny Redis Desktop Manager";
75 })
76 ];
77
78 installPhase = ''
79 runHook preInstall
80
81 install -Dm 0755 build/bin/tiny-rdm $out/bin/tiny-rdm
82 install -Dm 0644 frontend/src/assets/images/icon.png $out/share/pixmaps/tiny-rdm.png
83
84 runHook postInstall
85 '';
86
87 passthru = {
88 inherit (finalAttrs.env) npmDeps;
89 updateScript = writeScript "update-tiny-rdm" ''
90 #!/usr/bin/env nix-shell
91 #!nix-shell -i bash -p bash nix nix-update common-updater-scripts
92 set -eou pipefail
93 version=$(nix eval --log-format raw --raw --file default.nix tiny-rdm.version)
94 nix-update tiny-rdm || true
95 latestVersion=$(nix eval --log-format raw --raw --file default.nix tiny-rdm.version)
96 if [[ "$latestVersion" == "$version" ]]; then
97 exit 0
98 fi
99 update-source-version tiny-rdm "$latestVersion" --source-key=npmDeps --ignore-same-version
100 nix-update tiny-rdm --version skip
101 '';
102 };
103
104 meta = {
105 description = "Modern, colorful, super lightweight Redis GUI client";
106 homepage = "https://github.com/tiny-craft/tiny-rdm";
107 mainProgram = "tiny-rdm";
108 license = with lib.licenses; [ gpl3Plus ];
109 maintainers = [ ];
110 platforms = lib.platforms.linux;
111 };
112})