mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
wrapper-manager-fds/modules: add configuring XDG-related directories per-wrapper
This commit is contained in:
parent
6a590fb47d
commit
cbabbcf71b
@ -2,6 +2,7 @@
|
||||
imports = [
|
||||
./base.nix
|
||||
./xdg-desktop-entries.nix
|
||||
./xdg-dirs.nix
|
||||
./build.nix
|
||||
./extra-args.nix
|
||||
];
|
||||
|
@ -0,0 +1,59 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.xdg;
|
||||
|
||||
xdgDirsOption = {
|
||||
configDirs = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
description = ''
|
||||
A list of paths to be appended as part of the `XDG_CONFIG_DIRS`
|
||||
environment to be applied per-wrapper.
|
||||
'';
|
||||
default = [ ];
|
||||
example = lib.literalExpression ''
|
||||
wrapperManagerLib.getXdgConfigDirs (with pkgs; [
|
||||
yt-dlp
|
||||
neofetch
|
||||
])
|
||||
'';
|
||||
};
|
||||
|
||||
dataDirs = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
description = ''
|
||||
A list of paths to be appended as part of the `XDG_DATA_DIRS`
|
||||
environment to be applied per-wrapper.
|
||||
'';
|
||||
default = [ ];
|
||||
example = lib.literalExpression ''
|
||||
wrapperManagerLib.getXdgDataDirs (with pkgs; [
|
||||
yt-dlp
|
||||
neofetch
|
||||
])
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.xdg = xdgDirsOption;
|
||||
|
||||
options.wrappers = lib.mkOption {
|
||||
type =
|
||||
let
|
||||
xdgDirsType = { name, lib, config, ... }: {
|
||||
options.xdg = xdgDirsOption;
|
||||
|
||||
config.makeWrapperArgs =
|
||||
let
|
||||
# Just take note wrapper-specific values should be the one taking over.
|
||||
configDirs = cfg.configDirs ++ config.xdg.configDirs;
|
||||
dataDirs = cfg.dataDirs ++ config.xdg.dataDirs;
|
||||
in
|
||||
builtins.map (v: "--prefix 'XDG_CONFIG_DIRS' ':' ${v}") configDirs
|
||||
++ (builtins.map (v: "--prefix 'XDG_DATA_DIRS' ':' ${v}") dataDirs);
|
||||
};
|
||||
in
|
||||
with lib.types; attrsOf (submodule xdgDirsType);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user