Personal Nix setup
at main 856 B view raw
1{ lib, helpers, config, pkgs, ... }: 2 3with lib; 4let 5 cfg = config.modules.xdg; 6in { 7 options = { 8 modules.xdg = { 9 enable = mkOption { 10 default = true; 11 description = "XDG Configuration"; 12 type = types.bool; 13 }; 14 }; 15 xdg.runtimeDir = mkOption { 16 type = types.nullOr types.str; 17 default = if helpers.isDarwin then "$(mktemp -d)" else null; 18 apply = (val: if val != null then (toString val) else null); 19 }; 20 }; 21 22 config = mkIf cfg.enable { 23 xdg = { 24 enable = true; 25 userDirs.enable = mkDefault helpers.isLinux; 26 systemDirs.data = mkIf helpers.isLinux [ 27 "/usr/share" 28 "/usr/local/share" 29 ]; 30 }; 31 32 home.sessionVariables = mkIf helpers.isDarwin { 33 XDG_RUNTIME_DIR = optionalString (config.xdg.runtimeDir != null) config.xdg.runtimeDir; 34 }; 35 }; 36}