nixos/lxc-container: improve template example
This commit is contained in:
parent
c04bd7e2e2
commit
2e090e0d60
|
@ -63,18 +63,18 @@ in
|
||||||
default = {};
|
default = {};
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
# create /etc/hostname on container creation
|
# create /etc/hostname on container creation. also requires networking.hostName = "" to be set
|
||||||
"hostname" = {
|
"hostname" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
target = "/etc/hostname";
|
target = "/etc/hostname";
|
||||||
template = builtins.writeFile "hostname.tpl" "{{ container.name }}";
|
template = builtins.toFile "hostname.tpl" "{{ container.name }}";
|
||||||
when = [ "create" ];
|
when = [ "create" ];
|
||||||
};
|
};
|
||||||
# create /etc/nixos/hostname.nix with a configuration for keeping the hostname applied
|
# create /etc/nixos/hostname.nix with a configuration for keeping the hostname applied
|
||||||
"hostname-nix" = {
|
"hostname-nix" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
target = "/etc/nixos/hostname.nix";
|
target = "/etc/nixos/hostname.nix";
|
||||||
template = builtins.writeFile "hostname-nix.tpl" "{ ... }: { networking.hostName = "{{ container.name }}"; }";
|
template = builtins.toFile "hostname-nix.tpl" "{ ... }: { networking.hostName = \"{{ container.name }}\"; }";
|
||||||
# copy keeps the file updated when the container is changed
|
# copy keeps the file updated when the container is changed
|
||||||
when = [ "create" "copy" ];
|
when = [ "create" "copy" ];
|
||||||
};
|
};
|
||||||
|
@ -82,7 +82,7 @@ in
|
||||||
"configuration-nix" = {
|
"configuration-nix" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
target = "/etc/nixos/configuration.nix";
|
target = "/etc/nixos/configuration.nix";
|
||||||
template = builtins.writeFile "configuration-nix" "{{ config_get(\"user.user-data\", properties.default) }}";
|
template = builtins.toFile "configuration-nix" "{{ config_get(\"user.user-data\", properties.default) }}";
|
||||||
when = [ "create" ];
|
when = [ "create" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue