aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-22 21:09:14 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-22 21:09:14 +0200
commit2507bb0a7713d7d534a18812e2ed4247cff43325 (patch)
tree6596ae9d9904b9caa19f69db866cdd5aaedfd1ac
parentfeat: Finalize design for fish-shell integration (diff)
downloadatuin-2507bb0a7713d7d534a18812e2ed4247cff43325.zip
fix(nix): Update all references and switch build to crane
Diffstat (limited to '')
-rw-r--r--flake.lock16
-rw-r--r--flake.nix14
-rw-r--r--nix/module.nix2
-rw-r--r--nix/package.nix28
-rw-r--r--tests/basic.nix35
5 files changed, 61 insertions, 34 deletions
diff --git a/flake.lock b/flake.lock
index 4e0070e2..3d285483 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,20 @@
{
"nodes": {
+ "crane": {
+ "locked": {
+ "lastModified": 1784564969,
+ "narHash": "sha256-TkTWNhJV/8Wk3czlbz4bwHZkFCaCHPsOy+oJe4PUiXg=",
+ "owner": "ipetkov",
+ "repo": "crane",
+ "rev": "7930f6c291de6f83c257839d434592aa085f290a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "ipetkov",
+ "repo": "crane",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1781074563,
@@ -18,6 +33,7 @@
},
"root": {
"inputs": {
+ "crane": "crane",
"nixpkgs": "nixpkgs"
}
}
diff --git a/flake.nix b/flake.nix
index 0965e1d0..a149b267 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,17 +1,26 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
+
+ crane = {
+ url = "github:ipetkov/crane";
+ inputs = { };
+ };
};
outputs = {
self,
nixpkgs,
+ crane,
...
}: let
system = "x86_64-linux";
pkgs = nixpkgs.outputs.legacyPackages.${system};
- turtle = pkgs.callPackage ./nix/package.nix {};
+ turtle = pkgs.callPackage ./nix/package.nix {inherit craneLib;};
+
+ craneLib = crane.mkLib pkgs;
+
tests = let
test-turtle = turtle.overrideAttrs {
cargoBuildType = "debug";
@@ -20,6 +29,9 @@
pkgs.testers.runNixOSTest {
imports = [./tests/basic.nix];
defaults = {
+ imports = [
+ module
+ ];
services.turtle.package = test-turtle;
environment.systemPackages = [
test-turtle
diff --git a/nix/module.nix b/nix/module.nix
index 60878e7e..30ff417b 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -89,7 +89,7 @@ in {
wantedBy = ["multi-user.target"];
serviceConfig = {
- ExecStart = "${lib.getExe' cfg.package "atuin"} server start";
+ ExecStart = "${lib.getExe' cfg.package "turtle-server"} start";
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) [cfg.environmentFile];
RuntimeDirectory = "turtle";
RuntimeDirectoryMode = "0700";
diff --git a/nix/package.nix b/nix/package.nix
index 3fd24aee..1f4d5498 100644
--- a/nix/package.nix
+++ b/nix/package.nix
@@ -8,11 +8,11 @@
lib,
stdenv,
installShellFiles,
- rustPlatform,
libiconv,
+ craneLib,
}:
-rustPlatform.buildRustPackage {
- name = "turtle";
+craneLib.buildPackage {
+ pname = "turtle";
version = "19.0.0";
src = lib.cleanSourceWith {
@@ -36,21 +36,25 @@ rustPlatform.buildRustPackage {
|| (lib.strings.hasSuffix ".sql" (builtins.baseNameOf name));
};
- cargoLock = {
- lockFile = ../Cargo.lock;
- # Allow dependencies to be fetched from git and avoid having to set the outputHashes manually
- allowBuiltinFetchGit = true;
+ env = {
+ CARGO_PROFILE = "dev";
};
+ # cargoLock = {
+ # lockFile = ../Cargo.lock;
+ # # Allow dependencies to be fetched from git and avoid having to set the outputHashes manually
+ # allowBuiltinFetchGit = true;
+ # };
+
nativeBuildInputs = [installShellFiles];
buildInputs = lib.optionals stdenv.isDarwin [libiconv];
postInstall = ''
- installShellCompletion --cmd atuin \
- --bash <($out/bin/atuin gen-completions -s bash) \
- --fish <($out/bin/atuin gen-completions -s fish) \
- --zsh <($out/bin/atuin gen-completions -s zsh)
+ installShellCompletion --cmd turtle \
+ --bash <($out/bin/turtle gen-completions -s bash) \
+ --fish <($out/bin/turtle gen-completions -s fish) \
+ --zsh <($out/bin/turtle gen-completions -s zsh)
'';
doCheck = false;
@@ -59,6 +63,6 @@ rustPlatform.buildRustPackage {
description = "Replacement for a shell history which records additional commands context with optional encrypted synchronization between machines";
homepage = "https://github.com/atuinsh/atuin";
license = licenses.mit;
- mainProgram = "atuin";
+ mainProgram = "turtle";
};
}
diff --git a/tests/basic.nix b/tests/basic.nix
index 1ee00071..5ed8ca6c 100644
--- a/tests/basic.nix
+++ b/tests/basic.nix
@@ -13,14 +13,12 @@
imports = [
./common/acme/server.nix
./common/dns/client.nix
- ../nix/module.nix
];
};
name_server = {nodes, ...}: {
imports = [
./common/acme/client.nix
./common/dns/server.nix
- ../nix/module.nix
];
vhack.dns.zones = {
@@ -45,7 +43,6 @@
turtleCfg = config.services.turtle;
in {
imports = [
- ../nix/module.nix
./common/acme/client.nix
./common/dns/client.nix
];
@@ -91,7 +88,6 @@
...
}: {
imports = [
- ../nix/module.nix
./common/acme/client.nix
./common/dns/client.nix
];
@@ -104,7 +100,6 @@
...
}: {
imports = [
- ../nix/module.nix
./common/acme/client.nix
./common/dns/client.nix
];
@@ -115,8 +110,8 @@
testScript = {nodes, ...}: let
mkSyncConfig = pkgs.writeShellScript "write-turtle-sync-config" ''
- mkdir --parents ~/.config/atuin/
- cat << EOF > ~/.config/atuin/config.toml
+ mkdir --parents ~/.config/turtle/
+ cat << EOF > ~/.config/turtle/config.toml
[sync]
address = "https://turtle-sync.server"
@@ -134,10 +129,10 @@
local id
local status
local escaped_command="$(printf '%q ' "$@")"
- id="$(atuin history start -- "$escaped_command")"
+ id="$(turtle history start -- "$escaped_command")"
"$@"
status=$?
- atuin history end --exit $status "$id"
+ turtle history end --exit $status "$id"
return $status
}
# SPDX-SnippetEnd
@@ -160,12 +155,12 @@
for client in [client1, client2]:
client.succeed("${mkSyncConfig}")
- with subtest("Start atuin daemon"):
+ with subtest("Start turtle daemon"):
for client in [client1, client2]:
- client.succeed("systemd-run atuin daemon start")
+ client.succeed("systemd-run turtle-daemon start")
for client in [client1, client2]:
- client.wait_until_succeeds("atuin daemon status")
+ client.wait_until_succeeds("turtle daemon status")
with subtest("Can generate shell history"):
client1.succeed("${runCommandAndRecordInTurtle} echo hi - client 1")
@@ -173,12 +168,12 @@
with subtest("Can sync"):
for client in [client1, client2]:
- client.succeed("atuin sync perform --force")
- client1.succeed("atuin sync perform --force")
+ client.succeed("turtle sync perform")
+ client1.succeed("turtle sync perform")
with subtest("Have correct tasks"):
- hist1 = client1.succeed("atuin history list --format '{command}'").strip().split('\n')
- hist2 = client2.succeed("atuin history list --format '{command}'").strip().split('\n')
+ hist1 = client1.succeed("turtle history list --cmd-only").strip().split('\n')
+ hist2 = client2.succeed("turtle history list --cmd-only").strip().split('\n')
hist1.sort()
hist2.sort()
@@ -196,11 +191,11 @@
client2.succeed("${runCommandAndRecordInTurtle} echo second try - client 2")
for client in [client1, client2]:
- client.succeed("atuin sync perform --force")
- client1.succeed("atuin sync perform --force")
+ client.succeed("turtle sync perform")
+ client1.succeed("turtle sync perform")
- hist1 = client1.succeed("atuin history list --format '{command}'").strip().split('\n')
- hist2 = client2.succeed("atuin history list --format '{command}'").strip().split('\n')
+ hist1 = client1.succeed("turtle history list --cmd-only").strip().split('\n')
+ hist2 = client2.succeed("turtle history list --cmd-only").strip().split('\n')
hist1.sort()
hist2.sort()