Skip to content
/ upcast Public

nix-build remotely, no unnecessary copying of store paths!

License

Notifications You must be signed in to change notification settings

proger/upcast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

upcast

tl;dr: you really need upcast if you're using a Mac, like visiting Starbucks or want to avoid wasting your laptop's battery

Upcast builds Nix packages remotely by wrapping nix-build and nix-copy-closure to avoid copying store paths back and forth under the usual Nix Remote Builds semantics.

Showcase

asciicast

upcast build and upcast install wrap around nix-instantiate/nix-build/nix-copy-closure.

Build NixOS configuration on hydra host and install it on node1. Note that upcast build instantiates derivations locally and ships them to a remote host. YMMV if you're using import-from-derivation.

% upcast build -t hydra --nixos -A node1 network.nix \
    | xargs -tn1 upcast install -c ssh_config -f hydra -t node1 --switch

Same example without upcast build if you want to do it locally:

% nix-build -A some-image infra.nix
% upcast install -c ssh_config -t node1 $(readlink ./result)

Nix profile installs

Read more about Nix profiles here.

Profiles are used by NixOS to pin a root system path to a known location.

You can use nix profiles to pin your own packages (or collection of packages using functions like buildEnv).

For example, install a random package and pin it to a hello profile (target-instance needs to be able to access hydra):

upcast build -t hydra -A my-package default.nix | xargs -n1t upcast install -f hydra -p /nix/var/nix/profiles/hello -t target-instance

Performace Tips

Enable OpenSSH ControlMaster

ControlMaster helps speed up subsequent ssh sessions by reusing a single TCP connection. See ssh_config(5).

% cat ~/.ssh/config
Host *
    ControlPath ~/.ssh/master-%r@%h:%p
    ControlMaster auto
    ControlPersist yes

History

A previous version of this app featured a homegrown AWS-only nixops clone and is located at zalora/upcast.

About

nix-build remotely, no unnecessary copying of store paths!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published