-
Notifications
You must be signed in to change notification settings - Fork 84
Create nix flake #463
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
base: main
Are you sure you want to change the base?
Create nix flake #463
Changes from all commits
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 |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ tests/Cargo.lock | |
| .github/install-spirv-tools/Cargo.lock | ||
| rustc-ice-*.txt | ||
| .idea | ||
| .direnv | ||
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,26 @@ | ||
| { | ||
| description = "rust-gpu"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable"; | ||
|
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. I'm not sure what the proper solution is but I will note that this approach has failed in the past: Rust-GPU/rust-gpu-shadertoys#43 (comment) Keeping But it's hard to tell what value of flakes really is outside of e.g. CI. |
||
| rust-overlay.url = "github:oxalica/rust-overlay"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
| }; | ||
|
|
||
| outputs = { nixpkgs, rust-overlay, flake-utils, ... }: | ||
| flake-utils.lib.eachDefaultSystem (system: | ||
| let | ||
| pkgs = import nixpkgs { | ||
| inherit system; | ||
| overlays = [ (import rust-overlay) ]; | ||
| config.allowUnfree = true; | ||
| }; | ||
| rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; | ||
| in | ||
| { | ||
| devShells = { | ||
| default = pkgs.callPackage ./shell.nix { inherit rustToolchain; }; | ||
| android = pkgs.callPackage ./android.nix { inherit rustToolchain; }; | ||
|
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. @alphastrata This means you need to run It looks good to me, but I'm not super familiar with nix myself, so I'll get @eddyb review it as well.
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. Ahh I see. ty.
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. I'm not sure for what the android.nix was used for, I am assuming just to cross compile to android? If so, I think it's fine that it won't allow to run the examples per default as it was already like this before.
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. You can compile the
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. What packages would be missing? I could just try add them to the android devshell |
||
| }; | ||
| }); | ||
| } | ||
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.
Is this common practice? I've never used a repo that came with an
.envrc, and always did it locally, e.g. by running this (with a check that makes it idempotent, just in case I accidentally run it twice in the same directory):(split onto two lines for readability on GitHub, it's just a oneliner in my shell history)
I use
fishso typing any ofenvrc/use nix/direnv allow, and pressing ⬆️, is enough to recall it, but it is a weird thing I came up with when starting to usedirenv(having already been using.git/info/excludehere and there whenever I didn't want to modify.gitignoreetc.).