Skip to content

System modules

The core DNF module.

Sets up the systemd-boot loader, the LTS kernel, JetBrains Mono Nerd Font (with kmscon for the TTY), nightly Nix store optimisation and weekly garbage collection (30 d retention), the firewall, suspend policy (servers can fully disable it via disableSuspend), polkit rules letting wheel halt/reboot, and a shared common-files group/user for cross-service media folders.

  • enable bool Darkone framework core system (activated by default)
  • enableSystemdBoot bool Enable the default boot loader
  • enableFstrim bool SSD optimisation with fstrim
  • enableFirewall bool Enable firewall (default true)
  • enableSops bool Enable sops dnf module (default true)
  • enableFlatpak bool Enable flatpak DNF configuration (only for graphic environments)
  • enableKmscon bool Enable nerd font for TTY
  • enableBoost bool Enable overclocking, corectl
  • enableAutoSuspend bool Enable automatic suspend (for laptops, ignored if disableSuspend is true)
  • disableSuspend bool Full suspend disable (for servers)
  • enableCommonFilesUser bool Enable the common-files user used by several services
darkone.system.core = {
enable = true;
enableSystemdBoot = true;
enableFstrim = true;
enableFirewall = true;
enableSops = true;
enableFlatpak = true;
enableKmscon = true;
enableBoost = false;
enableAutoSuspend = false;
disableSuspend = false;
enableCommonFilesUser = false;
};

Documentation (man) for developers and admins.

  • enable bool Enable useful technical documentation (man, nixos)
darkone.system.documentation.enable = false;

Hardware configuration improvements.

  • enable bool Enable hardware optimisations
  • enableIntel bool Enable intel microcode updates
  • enableAmd bool Enable amd microcode updates
darkone.system.hardware = {
enable = false;
enableIntel = false;
enableAmd = false;
};

Location and lang configuration.

  • enable bool Enable i18n with network zone configuration by default
  • locale strMatching localeRegex Network locale, must match the xx_YY.UTF-8 shape.
  • timeZone str Network time zone
darkone.system.i18n = {
enable = false;
locale = "fr_FR.UTF-8";
timeZone = "Europe/Paris";
};

ANSSI BP-028 v2.0 (GNU/Linux) system hardening. (wip)

Recommended module, enabled in certain host profiles or manually depending on needs. Progressively applies ANSSI recommendations according to the chosen level and machine category. Each host profile defines its level and category:

darkone.system.security = {
level = "intermediary"; # minimal | intermediary | reinforced | high
category = "server"; # base | client | server
};

Rules incompatible with the environment are excluded by tag:

darkone.system.security.excludes = [ "needs-jit" "needs-hibernation" ];

A specific rule can be bypassed with a mandatory rationale:

darkone.system.security.exceptions = {
R9.rationale = "Docker rootless required during development.";
};
  • enable bool Enable the ANSSI BP-028 v2.0 hardening module.
  • level enum [ "minimal" "intermediary" "reinforced" "high" ] Targeted ANSSI hardening level.
  • category enum [ "base" "client" "server" ] Machine category that selects rule subsets.
  • excludes listOf str Tags that disable entire rule groups.
  • exceptions attrs Per-rule exceptions with mandatory rationale.
  • adminMailbox str Administrator email address (sudo R39, MTA aliases R75).
  • useHardenedKernel bool Use linuxPackages_hardened (R60, C1) instead of the default kernel.
  • allowedActiveUsers listOf str Exhaustive list of active user accounts (R30 validation).
darkone.system.security = {
enable = false;
level = "minimal";
category = "base";
excludes = [ ];
exceptions = { };
adminMailbox = "admin@exemple.fr";
useHardenedKernel = false;
allowedActiveUsers = [ ];
};

DNF Service registration and configuration.

  • enable bool Enable DNF services manager to register and expose services
  • service attrs Global services configuration <name>
    • enable bool Enable service proxy
    • defaultParams submodule Theses options are calculated by dnfLib.srv.extractServiceParams
      • domain str Domain name for the service
      • title str Display name in homepage
      • description str Service description for homepage
      • icon str Icon name for homepage 🡕
      • global bool Global service is accessible on Internet
      • noRobots bool Prevent robots from scanning if global is true
      • fqdn str Calculated FQDN or the service before the reverse proxy
      • href str Calculated URL of the service before the reverse proxy
      • ip str Calculated IP to contact the service
    • displayOnHomepage bool Display a link on homepage
    • reverseProxy bool Reached through the zone gateway reverse proxy (DNS points to the gateway LAN IP)
    • uniquePerZone bool At most one instance allowed per zone (generator validation)
    • externalAccess bool www-zone service reachable from the LAN via a fixed host IP (e.g. headscale, turn)
    • persist.dirs listOf str Service persistant dirs
    • persist.files listOf str Service persistant files
    • persist.dbDirs listOf str Service persistant dirs with database(s)
    • persist.dbFiles listOf str Service database file(s)
    • persist.varDirs listOf str Variable secondary files (log, cache, etc.)
    • persist.mediaDirs listOf str Service media dirs (pictures, videos, big files)
    • proxy.enable bool Whether to create virtualHost configuration (false for services that manage their own)
    • proxy.isProtected bool Oauth2 protected service
    • proxy.isInternal bool Bind service on internal interface only (not internet accessible)
    • proxy.hasReverseProxy bool This is a reverse proxy (or another virtualhost configuration via extraConfig)
    • proxy.defaultService bool Is the default service
    • proxy.servicePort nullOr port Service internal port
    • proxy.preExtraConfig lines Extra caddy virtualHost configuration (prefix)
    • proxy.extraConfig lines Extra caddy virtualHost configuration
    • proxy.extraGlobalConfig lines Extra caddy configuration
    • proxy.scheme str Internal service scheme (http / https)
darkone.system.services = {
enable = false;
service.enable = false;
service.defaultParams.domain = "";
service.defaultParams.title = "";
service.defaultParams.description = "";
service.defaultParams.icon = "";
service.defaultParams.global = false;
service.defaultParams.noRobots = true;
service.defaultParams.fqdn = "";
service.defaultParams.href = "";
service.defaultParams.ip = "";
service.displayOnHomepage = true;
service.reverseProxy = true;
service.uniquePerZone = false;
service.externalAccess = false;
service.persist.dirs = [ ];
service.persist.files = [ ];
service.persist.dbDirs = [ ];
service.persist.dbFiles = [ ];
service.persist.varDirs = [ ];
service.persist.mediaDirs = [ ];
service.proxy.enable = true;
service.proxy.isProtected = false;
service.proxy.isInternal = false;
service.proxy.hasReverseProxy = true;
service.proxy.defaultService = false;
service.proxy.servicePort = null;
service.proxy.preExtraConfig = "";
service.proxy.extraConfig = "";
service.proxy.extraGlobalConfig = "";
service.proxy.scheme = "https";
};

DNF sops, passwords and secrets management.

Wires sops-nix to usr/secrets/secrets.yaml and unlocks it with the host SSH key (ssh_host_ed25519_key) plus the dedicated infrastructure age key (/etc/sops/age/infra.key). Pre-declares a shared sops group, the default-password / default-password-hash secrets (group-readable by sops), and one user/<login>/password-hash secret per host user (with neededForUsers = true so the hash is available before the user accounts are created).

  • enable bool Enable sops automated configuration for DNF
darkone.system.sops.enable = false;

Shared directories management service.

  • enable bool Enable srv dirs, create the root dir (default /srv)
  • enableNfs bool Enable nfs service paths (nfs/common, nfs/homes)
  • enableMedias bool Enable media services paths (medias/[videos|music|incomming/…])
  • root str Root dir for persistant data (/srv)
  • nfs str NFS root directory (/srv/nfs)
  • homes str Directory for shared homes (/srv/nfs/homes)
  • common str Shared common directory (/srv/nfs/common linked to ~/Public)
  • medias str Medias root dir (/srv/medias)
  • music str Shared music files directory (/srv/medias/music)
  • videos str Shared video files directory (/srv/medias/videos)
  • incoming str Shared incoming directory (/srv/medias/incoming write access)
  • incomingMusic str Shared incoming directory (/srv/medias/incoming/music write access)
  • incomingVideos str Shared incoming directory (/srv/medias/incoming/videos write access)
darkone.system.srv-dirs = {
enable = cfg.enableNfs || cfg.enableMedias;
enableNfs = false;
enableMedias = false;
root = "/srv";
nfs = null;
homes = null;
common = null;
medias = null;
music = null;
videos = null;
incoming = null;
incomingMusic = null;
incomingVideos = null;
};

Standalone test mode for the NixOS Test Driver.

When enabled, neutralizes the irreducibly external/runtime bits so a node can be exercised in a VM: headscale/tailscale become no-ops and a fixed TLS cert can stub ACME. It also lets workDir-only config (nix.pub, harmonia.pub) be skipped by core/ncps. sops stays REAL (high fidelity).

Aim: use, debug.

  • standalone bool Standalone test mode — skip workDir-only config (nix.pub, harmonia.pub) and neutralize external services
  • tlsCert nullOr path Self-signed cert (PEM) provided by the test harness to stub ACME. Never a tests/ path baked into the framework.
  • tlsKey nullOr path Private key (PEM) paired with tlsCert.
darkone.system.testing = {
standalone = false;
tlsCert = null;
tlsKey = null;
};