-
Notifications
You must be signed in to change notification settings - Fork 190
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
nimble needs to support system-wide installations #80
Comments
Copying @mindplay-dk and @Varriount because they were discussing packaging nimble with nim on the forums. |
Ok, so first, let me see if I understand your requirements:
So, what currently happens when one attempts these things? I develop on Windows, so the problem is slightly different for me. |
Currently the only way to install to arbitrary locations is to modify the For comparison, ruby's solution to this is that its library loading code supports multiple paths and specifies both system-wide paths and a path in the user's home directory by default. Ruby then iterates through the paths and uses the first one that contains the library to be loaded. |
I'm not an expert on this subject, but FWIW... I hated the way Ruby's package manager worked, where dependencies were installed and shared between projects. In contrast, I love how Composer installs dependencies to your project's own vendor folder, avoiding the clutter and potential conflicts associated with sharing dependencies between projects. Because Nim links everything statically (and produces stand-alone executables by default) sharing dependent packages between projects probably doesn't even make any sense to begin with, so maybe this concern is irrelevant. I also love how Node comes with NPM already installed out of the box - this is the thing I was requesting, primarily. If we have a working de-facto standard package manager for Nim, it should be available right away, encouraging people to create and consume packages and building an ecosystem :-) |
Now that I think about it, I think @mindplay-dk's suggestion to package nimble with nim makes a lot of sense. I originally envisioned packaging nimble separately from nim, but nimble is such an essential part of the nim tooling that I don't really have "separation of concerns" issues with packaging them together. I also think that not having to install nimble separately would be a benefit to end users. This would also make my life easier when I start making Debian and Fedora packages for nim and nimble, as I would have to maintain half as many packages. Again for comparison, Ruby took this route as well. RubyGems is a separate project from Ruby that had to be installed separately, but starting with Ruby 1.9, RubyGems is packaged with Ruby. |
@mindplay-dk: Could you open a PR for the vendor folder functionality? The vendor folder solution is probably better than having to deal with side-by-side system- and user-specific library install locations. Also, jgoodgive from the forums asked about this, so I'm pointing him here. |
Thanks for the vote of confidence, but I'm probably not the right person for the job - I've just barely started learning Nim, and I haven't even used Nimble yet :-) |
@mindplay-dk Eh, what? Nim dynamically links by default. It loads things from dynamic libraries by default. |
@philip-wernersbach I can easily extend Nimble to support multiple |
@dom96: Here are my suggestions:
After that we have the packages and the Windows installer put the nimble binary into the same folder as the nim executable, and so the user can override/upgrade the bundled nimble by installing from Github. |
A bit late to the discussion... +1 for including Nimble with the binary distributions. My suggestions for *nix systems:
|
Go-lang (go-build/go-install/go-get) solves this completely. It has The Go folks have nailed this. Go is very similar to Nim, so I suggest following their lead. The main difference is that Go code can import from URLs (e.g. GitHub), whereas nimble relies on |
That's incorrect. Firstly, Nimble relies on
So I have a small amount of experience with Go, but the experience that I do have with it was enough to get me annoyed with the need to set |
You don't understand. Go allows Other than that difference, the way Go is compiled and the way Nim is compiled are fundamentally similar. If you architect nimble without knowing a great deal about how and why go-install works as it does, then you are missing a huge amount of wisdom developed within Google.
GOPATH is a colon-separated list of workspaces, and each workspace can have multiple git-repos. An element of GOPATH is like a
You want the defaults to do the best thing, right? I understand that laudable goal. But many people juggle multiple projects simultaneously. Please do not require everyone to work the way you do. Many of us work with many people on many projects in parallel, and we are often waiting for changes here and there to get through various channels. If I could work on just one thing at a time, I would. That is a nice position to be in. But normally, I am in negotiations, or waiting for someone to return from vacation, or making changes for an ongoing code-review, etc. The versions in Beyond multiple workspaces, people in this thread are pointing out the need to operate with both local and system (shared) packages in the same build. I'm saying that those are fundamentally different because they have different directory structures. The system installation (at least for other languages) lacks git-repos and intermediate files. A system installation and a workspace will never be the same thing. And I'm further saying that the Go folks have found a solution which works well for a variety of use-cases. I remember the days of much more complexity for Go. Today, But that's go. What about git? When you run git, it checks parent directories until it finds I think I understand where you're coming from. Honestly, I admire your desire for simplicity. I wish my world could be that simple. |
You are correct about my desire for simplicity. I am glad that you acknowledge it :) What happens if I have the same package (of two different versions) in my By the way, I think that we've begun discussing something which is offtopic for this issue. But anyway, another question that I have is, how does Rust's Cargo solve these issues? |
A system-wide installation is related to an ad hoc project if there is a list of directories in the project. I don't need that personally. I'm happy with just one workspace for a set of packages. But some people seem to want multiple workspaces in the same build. When searching, gobuild takes the first package found in the search path. GOROOT would come last. However, if an installed package depends on something which exists in a local workspace version, then the installed package needs to be rebuilt. In that case, lacking permissions in the system directory, you need to "goget" that package. When installing, goinstall would install a given package into the workspace in which it resides. A workspace has an At any rate, this is not my primary interest. I am looking for multiple, unrelated workspaces that I can switch between. This thread shows some support for that idea, but yes, #131 is a better place to discuss it. |
Never install something system-wide beyond my system package manager.That's one thing what I learned from Archlinux. For nimble(and other similar tools),I use it for development dependencies management,under personal folders. One should't use these two type managers in a same place, they will conflicts. So I don't wish nimble to touch my system folder,but add a system-wide folder by agreement that allows extra nim source codes to import is quite necessary for downstream packaging. The easiest way is just add another nimble path, not only $home.
|
Then you won't have to use it. Simple. |
But this didn't solve my related problem…I still need my user to use dirty workaround. |
It will solve your problem. The path to where Nimble will install packages globally will be added to Nim's config file by default (once I implement this feature). |
Thanks a lot. Go is the language I mainly used recently.The package management of golang has a huge issue,there is no version lock officially supported by Google, even their official package don't have any release tag numbers.I can't believe that how these packages are working fine for so long(actually they really didn't break anything but no release tag means no stable guarantee). |
@wicast I'm not sure what you mean by "no version lock". Also, how does this relate to this issue? |
@dom96 I mean they don't write which version of your dependencies are in golang, and go get will using master branch as default. I was considered about the situation when multiple version of a package was needed by two different package.I need to ensure is the naming styles still following When I trying to package nake, I did't follow this pattern but working. Another question is if a newer version is installed in user folder and another older version in global.Which one will nim choose(suppose this two all fit the version value requirement). I have no idea which way is the proper one. And Golang is a really negative example I'd like to tell you,they don't solving version of dependencies , I hope it won't happen to nim. |
/usr has been managed by package managers across many distributions for a long time. Oftentimes language packages defaulting to /usr led to overwritten files and pain for the users. Please consider using /opt" as default. |
I like the approach taken by Composer (and I think npm, not sure) where Instead, your globally installed packages are just dependencies of your Of course, both Composer and npm also maintain a local cache of all I agree that Go's approach is simplistic, though on the other hand, that's
|
This is a huge problem.
That's not me! So I cannot use nimble at all. I cannot avoid this by setting I understand that there are other problems for multi-user systems, but I can circumvent those by setting |
Yeah, this is a massive problem. Another simple fix is to save in |
I'll write up a PR, unless you're already working on it ... |
The question is what to do on Windows. We could check for The other question is how to find I suggest we use |
is this in latest nimble? I am still getting an error unless I explicitly set my $TMPDIR as another user on the system already has files in /tmp/nimblecache/
|
Yes, it should be. Are you sure you're running the latest Nimble? (Try |
no. still not working for me.
|
|
This is wrong, Nimble is installed into ~/.nimble/bin, just like every other Nimble binary package. |
yes, but in that same snippet, I'm also checking the nimble in |
oh, apologies, I should have read further. Well, @cdunn2001's code is definitely in master so I'm not sure what the problem is (https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/tools.nim#L169), maybe it's not being used for some reason? Is TMPDIR and USER in your env? |
yeah. i'm not sure what's going on, but on that cluster env, I have now set my TMPDIR to /tmp/$USER in my .bashrc to get around this problem. |
I'm tracking the proposal for the project local dependencies feature here. It is related to this global nimble dir feature so appreciate all feedback to help finalize the design. |
@genotrance, I'm confused by "localdeps". Not sure what that's for. But I've been using I hope the TMPDIR nimblecache problems are resolved. I don't know what happened in the cluster env for brentp. |
Sure $NIMBLEDIR can be used as well to achieve local deps today, I'll document it. This RFC is to mainly define the behavior and motivation. The code changes are quite minimal but it will be new for users. |
After almost 5 years from opening this issue, Nim still has among the lowest penetration in OS distributions compared to similar languages. Related to nim-lang/RFCs#173 |
Someone (maybe I) added this a while back: https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L49 This should be expanded to include whatever other paths are needed and Nimble needs to be expanded to support these as well. That's it. The only major step is implementing a |
@dom96 It's up to the OS package mantainers to hardcode the correct path in the Nim/Nimble packages and build library packages accordingly. This is how it is done for Python, Rust, Go, C, Perl, Ruby and so on.
These are very simple requirements but need to work reliably over time. |
What if I want every user on my system to have access to a Nimble package that can only be installed via Nimble? That is a use case that I have had in the past. |
@dom96 that's a different use case: a path under /opt for Nimble-installed packages and one under /usr for OS-installed packages - with different behaviors. |
Things have changes. Nim libraries are now packaged in Nix and Gentoo (using custom build systems though, not nimble). |
@CyberTailor would you mind sharing how the OS-provided packages are picked up by Nim and Nimble? Nimble does not support OS-installed packages, and also cannot mix and match packages from multiple |
I just noticed the |
(See http://forum.nim-lang.org/t/656 and http://github.com/Homebrew/homebrew/pull/34693)
I'd like to get nimble into some package managers alongside nim. In order to do this, nimble needs to support being installed to arbitrary system-wide locations, and needs to coexist with the nimble installation in a user's home directory. My solution to this is nimble-wrapper, but there's probably a better way to do this.
The text was updated successfully, but these errors were encountered: