aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Melnikov2023-05-11 12:37:24 +0800
committerGitHub2023-05-11 12:37:24 +0800
commitc80189917086e43d49eece2bd86f56813500a0eb (patch)
tree2735ee177239c9de16e9a45ef2a72baa24057ceb
parent64160276cd6569694131ed8864d4d35470a84ec3 (diff)
parent03b02d2097c1e7eb142e086bdc1fa20252246c03 (diff)
Merge pull request #207 from Flakebi/nixpkgs-cache
Make it possible to not rebuild deploy-rs
-rw-r--r--README.md27
-rw-r--r--flake.nix2
2 files changed, 28 insertions, 1 deletions
diff --git a/README.md b/README.md
index 5ba6e8a..af11f78 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/flake.nix b/flake.nix
index 9b8e6eb..9e8bb4e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -77,7 +77,7 @@
name = base.name + "-activate-rs";
text = ''
#!${final.runtimeShell}
- exec ${self.packages.${system}.default}/bin/activate "$@"
+ exec ${final.deploy-rs.deploy-rs}/bin/activate "$@"
'';
executable = true;
destination = "/activate-rs";