diff options
Diffstat (limited to '')
| -rw-r--r-- | flake.lock | 24 | ||||
| -rw-r--r-- | flake.nix | 18 | ||||
| -rw-r--r-- | modules/by-name/at/atuin-sync/module.nix | 11 | ||||
| -rw-r--r-- | pkgs/by-name/at/atuin-server-only/package.nix | 22 | ||||
| -rw-r--r-- | tests/by-name/at/atuin-sync/test.nix | 35 |
5 files changed, 60 insertions, 50 deletions
@@ -442,7 +442,8 @@ "rust-overlay": "rust-overlay", "simple-nixos-mailserver": "simple-nixos-mailserver", "systems": "systems", - "treefmt-nix": "treefmt-nix" + "treefmt-nix": "treefmt-nix", + "turtle": "turtle" } }, "rust-overlay": { @@ -525,6 +526,27 @@ "repo": "treefmt-nix", "type": "github" } + }, + "turtle": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781376339, + "narHash": "sha256-h7Madx8B9ECeQcpoN79eI2l4+QSSD9o5Sl8vMNRcvxY=", + "ref": "main", + "rev": "478ccf2b33ee06f43a27378992280b8f62de6531", + "revCount": 1833, + "type": "git", + "url": "https://git.foss-syndicate.org/bpeetz/forks/atuin" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://git.foss-syndicate.org/bpeetz/forks/atuin" + } } }, "root": "root", @@ -71,6 +71,12 @@ treefmt-nix.follows = "treefmt-nix"; }; }; + turtle = { + url = "git+https://git.foss-syndicate.org/bpeetz/forks/atuin?ref=main"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; disko = { url = "github:nix-community/disko"; inputs = { @@ -112,6 +118,7 @@ # modules agenix, back, + turtle, disko, impermanence, simple-nixos-mailserver, @@ -140,12 +147,21 @@ specialArgs = attrs // { - inherit pkgsUnstable vhackPackages nixpkgs-unstable nixos-lib extraModules nixLib; + inherit + pkgsUnstable + vhackPackages + nixpkgs-unstable + nixos-lib + extraModules + nixLib + turtle + ; }; extraModules = [ agenix.nixosModules.default back.nixosModules.default + turtle.nixosModules.default disko.nixosModules.default impermanence.nixosModules.impermanence simple-nixos-mailserver.nixosModule diff --git a/modules/by-name/at/atuin-sync/module.nix b/modules/by-name/at/atuin-sync/module.nix index e0d75bb..4295697 100644 --- a/modules/by-name/at/atuin-sync/module.nix +++ b/modules/by-name/at/atuin-sync/module.nix @@ -1,13 +1,12 @@ { config, lib, - vhackPackages, ... }: let cfg = config.vhack.atuin-sync; in { options.vhack.atuin-sync = { - enable = lib.mkEnableOption "atuin sync server"; + enable = lib.mkEnableOption "atuin (turtle) sync server"; fqdn = lib.mkOption { description = "The fully qualified domain name of this instance."; @@ -19,17 +18,13 @@ in { config = lib.mkIf cfg.enable { vhack.nginx.enable = true; - vhack.anubis.instances."${cfg.fqdn}".target = "http://127.0.0.1:${toString config.services.atuin.port}"; + vhack.anubis.instances."${cfg.fqdn}".target = "http://127.0.0.1:${toString config.services.turtle.port}"; services = { - atuin = { + turtle = { enable = true; - package = vhackPackages.atuin-server-only; host = "127.0.0.1"; - # Nobody knows about the fqdn and even if, they can only upload encrypted blobs. - openRegistration = true; - database.createLocally = true; }; }; diff --git a/pkgs/by-name/at/atuin-server-only/package.nix b/pkgs/by-name/at/atuin-server-only/package.nix deleted file mode 100644 index ddad2ec..0000000 --- a/pkgs/by-name/at/atuin-server-only/package.nix +++ /dev/null @@ -1,22 +0,0 @@ -{atuin}: -atuin.overrideAttrs (final: prev: { - pname = prev.pname + "-server-only"; - inherit (prev) patches; - - # atuin's default features include 'check-updates', which do not make sense - # for distribution builds. List all other default features. - buildNoDefaultFeatures = true; - buildFeatures = [ - # All of this is client code - # "client" - # "sync" - # "check-update" - # "clipboard" - # "daemon" # Background daemon for the client - - "server" - ]; - - # The checks don't compile without the `server` feature - doCheck = true; -}) diff --git a/tests/by-name/at/atuin-sync/test.nix b/tests/by-name/at/atuin-sync/test.nix index d65c216..0f2cd24 100644 --- a/tests/by-name/at/atuin-sync/test.nix +++ b/tests/by-name/at/atuin-sync/test.nix @@ -6,6 +6,7 @@ pkgs, extraModules, nixLib, + turtle, ... }: nixos-lib.runTest { @@ -21,6 +22,7 @@ nixos-lib.runTest { nodes = let atuinSession = "01969ec6b8d07e30a9d2df0911fbfe2a"; + atuin = turtle.packages."${pkgs.stdenv.hostPlatform.system}".default; in { acme = { imports = [ @@ -83,7 +85,7 @@ nixos-lib.runTest { environment.sessionVariables.ATUIN_SESSION = atuinSession; environment.systemPackages = [ - pkgs.atuin + atuin pkgs.sqlite-interactive ]; }; @@ -96,29 +98,22 @@ nixos-lib.runTest { environment.sessionVariables.ATUIN_SESSION = atuinSession; environment.systemPackages = [ - pkgs.atuin + atuin pkgs.sqlite-interactive ]; }; }; testScript = {nodes, ...}: let - syncLogin = pkgs.writeShellScript "login-atuin-sync-account" '' - atuin login --username syncy --password password1234 --key "$1" - ''; - - syncRegister = pkgs.writeShellScript "register-atuin-sync-account" '' - atuin register --username syncy --email syncy@email.com --password password1234 - ''; - mkSyncConfig = pkgs.writeShellScript "register-atuin-sync-account" '' mkdir --parents ~/.config/atuin/ + cat << EOF > ~/.config/atuin/config.toml - sync_address = "https://atuin-sync.server" - # Use the v2 sync [sync] - records = true + address = "https://atuin-sync.server" + user_id_path = "${pkgs.writeText "user-id" "019eb88a-6b51-7e52-b12c-7d30bd8e5928"}" + encryption_key_path = "${pkgs.writeText "encryption-key" "3AAgbWsDzL7M00/Mq0LMjsyOCy3MnsypBsyQzKbMywNGzNnMrUBozIINAxdbIiDMhQ=="}" EOF ''; @@ -147,7 +142,7 @@ nixos-lib.runTest { acme.prepare ["server" "client1" "client2"] # Python '' - server.wait_for_unit("atuin.service") + server.wait_for_unit("turtle.service") server.wait_for_open_port(443) # Wait for the server to acquire the acme certificate @@ -158,8 +153,12 @@ nixos-lib.runTest { for client in [client1, client2]: client.succeed("${mkSyncConfig}") - client1.succeed("${syncRegister}") - client2.succeed(f"${syncLogin} '{client1.succeed("atuin key")}'") + with subtest("Start atuin daemons"): + for client in [client1, client2]: + client.succeed("systemd-run atuin daemon start") + + for client in [client1, client2]: + client.wait_until_succeeds("atuin daemon status") with subtest("Can import shell history"): client1.succeed("${runCommandAndRecordInAtuin} echo hi - client 1") @@ -167,8 +166,8 @@ nixos-lib.runTest { with subtest("Can sync tasks"): for client in [client1, client2]: - client.succeed("atuin sync --force") - client1.succeed("atuin sync --force") + client.succeed("atuin sync perform --force") + client1.succeed("atuin sync perform --force") with subtest("Have correct tasks"): |
