Skyler Grey
0add9248e7
https://reuse.software is a way of specifying licenses in a simple way that easily allows us to specify multiple licenses in a project and check that we are correctly specifying our licenses We plan to add an MIT-licensed file to the project in a future commit, which prompted us to look at REUSE to make this simpler
64 lines
1.6 KiB
Nix
64 lines
1.6 KiB
Nix
# SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
{
|
|
lib,
|
|
inputs,
|
|
}: let
|
|
inherit (inputs) deploy-rs;
|
|
in rec {
|
|
## Create deployment configuration for use with deploy-rs.
|
|
##
|
|
## ```nix
|
|
## mkDeploy {
|
|
## inherit self;
|
|
## overrides = {
|
|
## my-host.system.sudo = "doas -u";
|
|
## };
|
|
## }
|
|
## ```
|
|
##
|
|
#@ { self: Flake, overrides: Attrs ? {} } -> Attrs
|
|
mkDeploy = {
|
|
self,
|
|
overrides ? {},
|
|
}: let
|
|
hosts = self.nixosConfigurations or {};
|
|
names = builtins.attrNames hosts;
|
|
nodes =
|
|
lib.foldl
|
|
(result: name: let
|
|
host = hosts.${name};
|
|
user = host.config.users.infra or null;
|
|
inherit (host.pkgs) system;
|
|
in
|
|
result
|
|
// {
|
|
${name} =
|
|
(overrides.${name} or {})
|
|
// {
|
|
hostname = overrides.${name}.hostname or "${name}";
|
|
profiles =
|
|
(overrides.${name}.profiles or {})
|
|
// {
|
|
system =
|
|
(overrides.${name}.profiles.system or {})
|
|
// {
|
|
path = deploy-rs.lib.${system}.activate.nixos host;
|
|
}
|
|
// {
|
|
user = "root";
|
|
sshUser = "infra";
|
|
}
|
|
// lib.optionalAttrs host.config.auxolotl.security.doas.enable {
|
|
sudo = "doas -u";
|
|
};
|
|
};
|
|
};
|
|
})
|
|
{}
|
|
names;
|
|
in {inherit nodes;};
|
|
}
|