Files
nix-config/modules/misc.org
T
phundrak a2b21feacc refactor: change to litterate config
Configuration is now held by the `.org` files. All `.nix` files are
tangled from the org-mode files.
2026-10-04 22:34:28 +02:00

2.7 KiB
Raw Blame History

Misc NixOS Configurations

Misc NixOS Configurations

This module hosts some misc configuration I am unsure where to put elsewhere than here. Don’t expect this file to be coherent, but expect it to be quite short.

This module declares the aspect nixos.misc, which is used by all my hosts.

{
  flake.modules.nixos.misc = {
    lib,
    config,
    ...
  }:
    with lib; let
      cfg = config.mySystem.misc;
    in {
      <<timezone-option>>
      <<layout-option>>

      config = {
        <<layout-config>>
        <<timezone-config>>
        <<envfs>>
        <<orca>>
        <<clean-tmp>>
        <<completion>>
      };
    };
}

System Timezone

First, let me declare the timezone. I’ll set it as an option, as not all my machines live in the same place, but I’ll default to Metropolitan France’s timezone.

options.mySystem.misc.timezone = mkOption {
  type = types.str;
  default = "Europe/Paris";
};

Now, I can set it for my system.

time.timeZone = cfg.timezone;

TTY Keyboard Layout

Now, I can set the TTY’s keyboard config. Most of my machines use the Bépo layout everywhere, but I do share one whose owner doesn’t use it, so I’ll let this as an option to be set, defaulting to the default French layout.

options.mySystem.misc.keymap = mkOption {
  type = types.str;
  default = "fr";
  example = "fr-bepo";
  description = "Keymap to use in the TTY console";
};

Now, I can set it on my system.

console.keyMap = cfg.keymap;

Truly Miscelaneous Config

First, some scripts are written with the assumption that some utilities are always in the same place, such as /bin/bash. It is, however, not always the case with NixOS. Mic92’s envfs solves that.

services.envfs.enable = true;

I have no idea why, but sometimes, Orca get activated without my consent. So I hard-disable it here.

services.orca.enable = false;

I was surprised to see /tmp still hold the same files after my first reboot in NixOS, I always assumed it was cleared on every reboot on every system. But I can enable this behaviour back.

boot.tmp.cleanOnBoot = true;

Lastly, I want to make sure my shell completions work, so I’ll enable this.

environment.pathsToLink = [
  "/share/bash-completion"
  "/share/zsh"
];