diff options
Diffstat (limited to 'test.nix')
-rw-r--r-- | test.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test.nix b/test.nix new file mode 100644 index 0000000..b708c5e --- /dev/null +++ b/test.nix @@ -0,0 +1,53 @@ +{ nixpkgs ? import <nixpkgs> {} }: + +let inherit (import <nixpkgs/nixos/tests/ssh-keys.nix> nixpkgs) + snakeOilPrivateKey snakeOilPublicKey snakeOilEd25519PrivateKey snakeOilEd25519PublicKey; +in + +nixpkgs.nixosTest { + name = "git-annex-specialremote-ramarkable2"; + + nodes.annex = { + + services.openssh = { + enable = true; + settings.PermitEmptyPasswords = true; + settings.PermitRootLogin = "yes"; + }; + + environment.systemPackages = with nixpkgs; [ + openssh + (callPackage ./default.nix {}) + gitFull + git-annex + ]; + + users.users.root = { + openssh.authorizedKeys.keys = [ snakeOilEd25519PublicKey ]; + }; + + }; + + testScript = '' + machine.start() + + machine.wait_for_open_port(22) + + machine.succeed("mkdir -p /root/.ssh") + machine.succeed("echo ${snakeOilEd25519PublicKey} > /root/.ssh/id_ed25519.pub") + machine.succeed("echo StrictHostKeyChecking no > /root/.ssh/config") + machine.succeed("cp ${snakeOilEd25519PrivateKey} /root/.ssh/id_ed25519") + machine.succeed("chmod 600 /root/.ssh/id_ed25519") + + machine.succeed("ssh localhost echo meow") + + machine.succeed("mkdir -p /root/.local/share/remarkable/xochitl") + + machine.succeed("mkdir -p repo && cd repo") + machine.succeed("git init") + machine.succeed("git annex init") + machine.succeed("git annex initremote localhost type=external externaltype=remarkable2 ssh_destination=localhost encryption=none exporttree=yes") + + machine.succeed("git annex testremote -d --fast localhost") + ''; +} |