-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adding flake.nix
for nix users.
#91
base: main
Are you sure you want to change the base?
Conversation
For the non nix enlightened can you:
|
@@ -2,3 +2,5 @@ | |||
export CRATES_TUI_CONFIG_HOME=$(pwd)/.config | |||
export CRATES_TUI_DATA_HOME=$(pwd)/.data | |||
export CRATES_TUI_LOG_LEVEL=DEBUG | |||
|
|||
use flake |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For direnv
users who use nix
+ flakes: This will auto-load the dev-shell for you if you cd
into the project.
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
rust-overlay.url = "github:oxalica/rust-overlay"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
cargo-watchdoc.url = "github:ModProg/cargo-watchdoc"; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nixpkgs
well contains all available nix-packages which we need, especially the dependencies.rust-overlay
is basically a toolset for nix to, for example, fetch the latest stable toolchain of rust, whilenixpkgs
isn't that fastflake-parts
provides a better API to write aflake.nix
cargo-watchdoc
: I personally think that this is kinda useful andnixpkgs
hasn't packaged this one yet, so this github link is referring to the official repo to include it into a dev shell
apps.default = { | ||
type = "app"; | ||
program = self'.packages.default; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows nix
users to just run nix run
and crates-tui
will run without installing it.
program = self'.packages.default; | ||
}; | ||
|
||
packages.default = pkgs.callPackage (import ./nix/package.nix) { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line declares a package, provided by this repository (here: crates-tui
).
devShells.default = | ||
let | ||
rust-toolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override { | ||
extensions = [ "rust-src" "rust-analyzer" ]; | ||
}; | ||
in | ||
pkgs.mkShell { | ||
packages = with pkgs; [ | ||
pkg-config | ||
openssl | ||
] ++ [ rust-toolchain inputs.cargo-watchdoc.packages.${system}.default ]; | ||
}; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one declares the dev shell with all required dependencies to just run cargo run
or cargo build
.
@joshka I hope my comments are clearing up some things, if not, feel free to ask :) |
Thanks for the PR! I like the idea of adding nix support in theory. I personally cannot use nix on a work computer because it requires root access so I've avoided it for maintaining a setup for works across multiple machines.
|
Well, I don't mind if it gets removed (of course it would be nice if it stays there ;))
Basically nothing I think. Because I've "included" the meta-data from the crate into the flake. So whenever you change anything to
Aye! I wouldn't mind to get the questions |
Revisiting this, my main question needs a bit more detail. I don't currently understand (as someone not well versed in nix) what value adding this has. Can you expand on that perhaps? What are you looking to achieve here? |
Sure thing! So the main achievements which I'm looking for are:
I hope this clears up some questions. |
A wild pikachu appeared.
Hi! This PR adds a
flake.nix
with a dev-shell and a package so that nix users are able to use a "nightly" version ofcrates-tui
.