b3f4040512
This change does two things: * "NixOSizes" environment variables generation. This allows some more error-checking and opens possibilities for a modular environment configuration. From now on the most of environment variables are generated directly by the nix code. Generating sh code that generates environment variables is left in a few places where nontrivial access to a local environment state is needed. * By doing the first change this patch untangles bash from the environment configuration and makes it trivial to add a support for other non bash-compatible shells. Now to the sad part. This change is quite large (and I'm not sure it's possible to split it) and yet is not quite complete, it needs some changes to nixpkgs to be perfect. See !!! comments in modules/config/shells-environment.nix. Main principle behind this change is "change environment generation and nothing else". In particular, shell configuration principles stay exactly the same as before.
37 lines
776 B
Nix
37 lines
776 B
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
{
|
|
options = {
|
|
|
|
time = {
|
|
|
|
timeZone = mkOption {
|
|
default = "CET";
|
|
type = with types; uniq string;
|
|
example = "America/New_York";
|
|
description = "The time zone used when displaying times and dates.";
|
|
};
|
|
|
|
hardwareClockInLocalTime = mkOption {
|
|
default = false;
|
|
description = "If set, keep the hardware clock in local time instead of UTC.";
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
config = {
|
|
|
|
environment.variables.TZDIR.value = "/etc/zoneinfo";
|
|
environment.variables.TZ.value = config.time.timeZone;
|
|
|
|
environment.etc.localtime.source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
|
|
|
|
environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";
|
|
|
|
};
|
|
|
|
}
|