Skip to content

Commit c801899

Browse files
authored
Merge pull request #207 from Flakebi/nixpkgs-cache
Make it possible to not rebuild deploy-rs
2 parents 6416027 + 03b02d2 commit c801899

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,33 @@ A basic example of a flake that works with `deploy-rs` and deploys a simple NixO
8686
}
8787
```
8888

89+
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:
90+
91+
```nix
92+
{
93+
# ...
94+
outputs = { self, nixpkgs, deploy-rs }: let
95+
system = "x86_64-linux";
96+
# Unmodified nixpkgs
97+
pkgs = import nixpkgs { inherit system; };
98+
# nixpkgs with deploy-rs overlay but force the nixpkgs package
99+
deployPkgs = import nixpkgs {
100+
inherit system;
101+
overlays = [
102+
deploy-rs.overlay
103+
(self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; })
104+
];
105+
};
106+
in {
107+
# ...
108+
deploy.nodes.some-random-system.profiles.system = {
109+
user = "root";
110+
path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.some-random-system;
111+
};
112+
};
113+
}
114+
```
115+
89116
### Profile
90117

91118
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.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
name = base.name + "-activate-rs";
7878
text = ''
7979
#!${final.runtimeShell}
80-
exec ${self.packages.${system}.default}/bin/activate "$@"
80+
exec ${final.deploy-rs.deploy-rs}/bin/activate "$@"
8181
'';
8282
executable = true;
8383
destination = "/activate-rs";

0 commit comments

Comments
 (0)