Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 71 lines 1.7 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 buildGoModule, 5 sqlite, 6 callPackage, 7 nixosTests, 8 nix-update-script, 9}: 10 11buildGoModule (finalAttrs: { 12 pname = "gotify-server"; 13 version = "2.6.3"; 14 15 src = fetchFromGitHub { 16 owner = "gotify"; 17 repo = "server"; 18 tag = "v${finalAttrs.version}"; 19 hash = "sha256-9vIReA29dWf3QwUYEW8JhzF9o74JZqG4zGobgI+gIWE="; 20 }; 21 22 vendorHash = "sha256-rs6EfnJT6Jgif2TR5u5Tp5/Ozn+4uhSapksyKFnQiCo="; 23 24 # No test 25 doCheck = false; 26 27 buildInputs = [ 28 sqlite 29 ]; 30 31 ui = callPackage ./ui.nix { inherit (finalAttrs) src version; }; 32 33 # Use preConfigure instead of preBuild to keep goModules independent from ui 34 preConfigure = '' 35 cp -r ${finalAttrs.ui} ui/build 36 ''; 37 38 passthru = { 39 updateScript = nix-update-script { 40 extraArgs = [ 41 "--subpackage" 42 "ui" 43 ]; 44 }; 45 tests = { 46 nixos = nixosTests.gotify-server; 47 }; 48 }; 49 50 # Otherwise, all other subpackages are built as well and from some reason, 51 # produce binaries which panic when executed and are not interesting at all 52 subPackages = [ "." ]; 53 54 # Based on LD_FLAGS in upstream's .github/workflows/build.yml: 55 # https://github.com/gotify/server/blob/v2.6.3/.github/workflows/build.yml#L33 56 ldflags = [ 57 "-s" 58 "-X main.Version=${finalAttrs.version}" 59 "-X main.Mode=prod" 60 "-X main.Commit=refs/tags/v${finalAttrs.version}" 61 "-X main.BuildDate=unknown" 62 ]; 63 64 meta = { 65 description = "Simple server for sending and receiving messages in real-time per WebSocket"; 66 homepage = "https://gotify.net"; 67 license = lib.licenses.mit; 68 maintainers = with lib.maintainers; [ doronbehar ]; 69 mainProgram = "server"; 70 }; 71})