mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-01-31 04:58:17 +00:00
wrapper-manager-fds/modules: fix makeWrapper arguments
Welp, we escape the arguments properly this time since it doesn't work anymore for some reason but at least it is consistent for both binary- and shell-based wrappers.
This commit is contained in:
parent
f04b1179d8
commit
5714c1b8c6
@ -96,9 +96,8 @@ let
|
||||
Script fragments to run before the main executable.
|
||||
|
||||
::: {.note}
|
||||
This option is only used when the wrapper script is not compiled
|
||||
into a binary (that is, when {option}`build.isBinary` is set to
|
||||
`false`).
|
||||
This option is only used when {option}`build.isBinary` is set to
|
||||
`false`.
|
||||
:::
|
||||
'';
|
||||
default = "";
|
||||
@ -117,23 +116,29 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
env.PATH = lib.concatStringsSep ":" config.pathAdd;
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
makeWrapperArgs = [
|
||||
"--argv0" config.arg0
|
||||
]
|
||||
++ (builtins.map (v: "--unset ${v}") config.unset)
|
||||
++ (lib.mapAttrsToList (n: v: "--set ${n} ${v}") config.env)
|
||||
++ (builtins.map (v: "--add-flags ${v}") config.prependArgs)
|
||||
++ (builtins.map (v: "--append-flags ${v}") config.appendArgs)
|
||||
++ (builtins.map (v: "--unset ${lib.escapeShellArg v}") config.unset)
|
||||
++ (lib.mapAttrsToList (n: v: "--set ${lib.escapeShellArg n} ${lib.escapeShellArg v}") config.env)
|
||||
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
|
||||
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
|
||||
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
||||
let
|
||||
preScript =
|
||||
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { } config.preScript;
|
||||
in
|
||||
[ "--run" preScript ]));
|
||||
};
|
||||
}
|
||||
|
||||
(lib.mkIf (config.pathAdd != [ ]) {
|
||||
env.PATH = lib.concatStringsSep ":" config.pathAdd;
|
||||
|
||||
})
|
||||
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
|
@ -4,7 +4,6 @@ let
|
||||
cfg = config.locale;
|
||||
|
||||
localeModuleFactory = { isGlobal ? false }: {
|
||||
locale = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = if isGlobal then true else cfg.enable;
|
||||
@ -28,7 +27,6 @@ let
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.locale = localeModuleFactory { isGlobal = true; };
|
||||
|
@ -114,8 +114,8 @@ in
|
||||
|
||||
# Welp, we could set it to the absolute location of the wrapper
|
||||
# executable in the final output but it's a big pain the ass to do
|
||||
# so but we're opting to the executable name instead. This current
|
||||
# way of doing it is simply the next (and the simplest) best thing.
|
||||
# so we're opting to the executable name instead. This current
|
||||
# way of doing it is simply the next best (and the simplest) thing.
|
||||
# We just have to make sure the build step for the wrapper script
|
||||
# is consistent throughout the entire module environment.
|
||||
#
|
||||
|
@ -44,14 +44,21 @@ in
|
||||
xdgDirsType = { name, lib, config, ... }: {
|
||||
options.xdg = xdgDirsOption;
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
# When set this way, we could allow the user to override everything.
|
||||
config.xdg.configDirs = cfg.configDirs;
|
||||
config.xdg.dataDirs = cfg.dataDirs;
|
||||
xdg.configDirs = cfg.configDirs;
|
||||
xdg.dataDirs = cfg.dataDirs;
|
||||
}
|
||||
|
||||
config.env = {
|
||||
XDG_CONFIG_DIRS = lib.concatStringsSep ":" config.xdg.configDirs;
|
||||
XDG_DATA_DIRS = lib.concatStringsSep ":" config.xdg.dataDirs;
|
||||
};
|
||||
(lib.mkIf (config.xdg.configDirs != [ ]) {
|
||||
env.XDG_CONFIG_DIRS = lib.concatStringsSep ":" config.xdg.configDirs;
|
||||
})
|
||||
|
||||
(lib.mkIf (config.xdg.dataDirs != [ ]) {
|
||||
env.XDG_DATA_DIRS = lib.concatStringsSep ":" config.xdg.dataDirs;
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
with lib.types; attrsOf (submodule xdgDirsType);
|
||||
|
Loading…
Reference in New Issue
Block a user