virtualisation.lxc: apply changes from review
This commit is contained in:
parent
9f66f9a669
commit
681bd59661
1 changed files with 26 additions and 7 deletions
|
@ -62,6 +62,32 @@ in
|
|||
templates = mkOption {
|
||||
description = "Templates for LXD";
|
||||
type = types.attrsOf (types.submodule (templateSubmodule));
|
||||
example = literalExample ''
|
||||
{
|
||||
# create /etc/hostname on container creation
|
||||
"hostname" = {
|
||||
enable = true;
|
||||
target = "/etc/hostname";
|
||||
template = builtins.writeFile "hostname.tpl" "{{ container.name }}";
|
||||
when = [ "create" ];
|
||||
};
|
||||
# create /etc/nixos/hostname.nix with a configuration for keeping the hostname applied
|
||||
"hostname-nix" = {
|
||||
enable = true;
|
||||
target = "/etc/nixos/hostname.nix";
|
||||
template = builtins.writeFile "hostname-nix.tpl" "{ ... }: { networking.hostName = "{{ container.name }}"; }";
|
||||
# copy keeps the file updated when the container is changed
|
||||
when = [ "create" "copy" ];
|
||||
};
|
||||
# copy allow the user to specify a custom configuration.nix
|
||||
"configuration-nix" = {
|
||||
enable = true;
|
||||
target = "/etc/nixos/configuration.nix";
|
||||
template = builtins.writeFile "configuration-nix" "{{ config_get(\"user.user-data\", properties.default) }}";
|
||||
when = [ "create" ];
|
||||
};
|
||||
};
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -93,10 +119,6 @@ in
|
|||
object = config.system.build.toplevel;
|
||||
symlink = "none";
|
||||
}
|
||||
{
|
||||
object = pkgs.stdenv;
|
||||
symlink = "none";
|
||||
}
|
||||
];
|
||||
|
||||
contents = [
|
||||
|
@ -130,8 +152,5 @@ in
|
|||
# Containers should be light-weight, so start sshd on demand.
|
||||
services.openssh.enable = mkDefault true;
|
||||
services.openssh.startWhenNeeded = mkDefault true;
|
||||
|
||||
# Allow ssh connections
|
||||
services.openssh.openFirewall = mkDefault true;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue