diff options
author | Flakebi | 2023-04-16 15:27:22 +0200 |
---|---|---|
committer | Flakebi | 2023-04-16 16:38:12 +0200 |
commit | 03b02d2097c1e7eb142e086bdc1fa20252246c03 (patch) | |
tree | b2b5b50f867ddb77b16d8ecd7887a0e961bdfeb4 /README.md | |
parent | 8c9ea9605eed20528bf60fae35a2b613b901fd77 (diff) |
Make it possible to not rebuild deploy-rs
Use the deploy-rs from the final packages set. This can avoid rebuilding
deploy-rs when using it in a nixos config. It can use the version cached
in nixpkgs.
Also add instructions to the readme on how to craft an overlay that uses
nixpkgs deploy-rs.
Diffstat (limited to '')
-rw-r--r-- | README.md | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -86,6 +86,33 @@ A basic example of a flake that works with `deploy-rs` and deploys a simple NixO } ``` +In the above configuration, `deploy-rs` is built from the flake, not from nixpkgs. To take advantage of the nixpkgs binary cache, the deploy-rs package can be overwritten in an overlay: + +```nix +{ + # ... + outputs = { self, nixpkgs, deploy-rs }: let + system = "x86_64-linux"; + # Unmodified nixpkgs + pkgs = import nixpkgs { inherit system; }; + # nixpkgs with deploy-rs overlay but force the nixpkgs package + deployPkgs = import nixpkgs { + inherit system; + overlays = [ + deploy-rs.overlay + (self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; }) + ]; + }; + in { + # ... + deploy.nodes.some-random-system.profiles.system = { + user = "root"; + path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.some-random-system; + }; + }; +} +``` + ### Profile This is the core of how `deploy-rs` was designed, any number of these can run on a node, as any user (see further down for specifying user information). If you want to mimic the behaviour of traditional tools like NixOps or Morph, try just defining one `profile` called `system`, as root, containing a nixosSystem, and you can even similarly use [home-manager](https://github.com/nix-community/home-manager) on any non-privileged user. |