mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 17:43:42 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
70 lines
1.7 KiB
Nix
70 lines
1.7 KiB
Nix
{ lib
|
|
, fetchFromGitHub
|
|
, buildGoModule
|
|
, sqlite
|
|
, callPackage
|
|
, nixosTests
|
|
, nix-update-script
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "gotify-server";
|
|
version = "2.5.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "gotify";
|
|
repo = "server";
|
|
rev = "v${version}";
|
|
hash = "sha256-Na/bxETIgVm1mxMOXWTgYIFFuB6XG1jGvbW6q/n5LRw=";
|
|
};
|
|
|
|
# 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;
|
|
|
|
vendorHash = "sha256-Vnk/c2dzxIXDChobFSP++9uyiFD+SKyxJC9ZwaQ2pVw=";
|
|
|
|
doCheck = false;
|
|
|
|
buildInputs = [
|
|
sqlite
|
|
];
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
preBuild = ''
|
|
if [ -n "$ui" ] # to make the preBuild a no-op inside the goModules fixed-output derivation, where it would fail
|
|
then
|
|
cp -r $ui ui/build
|
|
fi
|
|
'';
|
|
|
|
passthru = {
|
|
# For nix-update to detect the location of this attribute from this
|
|
# derivation.
|
|
inherit (ui) offlineCache;
|
|
updateScript = nix-update-script { };
|
|
tests = {
|
|
nixos = nixosTests.gotify-server;
|
|
};
|
|
};
|
|
|
|
# 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 = [ "." ];
|
|
|
|
ldflags = [
|
|
"-X main.Version=${version}" "-X main.Mode=prod"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Simple server for sending and receiving messages in real-time per WebSocket";
|
|
homepage = "https://gotify.net";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ doronbehar ];
|
|
mainProgram = "server";
|
|
};
|
|
}
|