Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix files and install instructions #477

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}";
});
});
}