Fediversity/deployment/fediversity/ssh-host.nix
Kiara Grouwstra c296bdab0a
deploy separate operator applications thru data model
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-11-22 17:55:10 +01:00

97 lines
2.9 KiB
Nix

{
system,
nodeName,
network,
sources ? import ../../npins,
conf ? { },
...
}@args:
let
inherit (sources) nixpkgs;
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib;
pathToRoot = builtins.path {
path = ../..;
name = "root";
};
sshOpts = [ ];
in
(pkgs.callPackage ../utils.nix { }).evalModel (
{ config, modulesPath, ... }:
{
imports = [
# "${modulesPath}/profiles/minimal.nix"
./resources
./applications
./configurations.nix
../../infra/common/options.nix
# ../../infra/common/proxmox-qemu-vm.nix
];
options = {
# inherit (config) default-configuration;
# inherit (conf) default-configuration;
# conf = lib.mkOption {
# default = conf;
# };
default = lib.mkOption {
type = config.deployment-type;
default = config.environments.default.deployment {
deployment-name = "default";
configuration = config."default-configuration";
};
};
};
config = lib.mkMerge [
{
environments.default = environment: {
resources."external".garage = { };
resources."fediversity".nixos-module = { };
resources."fixed-host".network = network;
resources."age".secrets = { };
implementation =
{
required-resources,
deployment-name,
...
}:
let
garage = environment.config.resources."external".garage.process required-resources;
# TODO use garage.garageSide
in
# builtins.trace required-resources.peertube.resources.peertube-bucket
{
ssh-host = {
nixos-configuration = {
imports =
[
../../infra/common/nixos
"${sources.disko}/module.nix"
"${modulesPath}/profiles/qemu-guest.nix"
(environment.config.resources."fixed-host".network.process required-resources)
(environment.config.resources."age".secrets.process required-resources)
]
++ (environment.config.resources."fediversity".nixos-module.process required-resources)
++ garage.applicationSide;
};
inherit system;
ssh = {
username = "root";
host = nodeName;
key-file = null;
inherit sshOpts;
};
caller = "deployment/fediversity/ssh-host.nix";
inherit args deployment-name;
root-path = pathToRoot;
};
};
};
}
conf
# splice global config into apps using it
{
default-configuration.applications.pixelfed = { inherit (conf.default-configuration) initialUser; };
}
];
}
)