feat: add support for changing the timezone in the container

This commit is contained in:
TECHNOFAB 2024-10-27 18:05:57 +01:00
parent 01c163c081
commit 67d14dbbe9
No known key found for this signature in database
GPG key ID: D06FBA11BA6FF836
3 changed files with 20 additions and 1 deletions

View file

@ -14,6 +14,7 @@
gitMinimal
curl
ncurses
less
cacert.out
@ -34,7 +35,7 @@
};
nixConfContents =
(lib.concatStringsSep "\n" (lib.mapAttrsFlatten (n: v: let
(lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: let
vStr =
if builtins.isList v
then lib.concatStringsSep " " v
@ -95,6 +96,9 @@
echo "coder:100000:65536" > $out/etc/subuid
echo "coder:100000:65536" > $out/etc/subgid
# support timezones
ln -s ${pkgs.tzdata}/share/zoneinfo $out/etc/zoneinfo
ln -s ${profile} $out/nix/var/nix/profiles/default-1-link
ln -s /nix/var/nix/profiles/default-1-link $out/nix/var/nix/profiles/default
@ -129,6 +133,7 @@ in
"HOME=/home/coder"
"TMPDIR=/tmp"
"XDG_RUNTIME_DIR=/tmp"
"TZDIR=/etc/zoneinfo"
"PATH=${lib.concatStringsSep ":" [
"/home/coder/.nix-profile/bin"
# this makes all the packages defined at the top available

View file

@ -81,6 +81,10 @@
name = "DOTFILES_REPO";
value = "\${data.coder_parameter.dotfiles_repo.value}";
}
{
name = "TZ";
value = "\${data.coder_parameter.timezone.value}";
}
];
resources = {
requests = {

View file

@ -87,5 +87,15 @@
}
];
};
timezone = {
name = "Timezone";
description = ''
Content of the TZ environment variable.
'';
default = "";
order = 8;
type = "string";
mutable = true;
};
};
}