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 Nov 18, 2022
1 parent ee89129 commit cebe488
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ 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

Atuin is available in the Arch Linux [community repository](https://archlinux.org/packages/community/x86_64/atuin/):
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.apple_sdk.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 cebe488

Please sign in to comment.