nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildGoModule,
3 buildNpmPackage,
4 nix-update-script,
5 versionCheckHook,
6 fetchFromCodeberg,
7 lib,
8}:
9let
10 version = "0.11.4";
11
12 src = fetchFromCodeberg {
13 repo = "gose";
14 owner = "stv0g";
15 tag = "v${version}";
16 hash = "sha256-T6PD6MI1IOAgtPOJuPSZp4te9BokKfj+TZHLRqt2FCo=";
17 };
18
19 frontend = buildNpmPackage {
20 pname = "gose-frontend";
21 inherit version;
22 src = "${src}/frontend";
23
24 npmDepsHash = "sha256-p24s2SgCL8E9vUoZEyWSrd15IdkprneAXS7dwb7UbyA=";
25
26 installPhase = ''
27 runHook preInstall
28 find ./dist
29 mkdir $out
30 cp -r dist/* $out/
31 runHook postInstall
32 '';
33 };
34in
35buildGoModule {
36 pname = "gose";
37 inherit version;
38 inherit src;
39
40 vendorHash = "sha256-PTu4OzVjGVExuNDsK01p3/gAwNhDZbPewhI476m5i/M=";
41
42 env.CGO_ENABLED = 0;
43
44 postInstall = ''
45 mv $out/bin/cmd $out/bin/gose
46 '';
47
48 tags = [ "embed" ];
49 ldflags = [
50 "-s"
51 "-w"
52 "-X main.version=${version}"
53 "-X main.builtBy=Nix"
54 ];
55
56 # Skipping test which relies on internet services.
57 checkFlags = "-skip TestShortener";
58
59 nativeInstallCheckInputs = [
60 versionCheckHook
61 ];
62 versionCheckProgramArg = "-version";
63 doInstallCheck = true;
64
65 prePatch = ''
66 cp -r ${frontend} frontend/dist
67 '';
68
69 passthru.updateScript = nix-update-script { };
70
71 meta = {
72 description = "Modern and scalable file-uploader focusing on scalability and simplicity";
73 homepage = "https://github.com/stv0g/gose";
74 license = lib.licenses.asl20;
75 maintainers = with lib.maintainers; [ stv0g ];
76 mainProgram = "gose";
77 };
78}