Skip to content
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

rebuilding while offline #430

Closed
schmittlauch opened this issue Oct 21, 2018 · 9 comments
Closed

rebuilding while offline #430

schmittlauch opened this issue Oct 21, 2018 · 9 comments

Comments

@schmittlauch
Copy link

When using the default configuration where programs.home-manager.path points to a remote URL it is not possible to rebuild one's home configuration with home-manager switch when not connected to the internet.
I deliberately configured my system config to be rebuildable even when offline, so I ask for either an option to disable updating remote paths or for an autodetection of being offline/ unable to pull in the paths. (GitHub could be down, too)

This is especially important because even adding a line to one's vimrc using home-manager requires a rebuild and should not depend on internet connectivity.

@rycee
Copy link
Member

rycee commented Oct 21, 2018

Thanks for the report. Yeah, for this case I would suggest cloning the Home Manager repository and changing programs.home-manager.path to point to the absolute path of your clone. Something like

programs.home-manager.path = "$HOME/devel/home-manager";

Then update Home Manager using git pull.

The lack of control over remote imports is up to the Nix tools and cannot be controlled by Home Manager.

@schmittlauch
Copy link
Author

As a compromise it'd be nice to manage the home-manager sources via nix-channels as well. Updating the local git repo is an additional effort, but I update the nix-channels anyways.
Is that possible?

@rycee
Copy link
Member

rycee commented Oct 23, 2018

In principle it should straight forward to distribute Home Manager through a channel. But it would require setting up build infrastructure and hosting for the channel directory. Perhaps nixos.org would be willing to lend their hydra and CDN for the purpose?

In any case, I'm unlikely to start looking into this anytime soon due to work and other priorities but would be willing to assist anybody wanting to look into it.

@dtzWill
Copy link
Contributor

dtzWill commented Oct 24, 2018 via email

@Mic92
Copy link
Member

Mic92 commented Oct 29, 2018

You could do the following to use the nix-channel command:

$ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
$ nix-channel --update
$ ls -la .nix-defexpr/channels/home-manager
programs.home-manager.path = "$HOME/.nix-defexpr/channels/home-manager";

At the moment home-manager is only 713K big so downloading everything is probably faster then a git pull. Some nodejs packages itself require the same size to describe its dependencies: NixOS/nixpkgs#49082 (comment)

@rycee do you think this should go to the documentation?

@rycee
Copy link
Member

rycee commented Nov 5, 2018

@Mic92 That's nice! My understanding of the channel format was that it needed some special setup with a binary-cache-url file. If this works then I definitely would like to add it to the documentation. I will try it out as soon as possible. Thanks a lot!

@Mic92
Copy link
Member

Mic92 commented Nov 6, 2018

No the binary cache is orthogonal to the channel, which is literally just a tarball with a default.nix.

@rycee
Copy link
Member

rycee commented Dec 3, 2018

@Mic92 Created #475 to switch the installation instructions to recommend nix-channel instead. No need to set programs.home-manager.path if using home-manager as the channel name.

I've actually intended to support nix-channel for a long time but never got around to it because I assumed it would need some work on the CI side to create a correctly formatted directory: https://nixos.org/nix/manual/#channel-format

@rycee
Copy link
Member

rycee commented Dec 4, 2018

I merged #475 so I'll close this ticket. From now on the recommended way to set up Home Manager is using nix-channel and this will allow the Home Manager expression to be reliably available even while offline.

@rycee rycee closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants