Comments (13)
Thanks for the info. Can you try out #110 ? It should handle what you are talking about.
from nix-cargo-integration.
A bit smoother. Still had some issues and it took several attempts to get there.
nix-shell -p cargo
cargo new hello-x
cd hello-x/
nix flake init -t github:yusdacra/nix-cargo-integration/919017ea66b17f20df6c5721aacdbcb5e35924f1
hx flake.nix # Edit url to point at commit; rename example crate.
cargo run
git add .
nix run .#generate-lockfiles # Suggested in other error messages, but also fails
nix develop # Fails
nix develop .#hello-x
Most of these issues can easily avoided with some docs - I was just guessing.
How stupid is it to have an devShell just to init a new project so that cargo
can be made available via the flake,
and there is a command to generate the lock file and add it to git without manual work?
eg it can be dropped into without a crate being available.
mkdir hello-x
cd hello-x
nix flake init -t github:yusdacra/nix-cargo-integration
# Either `nix run .#init` Or
nix develop .#bare
cargo init ...
nci-update-crate # command exposed in devshell. Ensures that crate correctly added to flake & set as default.
Maybe this is silly.
from nix-cargo-integration.
The generate-lockfiles app should be working, can you post the error message? Or make a repo with the erroring flake and etc. We could provide a shell but I don't think it's good UX, a nix app should do all of the work ideally (generate-lockfiles). Thanks!
from nix-cargo-integration.
The annoying faff is having to drop into a nix-shell to use cargo to init.
Maybe the template includes the files output "cargo init" so that it can be entered immediately?
I'll make a repo...
from nix-cargo-integration.
Is it that there is a path that is absolute rather than relative?
[nix-shell:~/tmp/hello-x]$ nix run .#generate-lockfiles
trace: Cargo.lock not found for project at path .
Please ensure the lockfile exists for your project.
If you are using a VCS, ensure the lockfile is added to the VCS and not ignored (eg. run `git add /Cargo.lock` for git).
This project will be skipped and won't have any outputs generated.
Run `nix run .#generate-lockfiles` to generate lockfiles for projects that don't have one.
error: manifest path `/Cargo.toml` does not exist
fatal: /Cargo.lock: '/Cargo.lock' is outside repository at '/home/waalge/tmp/hello-x'
from nix-cargo-integration.
https://github.com/waalge/hello-x-nci/commits/main
Some notes of input/output in the commit messages.
from nix-cargo-integration.
Maybe the template includes the files output "cargo init" so that it can be entered immediately?
There is a simple-crate
template included in the templates (you can use it with nix flake init -t github:yusdacra/nix-cargo-integration/flake-parts#simple-crate
, don't forget to change the nci input in the resulting flake to the flake-parts branch too though). That is what you mean by that I assume?
Is it that there is a path that is absolute rather than relative?
This is a bug, I fixed it just now. Please try it again.
from nix-cargo-integration.
That is exactly what I mean :) it works much more smoothly.
If I knew this existed, I would have used this multiple times in the past month to quick spin up a repo to try some library.
Its a bit of a stall for there to be no default shell, and no help message
$ nix develop # <-- BAD
warning: Git tree '/home/waalge/tmp/hello-nci' is dirty
error: flake 'git+file:///home/waalge/tmp/hello-nci' does not provide attribute 'devShells.x86_64-linux.default', 'devShell.x86_64-linux', 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'
Did you mean devShells?
$ nix develop .#my-crate # <-- GOOD
Don't want to over engineer this. But.
Every user is going to want to immediately rename "my-crate". Which has to be done in multiple places. There's an option to add a welcomeText
onto a template, and/or pass args
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-init.html#options
I've not used this, but i'd be interested in trying
from nix-cargo-integration.
I don't think templates with args exist.
I've made some changes here:
https://github.com/waalge/nix-cargo-integration/tree/waalge/flake-parts
from nix-cargo-integration.
Ok, I added welcomeText
's to the examples and tweaked them a bit more. Would be happy if you could check them out, hopefully it should address the issues you had.
from nix-cargo-integration.
Think it looks good.
There are other fairly immediate pit falls
- rust analyzer not working, and having to add
https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/15
I would have thought this was pretty generic. - git submodules not being supported, but this is an artifact of flakes&git so ... i don't think there's anything to do here.
Its just painful how unhelpful nix error messages are.
from nix-cargo-integration.
rust analyzer not working, and having to add
Is this not working in the nix-cargo-integration devshell?
from nix-cargo-integration.
hmm. Maybe it was and then I broke it... not sure. Maybe await someone else reporting it as an issue.
Thanks for assisting with this, and this project
from nix-cargo-integration.
Related Issues (20)
- error: input 'dream2nix/all-cabal-json' follows a non-existent input 'nci' HOT 2
- Doesn't work with workspace package settings HOT 10
- Cross compiling losing std. I think HOT 3
- Use dream2nix v1 HOT 1
- After updating to the latest version, "attribute 'relPath' missing" when generating lockfile HOT 2
- Exposing tests to flake HOT 2
- `drvConfig.mkDerivation.meta` is not propagated to the derivation HOT 1
- Cilppy 'invalid metadata' errors HOT 4
- adding packages to runtimeLibs list causes "cannot coerce a set to a string" error HOT 2
- The overriding stdenv example doesn't seem to work HOT 2
- generate-lockfiles not working HOT 2
- Help running `cargo test` in checks. HOT 1
- `attribute checkProfile missing` HOT 2
- `outputs.apps.${system}` empty even tho `nix run .#<bin>` works HOT 1
- Using `depsDrvConfig` with `nix shell` HOT 2
- Multiple crate configurations from the same src HOT 1
- function 'anonymous lambda' called without required argument 'pkgsBuildHost' HOT 3
- error: function 'anonymous lambda' called without required argument 'buildPackages' HOT 2
- error: linking with `cc` failed: exit status: 1 HOT 5
- `[patch.crates-io]` with local crate fails HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix-cargo-integration.