Merge pull request #302570 from evenbrenden/jottad-service

authored by Sandro and committed by GitHub 2e9d7dca bafcff9b

+99
+2
nixos/doc/manual/release-notes/rl-2405.section.md
··· 131 131 132 132 - [mautrix-meta](https://github.com/mautrix/meta), a Matrix <-> Facebook and Matrix <-> Instagram hybrid puppeting/relaybot bridge. Available as services.mautrix-meta 133 133 134 + - [Jottacloud Command-line Tool](https://docs.jottacloud.com/en/articles/1436834-jottacloud-command-line-tool), a CLI for the [Jottacloud](https://jottacloud.com/) cloud storage provider. Available as [user.services.jotta-cli](#opt-user.services.jotta-cli.enable). 135 + 134 136 - [transfer-sh](https://github.com/dutchcoders/transfer.sh), a tool that supports easy and fast file sharing from the command-line. Available as [services.transfer-sh](#opt-services.transfer-sh.enable). 135 137 136 138 - [FCast Receiver](https://fcast.org), an open-source alternative to Chromecast and AirPlay. Available as [programs.fcast-receiver](#opt-programs.fcast-receiver.enable).
+1
nixos/modules/module-list.nix
··· 1029 1029 ./services/networking/jigasi.nix 1030 1030 ./services/networking/jitsi-videobridge.nix 1031 1031 ./services/networking/jool.nix 1032 + ./services/networking/jotta-cli.nix 1032 1033 ./services/networking/kea.nix 1033 1034 ./services/networking/keepalived/default.nix 1034 1035 ./services/networking/keybase.nix
+27
nixos/modules/services/networking/jotta-cli.md
··· 1 + # Jottacloud Command-line Tool {#module-services-jotta-cli} 2 + 3 + The [Jottacloud Command-line Tool](https://docs.jottacloud.com/en/articles/1436834-jottacloud-command-line-tool) is a headless [Jottacloud](https://jottacloud.com) client. 4 + 5 + ## Quick Start {#module-services-jotta-cli-quick-start} 6 + 7 + ```nix 8 + { 9 + user.services.jotta-cli.enable = true; 10 + } 11 + ``` 12 + 13 + This adds `jotta-cli` to `environment.systemPackages` and starts a user service that runs `jottad` with the default options. 14 + 15 + ## Example Configuration {#module-services-jotta-cli-example-configuration} 16 + 17 + ```nix 18 + user.services.jotta-cli = { 19 + enable = true; 20 + options = [ "slow" ]; 21 + package = pkgs.jotta-cli; 22 + }; 23 + ``` 24 + 25 + This uses `jotta-cli` and `jottad` from the `pkgs.jotta-cli` package and starts `jottad` in low memory mode. 26 + 27 + `jottad` is also added to `environment.systemPackages`, so `jottad --help` can be used to explore options.
+43
nixos/modules/services/networking/jotta-cli.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let cfg = config.user.services.jotta-cli; 6 + in { 7 + options = { 8 + user.services.jotta-cli = { 9 + 10 + enable = mkEnableOption "Jottacloud Command-line Tool"; 11 + 12 + options = mkOption { 13 + default = [ "stdoutlog" "datadir" "%h/.jottad/" ]; 14 + example = [ ]; 15 + type = with types; listOf str; 16 + description = "Command-line options passed to jottad."; 17 + }; 18 + 19 + package = lib.mkPackageOption pkgs "jotta-cli" { }; 20 + }; 21 + }; 22 + config = mkIf cfg.enable { 23 + systemd.user.services.jottad = { 24 + 25 + description = "Jottacloud Command-line Tool daemon"; 26 + 27 + serviceConfig = { 28 + Type = "notify"; 29 + EnvironmentFile = "-%h/.config/jotta-cli/jotta-cli.env"; 30 + ExecStart = "${lib.getExe' cfg.package "jottad"} ${concatStringsSep " " cfg.options}"; 31 + Restart = "on-failure"; 32 + }; 33 + 34 + wantedBy = [ "default.target" ]; 35 + wants = [ "network-online.target" ]; 36 + after = [ "network-online.target" ]; 37 + }; 38 + environment.systemPackages = [ pkgs.jotta-cli ]; 39 + }; 40 + 41 + meta.maintainers = with lib.maintainers; [ evenbrenden ]; 42 + meta.doc = ./jotta-cli.md; 43 + }
+1
nixos/tests/all-tests.nix
··· 451 451 jirafeau = handleTest ./jirafeau.nix {}; 452 452 jitsi-meet = handleTest ./jitsi-meet.nix {}; 453 453 jool = import ./jool.nix { inherit pkgs runTest; }; 454 + jotta-cli = handleTest ./jotta-cli.nix {}; 454 455 k3s = handleTest ./k3s {}; 455 456 kafka = handleTest ./kafka.nix {}; 456 457 kanidm = handleTest ./kanidm.nix {};
+25
nixos/tests/jotta-cli.nix
··· 1 + import ./make-test-python.nix ({ pkgs, ... }: { 2 + 3 + name = "jotta-cli"; 4 + meta.maintainers = with pkgs.lib.maintainers; [ evenbrenden ]; 5 + 6 + nodes.machine = { pkgs, ... }: { 7 + user.services.jotta-cli.enable = true; 8 + imports = [ ./common/user-account.nix ]; 9 + }; 10 + 11 + testScript = { nodes, ... }: 12 + let uid = toString nodes.machine.users.users.alice.uid; 13 + in '' 14 + machine.start() 15 + 16 + machine.succeed("loginctl enable-linger alice") 17 + machine.wait_for_unit("user@${uid}.service") 18 + 19 + machine.wait_for_unit("jottad.service", "alice") 20 + machine.wait_for_open_unix_socket("/run/user/${uid}/jottad/jottad.socket") 21 + 22 + # "jotta-cli version" should fail if jotta-cli cannot connect to jottad 23 + machine.succeed('XDG_RUNTIME_DIR=/run/user/${uid} su alice -c "jotta-cli version"') 24 + ''; 25 + })