diff --git a/docs/deploying.md b/docs/deploying.md index 20af975d..976d0751 100644 --- a/docs/deploying.md +++ b/docs/deploying.md @@ -10,13 +10,19 @@ Then, run `deploy-rs` with the hostname of the server you want to deploy: For nachtigall.pub.solar: ``` -deploy --targets '.#nachtigall' --magic-rollback false --auto-rollback false +deploy --targets '.#nachtigall' --magic-rollback false --auto-rollback false --keep-result --result-path ./results ``` For flora-6.pub.solar: ``` -deploy --targets '.#flora-6' --magic-rollback false --auto-rollback false +deploy --targets '.#flora-6' --magic-rollback false --auto-rollback false --keep-result --result-path ./results +``` + +For metronom.pub.solar (aarch64-linux): + +``` +deploy --targets '.#metronom' --magic-rollback false --auto-rollback false --keep-result --result-path ./results --remote-build ``` Usually we skip all rollback functionality, but if you want to deploy a change @@ -28,6 +34,11 @@ deployment, add the flag `--skip-checks` at the end of the command. `--dry-activate` can be used to only put all files in place without switching, to enable switching to the new config quickly at a later moment. +We use `--keep-result --result-path ./results` to keep the last `result` +symlink of each `deploy` from being garbage collected. That way, we keep builds +cached in the Nix store. This is optional and both flags can be removed if disk +space is a scarce resource on your machine. + You'll need to have SSH Access to the boxes to be able to run `deploy`. ### Getting SSH access diff --git a/lib/deploy.nix b/lib/deploy.nix index 27453bdb..f94c83ee 100644 --- a/lib/deploy.nix +++ b/lib/deploy.nix @@ -51,23 +51,30 @@ in */ lib.recursiveUpdate (lib.mapAttrs (_: c: { hostname = getFqdn c; - profiles.system = let - system = c.pkgs.system; + profiles.system = + let + system = c.pkgs.system; - # Unmodified nixpkgs - pkgs = import inputs.nixpkgs { inherit system; }; + # Unmodified nixpkgs + pkgs = import inputs.nixpkgs { inherit system; }; - # nixpkgs with deploy-rs overlay but force the nixpkgs package - deployPkgs = import inputs.nixpkgs { - inherit system; - overlays = [ - inputs.deploy-rs.overlay # or deploy-rs.overlays.default - (self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; }) - ]; + # nixpkgs with deploy-rs overlay but force the nixpkgs package + deployPkgs = import inputs.nixpkgs { + inherit system; + overlays = [ + inputs.deploy-rs.overlay # or deploy-rs.overlays.default + (self: super: { + deploy-rs = { + inherit (pkgs) deploy-rs; + lib = super.deploy-rs.lib; + }; + }) + ]; + }; + in + { + user = "root"; + path = deployPkgs.deploy-rs.lib.activate.nixos c; }; - in { - user = "root"; - path = deployPkgs.deploy-rs.lib.activate.nixos c; - }; }) systemConfigurations) extraConfig; }