Skip to content

Commit 826c32e

Browse files
committed
Add remote deployment script
1 parent e256105 commit 826c32e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

flake.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,35 @@
3636
}
3737
);
3838

39+
apps = forAllSystems (
40+
system:
41+
let
42+
pkgs = nixpkgs.legacyPackages.${system};
43+
44+
deployServerScript = pkgs.writeShellApplication {
45+
name = "deploy-server";
46+
runtimeInputs = [
47+
pkgs.nix
48+
pkgs.openssh
49+
];
50+
text = ''
51+
nix run nixpkgs#nixos-rebuild-ng -- \
52+
--flake .#server \
53+
--target-host [email protected] \
54+
--sudo \
55+
--ask-sudo-password \
56+
switch
57+
'';
58+
};
59+
in
60+
{
61+
deploy-server = {
62+
type = "app";
63+
program = "${deployServerScript}/bin/deploy-server";
64+
};
65+
}
66+
);
67+
3968
nixosConfigurations =
4069
let
4170
mkSystem =

0 commit comments

Comments
 (0)