-
Notifications
You must be signed in to change notification settings - Fork 77
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
Distribute sources.nix file with package #161
Conversation
One problem I realized with this approach is that |
I think this would be problematic in a lot of cases. Now you have a bootstrap problem: how do you get the niv package so you can get |
I was thinking the same, we'd need to basically copy portions of let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {};
in pkgs.runCommand "sources.nix" {}
"cp ${sources.niv}/nix/sources.nix $out" |
Just kicking around other ideas, this works currently with no changes: { nivSrc ? fetchTarball "https://github.com/nmattia/niv/tarball/master"
}:
let
niv = import nivSrc {};
sources = import "${nivSrc}/nix/sources.nix" { sourcesFile = ./sources.json; };
pkgs = import sources.nixpkgs {};
in
pkgs.mkShell {
buildInputs = [
niv.niv
pkgs.git
];
} If the plan is to move to |
I put together a commit in my dotfiles to see how it would feel to consume niv via The more I think about it, even if you just plan to distribute |
Here's another idea: let
nivSrc = fetchTarball
https://github.com/nmattia/niv/tarball/6f03879b8a91fb0c33c7186da347b914deee3efc;
sources = import "${nivSrc}/nix/sources.nix" {
sourcesFile = ./sources.json;
};
niv = import nivSrc {};
in
niv // sources For reasons I can't understand right now, the following doesn't work: let
sources = import
(builtins.fetchurl
https://raw.githubusercontent.com/nmattia/niv/6f038/nix/sources.nix)
{ sourcesFile = ./sources.json; };
niv = import sources.niv {};
in
niv // sources It looks like anything that doesn't come from |
Ha! @nmattia that's funny, that's pretty much exactly identical to what I ended up landing on in the commit I mentioned: https://github.com/cprussin/dotfiles/blob/master/sources.nix is actually identical to your post, except that I put a |
I know, I copied it from there :) |
I think one of the problems with something like this (even if it did work) is that now users need to be careful to sync the url they use for |
I'm not sure I understand! Can you clarify? |
I think the versions of |
FWIW, I'd probably prefer to just keep checking in Re: getting it from the package. This requires you to build Fetching |
Well not necessarily; the let
sources = import
(builtins.fetchurl
https://raw.githubusercontent.com/nmattia/niv/6f038/nix/sources.nix)
{ sourcesFile = ./sources.json; };
pkgs = import sources.nixpkgs {};
in pkgs.hello Then the idea is still that |
See, this makes me uncomfortable. Now you're replacing bits of a non-niv-managed |
Agreed with @michaelpj, that seems spooky to me. I'd rather just stick with having |
I'm gonna close this PR since it seems obvious to me that this particular idea isn't worth pursuing further, I'm happy to be involved in future discussion/brainsorming/guinnea pig-ing if you find it helpful. |
This PR just adds the
sources.nix
file to the niv package distribution so that it can be referenced instead of copied into projects. This was briefly discussed in #159, I'm not sure if you really wanted to go in this direction @nmattia but I figured I'd put in this PR to help out just in case.