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

nix: add flake-compat #743

Merged
merged 1 commit into from
Mar 1, 2023
Merged

nix: add flake-compat #743

merged 1 commit into from
Mar 1, 2023

Conversation

0x4A6F
Copy link
Contributor

@0x4A6F 0x4A6F commented Feb 28, 2023

Support nix (non-flakes), continuation of #477.

  • tested changes on top of v12.0.0 (cargo test fails for nix on v13.0.0)

using nix-shell (legacy)

[shell:~/atuin]$ nix-shell
[nix-shell:~/atuin]$ cargo build
[...]
   Compiling atuin-client v12.0.0 (/root/atuin/atuin-client)
   Compiling atuin-server v12.0.0 (/root/atuin/atuin-server)
   Compiling atuin v12.0.0 (/root/atuin)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 34s
[nix-shell:~/atuin]$

using nix-build (legacy)

[shell:~/atuin]$ nix-build -A packages.aarch64-linux.atuin
[...]
/nix/store/ri763ifjs3vrba8s3w64lan24j34mm54-atuin

@vercel
Copy link

vercel bot commented Feb 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
atuin ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 1, 2023 at 6:24PM (UTC)

@ellie
Copy link
Member

ellie commented Feb 28, 2023

Thank you for this!

(cargo test fails for nix on v13.0.0)

Would you be able to elaborate there?

Comment on lines +1 to +10
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably best to just have either default.nix or shell.nix, and not both? nix-shell supports both, but prefers shell.nix - https://nixos.org/manual/nix/stable/command-ref/nix-shell.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can live without a shell.nix. Without default.nix packages attributes can't be built.

@arcuru
Copy link
Sponsor Contributor

arcuru commented Mar 1, 2023

(cargo test fails for nix on v13.0.0)

Would you be able to elaborate there?

The pinned rust version in flake.lock is 1.64, so it fails with

error[E0658]: `let...else` statements are unstable
  --> atuin-client/src/database.rs:29:5

The fix is updating the pinned versions using the command nix flake update, which will change the versions stored in flake.lock to a recent nixpkgs with Rust 1.67. I opened #749

@ellie
Copy link
Member

ellie commented Mar 1, 2023

Ahh I see, thank you! I need to dig into nix sometime, been on my todo basically forever

@ellie ellie merged commit e6ff051 into atuinsh:main Mar 1, 2023
@0x4A6F 0x4A6F deleted the main-nix-flake-compat branch March 1, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants