Closed Thesola10 closed 1 year ago
Sure sounds good. Feel invited to open a PR
Never mind that, while attempting to bump the nixpkgs version I found out that static Nix binaries can now use a chroot out of the box since 2.10
I'm looking into building a Nix user experience à la gradlew
with a much simpler design leveraging this new feature
Nixie is the result of this line of thinking, and is very close to native macOS support too!
Interesting to see an alternative solution emerging. I'd be happy to deprecate nix-portable in favor of a better solution.
Things that I like about the nixie approach which are missing from nix-portable:
Drawbacks that I currently see with nixie's approach:
nix-shell
are currently broken on all distros except nixos.What are your thoughts regarding these drawbacks?
I have the following ideas how we could move the whole story forward:
nix-static
becomes reliable.nix-static
or nixie
. (Or maybe build something like fakedir for linux, as a more minimal alternative for proot).Some additional ideas:
I think for some environments, especially like docker containers, the best option would be to just create /nix
instead of using a fragile sandboxing solution like proot. Maybe that could be a valid approach for macos as well. If /nix
doesn't exist, try creating it via sudo or instruct the user on how to create it.
You raise some very good points, so let me address some of the drawbacks:
<nixpkgs>
channel. The intended workaround is the ability (and automated default) to embed Nixpkgs into the script's resource tarball.git
executable. The Nixie script itself requires git
, and being run in a Git repository, so any usage where git
is missing is unsupported.proot
.As for the Docker thing, I've made sure that the script works out-of-the-box in the nixos/nix
image, and I assume users usually have a say on which image to use in most Docker environments. I might add a flag for rootful Nix setup, or falling back to the official Nix installer.
This would allow for
nix-portable
to be used in much the same way asgradlew
and be shipped with projects. On systems with Nix,nix-portable
would be able to detect and run the system-wide install of Nix instead of itself. This behaviour could be modified with a flag or environment variable.Alternatively,
nix-portable
could obtain access to the system-wide Nix store or talk to the system-wide Nix daemon if it detects it, so that the sandbox is retained, but the risk of data duplication is reduced