mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
eris-go: 20231119 -> 20231219
This commit is contained in:
parent
a7bdd229cd
commit
b736a8a801
3 changed files with 50 additions and 28 deletions
|
@ -3,6 +3,7 @@
|
|||
let
|
||||
cfg = config.services.eris-server;
|
||||
stateDirectoryPath = "\${STATE_DIRECTORY}";
|
||||
nullOrStr = with lib.types; nullOr str;
|
||||
in {
|
||||
|
||||
options.services.eris-server = {
|
||||
|
@ -26,7 +27,7 @@ in {
|
|||
};
|
||||
|
||||
listenCoap = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
type = nullOrStr;
|
||||
default = ":5683";
|
||||
example = "[::1]:5683";
|
||||
description = ''
|
||||
|
@ -39,8 +40,8 @@ in {
|
|||
};
|
||||
|
||||
listenHttp = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
type = nullOrStr;
|
||||
default = null;
|
||||
example = "[::1]:8080";
|
||||
description = "Server HTTP listen address. Do not listen by default.";
|
||||
};
|
||||
|
@ -58,8 +59,8 @@ in {
|
|||
};
|
||||
|
||||
mountpoint = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
type = nullOrStr;
|
||||
default = null;
|
||||
example = "/eris";
|
||||
description = ''
|
||||
Mountpoint for FUSE namespace that exposes "urn:eris:…" files.
|
||||
|
@ -69,33 +70,44 @@ in {
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [{
|
||||
assertion = lib.strings.versionAtLeast cfg.package.version "20231219";
|
||||
message =
|
||||
"Version of `config.services.eris-server.package` is incompatible with this module";
|
||||
}];
|
||||
|
||||
systemd.services.eris-server = let
|
||||
cmd =
|
||||
"${cfg.package}/bin/eris-go server --coap '${cfg.listenCoap}' --http '${cfg.listenHttp}' ${
|
||||
lib.optionalString cfg.decode "--decode "
|
||||
}${
|
||||
lib.optionalString (cfg.mountpoint != "")
|
||||
''--mountpoint "${cfg.mountpoint}" ''
|
||||
}${lib.strings.escapeShellArgs cfg.backends}";
|
||||
cmd = "${cfg.package}/bin/eris-go server"
|
||||
+ (lib.optionalString (cfg.listenCoap != null)
|
||||
" --coap '${cfg.listenCoap}'")
|
||||
+ (lib.optionalString (cfg.listenHttp != null)
|
||||
" --http '${cfg.listenHttp}'")
|
||||
+ (lib.optionalString cfg.decode " --decode")
|
||||
+ (lib.optionalString (cfg.mountpoint != null)
|
||||
" --mountpoint '${cfg.mountpoint}'");
|
||||
in {
|
||||
description = "ERIS block server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = lib.mkIf (cfg.mountpoint != "") ''
|
||||
environment.ERIS_STORE_URL = toString cfg.backends;
|
||||
script = lib.mkIf (cfg.mountpoint != null) ''
|
||||
export PATH=${config.security.wrapperDir}:$PATH
|
||||
${cmd}
|
||||
'';
|
||||
serviceConfig = let
|
||||
umounter = lib.mkIf (cfg.mountpoint != "")
|
||||
umounter = lib.mkIf (cfg.mountpoint != null)
|
||||
"-${config.security.wrapperDir}/fusermount -uz ${cfg.mountpoint}";
|
||||
in {
|
||||
ExecStartPre = umounter;
|
||||
ExecStart = lib.mkIf (cfg.mountpoint == "") cmd;
|
||||
ExecStopPost = umounter;
|
||||
Restart = "always";
|
||||
RestartSec = 20;
|
||||
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
||||
};
|
||||
in if (cfg.mountpoint == null) then {
|
||||
ExecStart = cmd;
|
||||
} else
|
||||
{
|
||||
ExecStartPre = umounter;
|
||||
ExecStopPost = umounter;
|
||||
} // {
|
||||
Restart = "always";
|
||||
RestartSec = 20;
|
||||
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,18 +1,30 @@
|
|||
{ lib, stdenv, buildGoModule, fetchFromGitea, nixosTests }:
|
||||
{ lib, stdenv, buildGoModule, fetchFromGitea, mandoc, tup, nixosTests }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "eris-go";
|
||||
version = "20230914";
|
||||
version = "20231219";
|
||||
outputs = [ "out" "man" ];
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "codeberg.org";
|
||||
owner = "eris";
|
||||
repo = "eris-go";
|
||||
rev = version;
|
||||
hash = "sha256-7aEsCQ+bZ//6Z+XXAEHgsAd61L+QgRl77+UtHr/BM1g=";
|
||||
hash = "sha256-eXLfBkJgG51ZjR1qXRE2BgTrIpQsPW5SKeMlGd3J1NE=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-Z6rirsiiBzH0herQAkxZp1Xr++489qNoiD4fqoLt9/A=";
|
||||
vendorHash = "sha256-pA/fz7JpDwdTRFfLDY0M6p9TeBOK68byhy/0Cw53p4M=";
|
||||
|
||||
nativeBuildInputs = [ mandoc tup ];
|
||||
|
||||
postConfigure = ''
|
||||
rm -f *.md
|
||||
tupConfigure
|
||||
'';
|
||||
postBuild = "tupBuild";
|
||||
postInstall = ''
|
||||
install -D *.1.man -t $man/share/man/man1
|
||||
'';
|
||||
|
||||
skipNetworkTests = true;
|
||||
|
|
@ -7997,8 +7997,6 @@ with pkgs;
|
|||
|
||||
endlessh-go = callPackage ../servers/endlessh-go { };
|
||||
|
||||
eris-go = callPackage ../servers/eris-go { };
|
||||
|
||||
ericw-tools = callPackage ../applications/misc/ericw-tools { };
|
||||
|
||||
cryfs = callPackage ../tools/filesystems/cryfs { };
|
||||
|
|
Loading…
Reference in a new issue