parent
a53e5eb676
commit
c52a09d34c
3 changed files with 28 additions and 29 deletions
|
@ -8,6 +8,7 @@
|
||||||
> Changes so far:
|
> Changes so far:
|
||||||
> - Merged a helpful PR for ssh config hostnames https://git.vlt81.de/tristan/nixinate/pulls/49
|
> - Merged a helpful PR for ssh config hostnames https://git.vlt81.de/tristan/nixinate/pulls/49
|
||||||
> - Fixed nix run on non-posix compliant shells like fish by explicitly adding a bash shim to the script
|
> - Fixed nix run on non-posix compliant shells like fish by explicitly adding a bash shim to the script
|
||||||
|
> - Solved https://git.vlt81.de/tristan/nixinate/issues/12 by renaming apps from `nixinate.{$machine_name}` to `nixinate-${machine_name]}`
|
||||||
>
|
>
|
||||||
> PR's welcome :)
|
> PR's welcome :)
|
||||||
|
|
||||||
|
@ -75,12 +76,12 @@ git+file:///etc/nixos
|
||||||
└───myMachine: NixOS configuration
|
└───myMachine: NixOS configuration
|
||||||
```
|
```
|
||||||
|
|
||||||
To finally execute the deployment script, use `nix run .#apps.nixinate.myMachine`
|
To finally execute the deployment script, use `nix run .#apps.nixinate-myMachine`
|
||||||
|
|
||||||
#### Example Run
|
#### Example Run
|
||||||
|
|
||||||
```
|
```
|
||||||
[root@myMachine:/etc/nixos]# nix run .#apps.nixinate.myMachine
|
[root@myMachine:/etc/nixos]# nix run .#apps.nixinate-myMachine
|
||||||
🚀 Deploying nixosConfigurations.myMachine from /nix/store/279p8aaclmng8kc3mdmrmi6q3n76r1i7-source
|
🚀 Deploying nixosConfigurations.myMachine from /nix/store/279p8aaclmng8kc3mdmrmi6q3n76r1i7-source
|
||||||
👤 SSH User: matthew
|
👤 SSH User: matthew
|
||||||
🌐 SSH Host: itchy.scratchy.com
|
🌐 SSH Host: itchy.scratchy.com
|
||||||
|
|
50
flake.nix
50
flake.nix
|
@ -118,32 +118,30 @@
|
||||||
in
|
in
|
||||||
final.writeScript "deploy-${machine}.sh" script;
|
final.writeScript "deploy-${machine}.sh" script;
|
||||||
in
|
in
|
||||||
{
|
(
|
||||||
nixinate = (
|
nixpkgs.lib.genAttrs
|
||||||
nixpkgs.lib.genAttrs
|
(map (a: "nixinate-" + a) validMachines)
|
||||||
validMachines
|
(
|
||||||
(
|
x: {
|
||||||
x: {
|
type = "app";
|
||||||
type = "app";
|
program = toString (mkDeployScript {
|
||||||
program = toString (mkDeployScript {
|
machine = nixpkgs.lib.removePrefix "nixinate-" x;
|
||||||
machine = x;
|
dryRun = false;
|
||||||
dryRun = false;
|
});
|
||||||
});
|
}
|
||||||
}
|
)
|
||||||
)
|
// nixpkgs.lib.genAttrs
|
||||||
// nixpkgs.lib.genAttrs
|
(map (a: "nixinate-" + a + "-dry-run") validMachines)
|
||||||
(map (a: a + "-dry-run") validMachines)
|
(
|
||||||
(
|
x: {
|
||||||
x: {
|
type = "app";
|
||||||
type = "app";
|
program = toString (mkDeployScript {
|
||||||
program = toString (mkDeployScript {
|
machine = nixpkgs.lib.removePrefix "nixinate-" nixpkgs.lib.removeSuffix "-dry-run" x;
|
||||||
machine = nixpkgs.lib.removeSuffix "-dry-run" x;
|
dryRun = true;
|
||||||
dryRun = true;
|
});
|
||||||
});
|
}
|
||||||
}
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
nixinate = forAllSystems (system: pkgs: nixpkgsFor.${system}.generateApps);
|
nixinate = forAllSystems (system: pkgs: nixpkgsFor.${system}.generateApps);
|
||||||
checks = forAllSystems (
|
checks = forAllSystems (
|
||||||
|
|
|
@ -106,7 +106,7 @@ let
|
||||||
nixinator.wait_for_unit("multi-user.target")
|
nixinator.wait_for_unit("multi-user.target")
|
||||||
nixinator.succeed("mkdir ~/.ssh/")
|
nixinator.succeed("mkdir ~/.ssh/")
|
||||||
nixinator.succeed("ssh-keyscan -H nixinatee >> ~/.ssh/known_hosts")
|
nixinator.succeed("ssh-keyscan -H nixinatee >> ~/.ssh/known_hosts")
|
||||||
nixinator.succeed("exec ${deployScript.nixinate.nixinatee.program} >&2")
|
nixinator.succeed("exec ${deployScript.nixinate-nixinatee.program} >&2")
|
||||||
nixinatee.wait_for_unit("nginx.service")
|
nixinatee.wait_for_unit("nginx.service")
|
||||||
nixinatee.wait_for_open_port("80")
|
nixinatee.wait_for_open_port("80")
|
||||||
with subtest("Check that Nginx webserver can be reached by deployer after deployment"):
|
with subtest("Check that Nginx webserver can be reached by deployer after deployment"):
|
||||||
|
|
Loading…
Add table
Reference in a new issue