Skip to content

Commit

Permalink
Add nix files and install instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciencentistguy committed Jul 11, 2022
1 parent f946644 commit 913e9ed
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.env
.idea/
.vscode/
result
76 changes: 42 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
<a href="https://discord.gg/Fq8bJSKPHh"><img src="https://img.shields.io/discord/954121165239115808" /></a>
</p>


[English] | [简体中文]


Atuin replaces your existing shell history with a SQLite database, and records
additional context for your commands. Additionally, it provides optional and
_fully encrypted_ synchronisation of your history between machines, via an Atuin
server.



server.

<p align="center">
<img src="demo.gif" alt="animated" width="80%" />
Expand All @@ -36,10 +31,6 @@ server.
<em>exit code, duration, time and command shown</em>
</p>





As well as the search UI, it can do things like this:

```
Expand Down Expand Up @@ -81,17 +72,17 @@ I wanted to. And I **really** don't want to.
- zsh
- bash
- fish

## Community

Atuin has a community Discord, available [here](https://discord.gg/Fq8bJSKPHh)

# Quickstart

## With the default sync server

This will sign you up for the default sync server, hosted by me. Everything is end-to-end encrypted, so your secrets are safe!

Read more below for offline-only usage, or for hosting your own server.

```
Expand All @@ -101,27 +92,28 @@ atuin register -u <USERNAME> -e <EMAIL> -p <PASSWORD>
atuin import auto
atuin sync
```

### Opt-in to activity graph

Alongside the hosted Atuin server, there is also a service which generates activity graphs for your shell history! These are inspired by the GitHub graph.

For example, here is mine:

![](https://api.atuin.sh/img/ellie.png?token=0722830c382b42777bdb652da5b71efb61d8d387)

If you wish to get your own, after signing up for the sync server, run this

```
curl https://api.atuin.sh/enable -d $(cat ~/.local/share/atuin/session)
```
The response includes the URL to your graph. Feel free to share and/or embed this URL, the token is _not_ a secret, and simply prevents user enumeration.

The response includes the URL to your graph. Feel free to share and/or embed this URL, the token is _not_ a secret, and simply prevents user enumeration.

## Offline only (no sync)

```
bash <(curl https://raw.githubusercontent.com/ellie/atuin/main/install.sh)
atuin import auto
```

Expand All @@ -146,25 +138,41 @@ toolchain, then you can run:
```
cargo install atuin
```

And then follow [the shell setup](#shell-plugin)

### Homebrew

```
brew install atuin
```

And then follow [the shell setup](#shell-plugin)

### MacPorts

Atuin is also available in [MacPorts](https://ports.macports.org/port/atuin/)
Atuin is also available in [MacPorts](https://ports.macports.org/port/atuin/)

```
sudo port install atuin
```


And then follow [the shell setup](#shell-plugin)

### Nix

This repository is a flake, and can be installed using `nix profile`:

```
nix profile install "github:ellie/atuin"
```

Atuin is also available in [nixpkgs](https://github.com/NixOS/nixpkgs):

```
nix-env -f '<nixpkgs>' -iA atuin
```

And then follow [the shell setup](#shell-plugin)

### Pacman
Expand All @@ -174,7 +182,7 @@ Atuin is available in the Arch Linux [community repository](https://archlinux.or
```
pacman -S atuin
```

And then follow [the shell setup](#shell-plugin)

### From source
Expand All @@ -184,7 +192,7 @@ git clone https://github.com/ellie/atuin.git
cd atuin
cargo install --path .
```

And then follow [the shell setup](#shell-plugin)

## Shell plugin
Expand Down Expand Up @@ -228,10 +236,10 @@ atuin init fish | source
```

to your `is-interactive` block in your `~/.config/fish/config.fish` file

### Fig

Install `atuin` shell plugin in zsh, bash, or fish with [Fig](https://fig.io) in one click.
Install `atuin` shell plugin in zsh, bash, or fish with [Fig](https://fig.io) in one click.

<a href="https://fig.io/plugins/other/atuin" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" /></a>

Expand Down
34 changes: 34 additions & 0 deletions atuin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
lib,
stdenv,
fetchFromGitHub,
installShellFiles,
rustPlatform,
libiconv,
Security,
SystemConfiguration,
}:
rustPlatform.buildRustPackage rec {
name = "atuin";

src = lib.cleanSource ./.;

cargoLock.lockFile = ./Cargo.lock;

nativeBuildInputs = [installShellFiles];

buildInputs = lib.optionals stdenv.isDarwin [libiconv Security SystemConfiguration];

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)
'';

meta = with lib; {
description = "Replacement for a shell history which records additional commands context with optional encrypted synchronization between machines";
homepage = "https://github.com/ellie/atuin";
license = licenses.mit;
};
}
43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.outputs.legacyPackages.${system};
in {
packages.atuin = pkgs.callPackage ./atuin.nix {
inherit (pkgs.darwin.frameworks) Security SystemConfiguration;
};
packages.default = self.outputs.packages.${system}.atuin;

devShells.default = self.packages.${system}.default.overrideAttrs (super: {
nativeBuildInputs = with pkgs;
super.nativeBuildInputs
++ [
cargo-edit
clippy
rustfmt
];
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
});
});
}

0 comments on commit 913e9ed

Please sign in to comment.