mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
refactor(systems): pull out inline modules
This commit is contained in:
parent
35177ce911
commit
b339ef65f6
20 changed files with 296 additions and 218 deletions
41
modules/system/deploy.nix
Normal file
41
modules/system/deploy.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
name,
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
in {
|
||||
options = let
|
||||
inherit (inputs.self.lib.lib) json;
|
||||
inherit (lib.types) nullOr;
|
||||
inherit (lib.options) mkOption;
|
||||
in {
|
||||
deploy = mkOption {
|
||||
type = nullOr json.types.attrs;
|
||||
};
|
||||
};
|
||||
config = {
|
||||
deploy = let
|
||||
nixos = config.built;
|
||||
in {
|
||||
sshUser = mkOptionDefault "root";
|
||||
user = mkOptionDefault "root";
|
||||
sshOpts = mkIf (config.type == "NixOS") (
|
||||
mkOptionDefault ["-p" "${builtins.toString (builtins.head nixos.config.services.openssh.ports)}"]
|
||||
);
|
||||
autoRollback = mkOptionDefault true;
|
||||
magicRollback = mkOptionDefault true;
|
||||
fastConnection = mkOptionDefault false;
|
||||
hostname = mkOptionDefault "${name}.local.gensokyo.zone";
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
path = let
|
||||
inherit (inputs.self.legacyPackages.${config.system}.deploy-rs) activate;
|
||||
in
|
||||
activate.nixos nixos;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue