atuin
atuin copied to clipboard
Add nix files and install instructions
Add a flake.nix to facilitate easier development on NixOS, and to allow atuin to be installed using nix profile
. Also add a nix section to the install instructions in the readme
Ignorant question: I know very little about Nix. What's special about this compared to nixpkgs?
The primary benefit of this is that on nixos, I can run nix develop
and get a shell with rustc, cargo etc (generally you don't install dev tools system-wide on nixos, you use devshells). As a side effect, one can nix profile install
this repo to get a git version of atuin, rather than having to wait for a release.
Hey! Thanks for the work here 🚀
Totally happy to get this merged if you could fix up the whitespace changes? The diff is a bit noisy
I'd be happy to clean this up if you wanted merge this, I also use Nix and occasionally contribute to nixpkgs.
I will say though, that any user of NixOS (which I am) can always install the necessary build dependencies with nix develop nixpkgs#atuin
which uses the deps that are maintained in https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/atuin/default.nix.
As an example of what it can be used for, Helix uses it quite extensively to setup identical dev environments with a number of extra tools. The benefits to adding it to the atuin
repo is mainly that Nix users could have tools like rustfmt
and clippy
automatically added to their environments, and as above, it makes it easy for a Nix user to install it from git.
I'd be happy to clean this up if you wanted merge this, I also use Nix and occasionally contribute to nixpkgs.
yes please @patricksjackson, that would be fantastic!
I've cleaned the diffspam in the readme :slightly_smiling_face:
Those clippy warnings are not me - they happen on current main as well
Thank you! Yeah don't worry they're just because there's a new Rust out
@Sciencentistguy I'm seeing this error on my Macbook. Should it have worked?
~/Code/github.com/ellie/atuin (nix-flake)> nix build --show-trace
error: attribute 'frameworks' missing
at /nix/store/vi5q2wxjmvff8al9d54cpi7qmvp99xf1-source/flake.nix:16:18:
15| packages.atuin = pkgs.callPackage ./atuin.nix {
16| inherit (pkgs.darwin.frameworks) Security SystemConfiguration;
| ^
17| };
… while evaluating the attribute 'darwin.frameworks'
...
Considering flakes are technically experimental and will be for the foreseeable future, it's probably a good idea to add a backwards compatible shell.nix
using flake-compat.
In addition, adding a note somewhere to the docs about how to enter the development shell would help let people know that it exists.
@charego can you try replacing pkgs.darwin.frameworks
with pkgs.darwin.apple_sdk.frameworks
instead?
I don't have access to a Mac to confirm, but that should work.
Sorry I keep responding in separate posts, but I'd also suggest adding a Github Action that runs nix flake check
which would catch the frameworks issue pointed out by @charego, and maybe runs a simple nix build
as well to make sure the pinned dependencies don't bitrot.
Adding caching with Cachix would be nice but probably not necessary yet.
add a backwards compatible shell.nix using flake-compat @patricksjackson
flake-compat is obsolete since nix added builtins.getFlake
:
(builtins.getFlake (toString ./.))
.devShells
.${builtins.currentSystem}
.default
Oh interesting, I didn't know about builtins.getFlake
.
But it's only available if flakes are enabled, so it doesn't work for writing a backwards compatible shell.nix
: https://nixos.org/manual/nix/stable/language/builtins.html?#builtins-getFlake