add blogbox target
This commit is contained in:
parent
e2b41c8129
commit
2ac05607a2
5 changed files with 394 additions and 68 deletions
71
nixos/modules/services/cloud-init.nix
Normal file
71
nixos/modules/services/cloud-init.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.alisceon.cloud-init;
|
||||
defaultShell =
|
||||
if cfg.defaultShell != null then
|
||||
cfg.defaultShell
|
||||
else
|
||||
lib.getExe config.users.users.${cfg.user}.shell;
|
||||
in
|
||||
{
|
||||
options.alisceon.cloud-init = {
|
||||
enable = lib.mkEnableOption "shared cloud-init defaults";
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "alisceon";
|
||||
description = "Default cloud-init user to configure.";
|
||||
};
|
||||
|
||||
gecos = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "Alisceon";
|
||||
description = "GECOS field for the default cloud-init user.";
|
||||
};
|
||||
|
||||
groups = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [
|
||||
"wheel"
|
||||
"systemd-journal"
|
||||
];
|
||||
description = "Groups assigned to the default cloud-init user.";
|
||||
};
|
||||
|
||||
defaultShell = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Shell path for the default cloud-init user.";
|
||||
};
|
||||
|
||||
datasourceList = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [
|
||||
"Oracle"
|
||||
"ConfigDrive"
|
||||
"NoCloud"
|
||||
];
|
||||
description = "cloud-init datasources to allow.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.useNetworkd = lib.mkDefault true;
|
||||
|
||||
services.cloud-init = {
|
||||
enable = true;
|
||||
network.enable = true;
|
||||
settings = {
|
||||
datasource_list = cfg.datasourceList;
|
||||
users = [ "default" ];
|
||||
system_info.default_user = {
|
||||
name = cfg.user;
|
||||
gecos = cfg.gecos;
|
||||
groups = cfg.groups;
|
||||
shell = defaultShell;
|
||||
lock_passwd = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue