-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Added nix support #29
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| use flake |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| /target | ||
| /.direnv | ||
| /result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,97 @@ | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| description = "of-the-star's custom rust development flake"; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| inputs = { | ||||||||||||||||||||||||||||||||||||||||
| nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||||||||||||||||||||||||||||||||||||||||
| flake-utils.url = "github:numtide/flake-utils"; | ||||||||||||||||||||||||||||||||||||||||
| crane.url = "github:ipetkov/crane"; | ||||||||||||||||||||||||||||||||||||||||
| rust-overlay = { | ||||||||||||||||||||||||||||||||||||||||
| url = "github:oxalica/rust-overlay"; | ||||||||||||||||||||||||||||||||||||||||
| inputs.nixpkgs.follows = "nixpkgs"; | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| outputs = | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| self, | ||||||||||||||||||||||||||||||||||||||||
| nixpkgs, | ||||||||||||||||||||||||||||||||||||||||
| flake-utils, | ||||||||||||||||||||||||||||||||||||||||
| crane, | ||||||||||||||||||||||||||||||||||||||||
| rust-overlay, | ||||||||||||||||||||||||||||||||||||||||
| }: | ||||||||||||||||||||||||||||||||||||||||
| flake-utils.lib.eachDefaultSystem ( | ||||||||||||||||||||||||||||||||||||||||
| system: | ||||||||||||||||||||||||||||||||||||||||
| let | ||||||||||||||||||||||||||||||||||||||||
| pkgs = import nixpkgs { | ||||||||||||||||||||||||||||||||||||||||
| inherit system; | ||||||||||||||||||||||||||||||||||||||||
| overlays = [ (import rust-overlay) ]; | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| # Builds the rust components from the toolchain file, or defaults back to the latest nightly build | ||||||||||||||||||||||||||||||||||||||||
| rust-toolchain = | ||||||||||||||||||||||||||||||||||||||||
| if builtins.pathExists ./rust-toolchain.toml then | ||||||||||||||||||||||||||||||||||||||||
| pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml | ||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||
| pkgs.rust-bin.selectLatestNightlyWith ( | ||||||||||||||||||||||||||||||||||||||||
| toolchain: | ||||||||||||||||||||||||||||||||||||||||
| toolchain.default.override { | ||||||||||||||||||||||||||||||||||||||||
| # extensions = [ "rust-src" ]; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if rust-toolchain.toml exists in the repo and what channel it specifies
echo "=== Checking for rust-toolchain.toml ==="
fd -t f 'rust-toolchain' --max-depth 1
echo "---"
if [ -f rust-toolchain.toml ]; then
echo "Contents:"
cat rust-toolchain.toml
elif [ -f rust-toolchain ]; then
echo "Contents of rust-toolchain:"
cat rust-toolchain
else
echo "No rust-toolchain file found - nightly fallback WILL be used"
fi
echo ""
echo "=== Checking Cargo.toml for rust-version (MSRV) ==="
rg -n 'rust-version' Cargo.toml || echo "No rust-version field found"Repository: unhappychoice/steamfetch Length of output: 254 🏁 Script executed: #!/bin/bash
# Verify the flake.nix devShell configuration around line 88
echo "=== Checking flake.nix lines 80-95 for RUST_SRC_PATH ==="
sed -n '80,95p' flake.nixRepository: unhappychoice/steamfetch Length of output: 542 🏁 Script executed: #!/bin/bash
# Verify lines 30-40 in flake.nix to confirm rust-src is commented out
echo "=== Checking flake.nix lines 28-42 for rust-src status ==="
sed -n '28,42p' flake.nixRepository: unhappychoice/steamfetch Length of output: 671 Uncomment Two confirmed problems:
Proposed fix rust-toolchain =
if builtins.pathExists ./rust-toolchain.toml then
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
else
- pkgs.rust-bin.selectLatestNightlyWith (
- toolchain:
- toolchain.default.override {
- # extensions = [ "rust-src" ];
- }
- );
+ pkgs.rust-bin.stable.latest.default.override {
+ extensions = [ "rust-src" ];
+ };📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It did catch the flake description, so I'll change that. I assumed it was alright to use the latest nightly build and have it be pinned via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The main issue is still the commented-out extensions = [ "rust-src" ];As for nightly vs stable, that's your call! If the project builds fine with nightly and you prefer it, go ahead and keep it. Just make sure |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| # Instantiates custom craneLib using toolchain | ||||||||||||||||||||||||||||||||||||||||
| craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| src = craneLib.cleanCargoSource ./.; | ||||||||||||||||||||||||||||||||||||||||
| pname = craneLib.crateNameFromCargoToml { cargoToml = ./Cargo.toml; }.pname; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| # Common arguments shared between buildPackage and buildDepsOnly | ||||||||||||||||||||||||||||||||||||||||
| commonArgs = { | ||||||||||||||||||||||||||||||||||||||||
| inherit src; | ||||||||||||||||||||||||||||||||||||||||
| strictDeps = true; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| buildInputs = with pkgs; [ | ||||||||||||||||||||||||||||||||||||||||
| openssl | ||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| nativeBuildInputs = with pkgs; [ | ||||||||||||||||||||||||||||||||||||||||
| pkg-config | ||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| cargoArtifacts = craneLib.buildDepsOnly (commonArgs); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| crane-package = craneLib.buildPackage ( | ||||||||||||||||||||||||||||||||||||||||
| commonArgs | ||||||||||||||||||||||||||||||||||||||||
| // { | ||||||||||||||||||||||||||||||||||||||||
| inherit cargoArtifacts; | ||||||||||||||||||||||||||||||||||||||||
| postInstall = '' | ||||||||||||||||||||||||||||||||||||||||
| mkdir -p $out/bin | ||||||||||||||||||||||||||||||||||||||||
| cp ./target/release/libsteam_api.* $out/bin/. | ||||||||||||||||||||||||||||||||||||||||
| ''; | ||||||||||||||||||||||||||||||||||||||||
of-the-stars marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
| in | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| devShells.default = pkgs.mkShell { | ||||||||||||||||||||||||||||||||||||||||
| # Inherits buildInputs from crane-package | ||||||||||||||||||||||||||||||||||||||||
| inputsFrom = [ crane-package ]; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| # Additional packages for the dev environment | ||||||||||||||||||||||||||||||||||||||||
| packages = with pkgs; [ | ||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| shellHook = ""; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| env = { | ||||||||||||||||||||||||||||||||||||||||
| # Needed for rust-analyzer | ||||||||||||||||||||||||||||||||||||||||
| RUST_SRC_PATH = "${rust-toolchain}/lib/rustlib/src/rust/library"; | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| packages.default = crane-package; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; | ||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.