4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
61 lines
1.4 KiB
Nix
61 lines
1.4 KiB
Nix
{ stdenv
|
|
, buildGoPackage
|
|
, lib
|
|
, fetchFromGitHub
|
|
, buildGoModule
|
|
, sqlite
|
|
, callPackage
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "gotify-server";
|
|
# should be update just like all other files imported like that via the
|
|
# `update.sh` script.
|
|
version = import ./version.nix;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "gotify";
|
|
repo = "server";
|
|
rev = "v${version}";
|
|
sha256 = import ./source-sha.nix;
|
|
};
|
|
|
|
# With `allowGoReference = true;`, `buildGoModule` adds the `-trimpath`
|
|
# argument for Go builds which apparently breaks the UI like this:
|
|
#
|
|
# server[780]: stat /var/lib/private/ui/build/index.html: no such file or directory
|
|
allowGoReference = true;
|
|
|
|
vendorSha256 = import ./vendor-sha.nix;
|
|
|
|
doCheck = false;
|
|
|
|
buildInputs = [ sqlite ];
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
preBuild = ''
|
|
cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && go run hack/packr/packr.go
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = ./update.sh;
|
|
};
|
|
|
|
# Otherwise, all other subpackages are built as well and from some reason,
|
|
# produce binaries which panic when executed and are not interesting at all
|
|
subPackages = [ "." ];
|
|
|
|
buildFlagsArray = [
|
|
"-ldflags=-X main.Version=${version} -X main.Mode=prod"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "A simple server for sending and receiving messages in real-time per WebSocket";
|
|
homepage = "https://gotify.net";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ doronbehar ];
|
|
};
|
|
|
|
}
|