lol

Merge pull request #246029 from ehmry/eris-go

authored by

Franz Pletz and committed by
GitHub
9640eb39 873064dc

+137 -8
+2
nixos/doc/manual/release-notes/rl-2311.section.md
··· 42 42 43 43 - [systemd-sysupdate](https://www.freedesktop.org/software/systemd/man/systemd-sysupdate.html), atomically updates the host OS, container images, portable service images or other sources. Available as [systemd.sysupdate](opt-systemd.sysupdate). 44 44 45 + - [eris-server](https://codeberg.org/eris/eris-go). [ERIS](https://eris.codeberg.page/) is an encoding for immutable storage and this server provides block exchange as well as content decoding over HTTP and through a FUSE file-system. Available as [services.eris-server](#opt-services.eris-server.enable). 46 + 45 47 ## Backward Incompatibilities {#sec-release-23.11-incompatibilities} 46 48 47 49 - The `boot.loader.raspberryPi` options have been marked deprecated, with intent for removal for NixOS 24.11. They had a limited use-case, and do not work like people expect. They required either very old installs ([before mid-2019](https://github.com/NixOS/nixpkgs/pull/62462)) or customized builds out of scope of the standard and generic AArch64 support. That option set never supported the Raspberry Pi 4 family of devices.
+1
nixos/modules/module-list.nix
··· 807 807 ./services/network-filesystems/davfs2.nix 808 808 ./services/network-filesystems/diod.nix 809 809 ./services/network-filesystems/drbd.nix 810 + ./services/network-filesystems/eris-server.nix 810 811 ./services/network-filesystems/glusterfs.nix 811 812 ./services/network-filesystems/kbfs.nix 812 813 ./services/network-filesystems/kubo.nix
+103
nixos/modules/services/network-filesystems/eris-server.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + let 4 + cfg = config.services.eris-server; 5 + stateDirectoryPath = "\${STATE_DIRECTORY}"; 6 + in { 7 + 8 + options.services.eris-server = { 9 + 10 + enable = lib.mkEnableOption "an ERIS server"; 11 + 12 + package = lib.mkOption { 13 + type = lib.types.package; 14 + default = pkgs.eris-go; 15 + defaultText = lib.literalExpression "pkgs.eris-go"; 16 + description = "Package to use for the ERIS server."; 17 + }; 18 + 19 + decode = lib.mkOption { 20 + type = lib.types.bool; 21 + default = false; 22 + description = '' 23 + Whether the HTTP service (when enabled) will decode ERIS content at /uri-res/N2R?urn:eris:. 24 + Enabling this is recommended only for private or local-only servers. 25 + ''; 26 + }; 27 + 28 + listenCoap = lib.mkOption { 29 + type = lib.types.str; 30 + default = ":5683"; 31 + example = "[::1]:5683"; 32 + description = '' 33 + Server CoAP listen address. Listen on all IP addresses at port 5683 by default. 34 + Please note that the server can service client requests for ERIS-blocks by 35 + querying other clients connected to the server. Whether or not blocks are 36 + relayed back to the server depends on client configuration but be aware this 37 + may leak sensitive metadata and trigger network activity. 38 + ''; 39 + }; 40 + 41 + listenHttp = lib.mkOption { 42 + type = lib.types.str; 43 + default = ""; 44 + example = "[::1]:8080"; 45 + description = "Server HTTP listen address. Do not listen by default."; 46 + }; 47 + 48 + backends = lib.mkOption { 49 + type = with lib.types; listOf str; 50 + description = '' 51 + List of backend URLs. 52 + Add "get" and "put" as query elements to enable those operations. 53 + ''; 54 + example = [ 55 + "bolt+file:///srv/eris.bolt?get&put" 56 + "coap+tcp://eris.example.com:5683?get" 57 + ]; 58 + }; 59 + 60 + mountpoint = lib.mkOption { 61 + type = lib.types.str; 62 + default = ""; 63 + example = "/eris"; 64 + description = '' 65 + Mountpoint for FUSE namespace that exposes "urn:eris:…" files. 66 + ''; 67 + }; 68 + 69 + }; 70 + 71 + config = lib.mkIf cfg.enable { 72 + systemd.services.eris-server = let 73 + cmd = 74 + "${cfg.package}/bin/eris-go server --coap '${cfg.listenCoap}' --http '${cfg.listenHttp}' ${ 75 + lib.optionalString cfg.decode "--decode " 76 + }${ 77 + lib.optionalString (cfg.mountpoint != "") 78 + ''--mountpoint "${cfg.mountpoint}" '' 79 + }${lib.strings.escapeShellArgs cfg.backends}"; 80 + in { 81 + description = "ERIS block server"; 82 + after = [ "network.target" ]; 83 + wantedBy = [ "multi-user.target" ]; 84 + script = lib.mkIf (cfg.mountpoint != "") '' 85 + export PATH=${config.security.wrapperDir}:$PATH 86 + ${cmd} 87 + ''; 88 + serviceConfig = let 89 + umounter = lib.mkIf (cfg.mountpoint != "") 90 + "-${config.security.wrapperDir}/fusermount -uz ${cfg.mountpoint}"; 91 + in { 92 + ExecStartPre = umounter; 93 + ExecStart = lib.mkIf (cfg.mountpoint == "") cmd; 94 + ExecStopPost = umounter; 95 + Restart = "always"; 96 + RestartSec = 20; 97 + AmbientCapabilities = "CAP_NET_BIND_SERVICE"; 98 + }; 99 + }; 100 + }; 101 + 102 + meta.maintainers = with lib.maintainers; [ ehmry ]; 103 + }
+1
nixos/tests/all-tests.nix
··· 252 252 envoy = handleTest ./envoy.nix {}; 253 253 ergo = handleTest ./ergo.nix {}; 254 254 ergochat = handleTest ./ergochat.nix {}; 255 + eris-server = handleTest ./eris-server.nix {}; 255 256 esphome = handleTest ./esphome.nix {}; 256 257 etc = pkgs.callPackage ../modules/system/etc/test.nix { inherit evalMinimalConfig; }; 257 258 activation = pkgs.callPackage ../modules/system/activation/test.nix { };
+23
nixos/tests/eris-server.nix
··· 1 + import ./make-test-python.nix ({ pkgs, lib, ... }: { 2 + name = "eris-server"; 3 + meta.maintainers = with lib.maintainers; [ ehmry ]; 4 + 5 + nodes.server = { 6 + environment.systemPackages = [ pkgs.eris-go pkgs.nim.pkgs.eris ]; 7 + services.eris-server = { 8 + enable = true; 9 + decode = true; 10 + listenHttp = "[::1]:80"; 11 + backends = [ "badger+file:///var/cache/eris.badger?get&put" ]; 12 + mountpoint = "/eris"; 13 + }; 14 + }; 15 + 16 + testScript = '' 17 + start_all() 18 + server.wait_for_unit("eris-server.service") 19 + server.wait_for_open_port(5683) 20 + server.wait_for_open_port(80) 21 + server.succeed("eriscmd get http://[::1] $(echo 'Hail ERIS!' | eriscmd put coap+tcp://[::1]:5683)") 22 + ''; 23 + })
+7 -8
pkgs/servers/eris-go/default.nix
··· 1 - { lib, stdenv, buildGoModule, fetchFromGitea }: 1 + { lib, stdenv, buildGoModule, fetchFromGitea, nixosTests }: 2 2 3 3 buildGoModule rec { 4 4 pname = "eris-go"; 5 - version = "20230202"; 5 + version = "20230729"; 6 6 7 7 src = fetchFromGitea { 8 8 domain = "codeberg.org"; 9 9 owner = "eris"; 10 - repo = pname; 10 + repo = "eris-go"; 11 11 rev = version; 12 - hash = "sha256-o9FRlUtMk1h8sR+am2gNEQOMgAceRTdRusI4a6ikHUM="; 12 + hash = "sha256-yFWmfWmlGL4fC36XsjO/ao/v8FVI20EpXSblZ0EcosI="; 13 13 }; 14 14 15 - vendorHash = "sha256-ZDJm7ZlDBVWLnuC90pOwa608GnuEgy0N/I96vvesZPY="; 15 + vendorHash = "sha256-Z6rirsiiBzH0herQAkxZp1Xr++489qNoiD4fqoLt9/A="; 16 16 17 - postInstall = "ln -s $out/bin/eris-get $out/bin/eris-put"; 18 - # eris-get is a multicall binary 17 + passthru.tests = { inherit (nixosTests) eris-server; }; 19 18 20 19 meta = src.meta // { 21 20 description = "Implementation of ERIS for Go"; 21 + homepage = "https://codeberg.org/eris/eris-go"; 22 22 license = lib.licenses.bsd3; 23 23 maintainers = with lib.maintainers; [ ehmry ]; 24 - mainProgram = "eris-get"; 25 24 broken = stdenv.isDarwin; 26 25 }; 27 26 }