mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-02-07 06:19:02 +00:00
wrapper-manager-fds/modules: add configuring XDG-related directories per-wrapper
This commit is contained in:
parent
724ac43d83
commit
8ca3f6842e
@ -2,6 +2,7 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./base.nix
|
./base.nix
|
||||||
./xdg-desktop-entries.nix
|
./xdg-desktop-entries.nix
|
||||||
|
./xdg-dirs.nix
|
||||||
./build.nix
|
./build.nix
|
||||||
./extra-args.nix
|
./extra-args.nix
|
||||||
];
|
];
|
||||||
|
59
modules/wrapper-manager/xdg-dirs.nix
Normal file
59
modules/wrapper-manager/xdg-dirs.nix
Normal file
@ -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