Title
oblichey-cli panics with "Failed to get log directory: EnvVar(NotPresent)" on NixOS (flakes)
Summary
On NixOS using flakes, oblichey-cli panics immediately with:
Failed to get log directory: EnvVar(NotPresent)
This happens even when I set XDG_STATE_HOME and other XDG/XDG-like variables via NixOS configuration.
Environment
$ nixos-version
25.11.20251112.c5ae371 (Xantusia)
$ nix --version
nix (Nix) 2.31.2
$ uname -a
Linux nixos 6.17.7 #1-NixOS SMP PREEMPT_DYNAMIC Sun Nov 2 13:18:05 UTC 2025 x86_64 GNU/Linux
Nix flake configuration
flake.nix:
{
description = "NixOS Configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
zen-browser.url = "github:0xc000022070/zen-browser-flake";
oblichey.url = "github:SimonBrandner/oblichey/main";
};
outputs = inputs@{ self, nixpkgs, oblichey, ... }: {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./configuration.nix ];
};
};
}
configuration.nix (relevant part):
{ config, pkgs, inputs, ... }:
{
imports = [
./hardware-configuration.nix
inputs.oblichey.nixosModules.default
];
environment.sessionVariables = rec {
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_STATE_HOME = "$HOME/.local/state";
NIXOS_OZONE_WL = "1";
};
security.pam.services.sudo.setEnvironment = true;
security.pam.services.login.setEnvironment = true;
programs.oblichey = {
enable = true;
pamServices = [ "sudo" "login" ];
settings = {
camera = {
path = "/dev/video2";
};
};
};
}
Steps to reproduce
- Rebuild NixOS with the configuration above.
- As my normal user, run:
mkdir -p ~/.local/state/oblichey
RUST_BACKTRACE=1 XDG_STATE_HOME="$HOME/.local/state" oblichey-cli help
The panic also happens for:
RUST_BACKTRACE=1 XDG_STATE_HOME="$HOME/.local/state" oblichey-cli scan --label meo
and when Oblichey is called via PAM (e.g. sudo).
Actual behavior
The CLI panics instead of running:
thread 'main' panicked at crates/oblichey-cli/src/main.rs:58:45:
Failed to get log directory: EnvVar(NotPresent)
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: oblichey_cli::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Expected behavior
If no log directory can be determined, oblichey-cli should either:
- fall back to a sensible default (e.g.
$XDG_STATE_HOME/oblichey), or
- print a clear error message and exit gracefully (without panicking).
Let me know if you need more info or if I can test a patch.
Title
oblichey-cli panics with "Failed to get log directory: EnvVar(NotPresent)" on NixOS (flakes)
Summary
On NixOS using flakes,
oblichey-clipanics immediately with:Failed to get log directory: EnvVar(NotPresent)This happens even when I set
XDG_STATE_HOMEand other XDG/XDG-like variables via NixOS configuration.Environment
$ nixos-version 25.11.20251112.c5ae371 (Xantusia) $ nix --version nix (Nix) 2.31.2 $ uname -a Linux nixos 6.17.7 #1-NixOS SMP PREEMPT_DYNAMIC Sun Nov 2 13:18:05 UTC 2025 x86_64 GNU/LinuxNix flake configuration
flake.nix:configuration.nix(relevant part):Steps to reproduce
The panic also happens for:
RUST_BACKTRACE=1 XDG_STATE_HOME="$HOME/.local/state" oblichey-cli scan --label meoand when Oblichey is called via PAM (e.g.
sudo).Actual behavior
The CLI panics instead of running:
Expected behavior
If no log directory can be determined,
oblichey-clishould either:$XDG_STATE_HOME/oblichey), orLet me know if you need more info or if I can test a patch.