https://github.com/defelo/deploy-sh
Simple NixOS remote deployment tool
https://github.com/defelo/deploy-sh
Last synced: about 1 month ago
JSON representation
Simple NixOS remote deployment tool
- Host: GitHub
- URL: https://github.com/defelo/deploy-sh
- Owner: Defelo
- License: mit
- Created: 2023-08-26T14:49:03.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2024-12-06T13:08:06.000Z (5 months ago)
- Last Synced: 2025-04-12T04:08:04.426Z (about 1 month ago)
- Language: Shell
- Homepage:
- Size: 38.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deploy-sh
Simple NixOS remote deployment tool## Flake Setup
1. Add adeploy-sh.hosts
output to yourflake.nix
. This has to be an attribute set of NixOS systems.
```nix
{
outputs = {self, nixpkgs, ...}: {
nixosConfigurations = {
foo = nixpkgs.lib.nixosSystem { ... };
bar = nixpkgs.lib.nixosSystem { ... };
baz = nixpkgs.lib.nixosSystem { ... };
};
deploy-sh.hosts = self.nixosConfigurations;
};
}
```
2. Import and configure thedeploy-sh
NixOS module.
```nix
{
inputs = {
deploy-sh.url = "github:Defelo/deploy-sh";
};
outputs = {self, nixpkgs, deploy-sh, ...}: {
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
# ...
modules = [
# ...
deploy-sh.nixosModules.default
{
deploy-sh.targetHost = "[email protected]";
}
];
};
deploy-sh.hosts = self.nixosConfigurations;
};
}
```
3. To be able to use thedeploy
command, adddeploy-sh
to your dev shell.
```nix
{
inputs = {
deploy-sh = "github:Defelo/deploy-sh";
};
outputs = {self, nixpkgs, deploy-sh, ...}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
deploy-sh.packages.${system}.default
];
};
};
}
```## NixOS Module Options
See [flake.nix](https://github.com/Defelo/deploy-sh/blob/develop/flake.nix#L48-L77)## Usage
```
$ nix develop # if you are not using direnv
$ deploy --help
Simple NixOS remote deployment tool (https://github.com/Defelo/deploy-sh)Usage: deploy [OPTIONS] [HOSTS]...
For each host, only the most recent options to its left are taken into account. For
example, `deploy --local foo bar --remote baz` will build hosts foo and bar locally,
and only baz on a remote build host.
All hosts are deployed if no host is specified explicitly.Activation options:
--switch Build and activate the new configuration, and make it the boot default. (default)
--boot Build the new configuration and make it the boot default, but do not activate it.
--test Build and activate the new configuration, but do not add it to the boot menu.
--dry-activate Build the new configuration, but do not activate it.
--reboot Build the new configuration, make it the boot default and reboot into the new system.
--eval Evaluate the new configuration, but neither build nor activate it.Diff options:
--diff Display differences between the current and new configuration
--no-diff Don't display differences between the current and new configuration.
--nvd Display package differences between the current and new configuration. (default)
--no-nvd Don't display package differences between the current and new configuration.Host options:
--local Build the configuration locally and copy the new system to the target host.
--remote Build the configuration on the remote build host.
--build-host Set the host to build the configuration on.
--target-host Set the host to deploy the system on.Build options:
--cache Set a path on the build host where to store a symlink to the new system to avoid garbage collection.
--no-cache Don't store a symlink to the new system on the build host.
--fetch Copy the current system of the target host to the build host before building.
--no-fetch Don't copy the current system of the target host to the build host before building. (default)Options:
-h --help Print help
```