Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 60 lines 1.5 kB view raw
1{ lib 2, buildGoPackage 3, fetchFromGitHub 4, buildGoModule 5, sqlite 6, callPackage 7}: 8 9buildGoModule rec { 10 pname = "gotify-server"; 11 # should be update just like all other files imported like that via the 12 # `update.sh` script. 13 version = import ./version.nix; 14 15 src = fetchFromGitHub { 16 owner = "gotify"; 17 repo = "server"; 18 rev = "v${version}"; 19 sha256 = import ./source-sha.nix; 20 }; 21 22 # With `allowGoReference = true;`, `buildGoModule` adds the `-trimpath` 23 # argument for Go builds which apparently breaks the UI like this: 24 # 25 # server[780]: stat /var/lib/private/ui/build/index.html: no such file or directory 26 allowGoReference = true; 27 28 vendorSha256 = import ./vendor-sha.nix; 29 30 doCheck = false; 31 32 buildInputs = [ sqlite ]; 33 34 ui = callPackage ./ui.nix { }; 35 36 preBuild = '' 37 cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && go run hack/packr/packr.go 38 ''; 39 40 passthru = { 41 updateScript = ./update.sh; 42 }; 43 44 # Otherwise, all other subpackages are built as well and from some reason, 45 # produce binaries which panic when executed and are not interesting at all 46 subPackages = [ "." ]; 47 48 ldflags = [ 49 "-X main.Version=${version}" "-X main.Mode=prod" 50 ]; 51 52 meta = with lib; { 53 description = "A simple server for sending and receiving messages in real-time per WebSocket"; 54 homepage = "https://gotify.net"; 55 license = licenses.mit; 56 maintainers = with maintainers; [ doronbehar ]; 57 mainProgram = "server"; 58 }; 59 60}