-
Notifications
You must be signed in to change notification settings - Fork 33
barebones flake.nix #532
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
barebones flake.nix #532
Changes from 9 commits
6ccf442
54e738d
04e8675
0feb7ed
1ae6f87
4c24f51
071c4f1
3e0d88e
0fd9ed8
3c32ece
eddc831
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
|
Contributor
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. Hey, I've tested out your PR and you just need to make a few changes to make diff --git a/tmp/.psub.oO4pntvWFW b/flake.nix
index 980c6ba..cadee16 100644
--- a/tmp/.psub.oO4pntvWFW
+++ b/flake.nix
@@ -4,13 +4,17 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
- outputs = { self, flake-utils, nixpkgs }:
+ outputs = { self, flake-utils, nixpkgs, rust-overlay }:
flake-utils.lib.eachDefaultSystem (
system:
let
- pkgs = nixpkgs.legacyPackages.${system};
+ pkgs = nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default;
nativeBuildInputs = with pkgs; [
pkg-config
@@ -19,17 +23,34 @@
buildInputs = with pkgs; [
openssl
];
+
+ toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
+
+ rustPlatform = pkgs.makeRustPlatform {
+ cargo = toolchain;
+ rustc = toolchain;
+ };
in
{
- packages.default = pkgs.rustPlatform.buildRustPackage {
+ packages.default = rustPlatform.buildRustPackage {
pname = "bevy";
version = "0.1.0-dev";
src = ./.;
- cargoLock = {
- lockFile = ./Cargo.lock;
- };
+ cargoLock.lockFile = ./Cargo.lock;
+ cargoBuildFlags = [ "--all" ];
doCheck = false;
+
+ nativeBuildInputs = nativeBuildInputs ++ (with pkgs; [ makeBinaryWrapper ]);
- inherit buildInputs nativeBuildInputs;
+ inherit buildInputs;
+
+ postInstall = ''
+ for bin in $out/bin/bevy{,_lint}; do
+ wrapProgram $bin --set BEVY_LINT_SYSROOT ${toolchain}
+ done
+ '';
};
devShells.default = pkgs.mkShell {A few important points:
Contributor
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. Does setting BEVY_LINT_SYSROOT for the bevy cli (not the bevy_lint cli) do anything, or should it be set for only bevy_cli?
Member
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 Bevy CLI doesn't read
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. These changes should be applied now |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| { | ||
| description = "A Bevy CLI tool and linter"; | ||
|
|
||
| inputs = { | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
| rust-overlay = { | ||
| url = "github:oxalica/rust-overlay"; | ||
| inputs.nixpkgs.follows = "nixpkgs"; | ||
| }; | ||
| }; | ||
|
|
||
| outputs = { self, flake-utils, nixpkgs, rust-overlay }: | ||
| flake-utils.lib.eachDefaultSystem ( | ||
| system: | ||
| let | ||
| pkgs = nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default; | ||
|
|
||
| nativeBuildInputs = with pkgs; [ | ||
| pkg-config | ||
| ]; | ||
|
|
||
| buildInputs = with pkgs; [ | ||
| openssl | ||
| ]; | ||
|
|
||
| toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; | ||
|
|
||
| rustPlatform = pkgs.makeRustPlatform { | ||
| cargo = toolchain; | ||
| rustc = toolchain; | ||
| }; | ||
| in | ||
| { | ||
| packages = { | ||
| default = self.outputs.packages.${system}.bevy; | ||
| bevy = rustPlatform.buildRustPackage { | ||
| pname = "bevy"; | ||
| version = "0.1.0-dev"; | ||
| src = ./.; | ||
| cargoLock.lockFile = ./Cargo.lock; | ||
| cargoBuildFlags = [ "--all" ]; | ||
| doCheck = false; | ||
|
|
||
| nativeBuildInputs = nativeBuildInputs ++ (with pkgs; [ makeBinaryWrapper ]); | ||
| inherit buildInputs; | ||
|
|
||
| postInstall = '' | ||
| for bin in $out/bin/bevy{,_lint}; do | ||
| wrapProgram $bin --set BEVY_LINT_SYSROOT ${toolchain} | ||
| done | ||
| ''; | ||
| }; | ||
| }; | ||
|
|
||
| devShells.default = pkgs.mkShell { | ||
| inherit buildInputs nativeBuildInputs; | ||
| }; | ||
| } | ||
| ); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.