Add nix files and install instructions (#477)

This commit is contained in:
Jamie Quigley 2023-02-15 09:04:07 +00:00 committed by GitHub
parent dcfad9a90d
commit b2a0986ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 124 additions and 0 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
.env
.idea/
.vscode/
result

View File

@ -173,6 +173,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/):

34
atuin.nix Normal file
View File

@ -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
flake.lock Normal file
View File

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1667379994,
"narHash": "sha256-PFOg8WHqfKXsIGZtEC0aB+rl8SB1cXvA01ytIudnRh8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a704b9029586266f63807f64a6718f1a65b0f83b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View File

@ -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}";
});
});
}