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.
|
Script fragments to run before the main executable.
|
||||||
|
|
||||||
::: {.note}
|
::: {.note}
|
||||||
This option is only used when the wrapper script is not compiled
|
This option is only used when {option}`build.isBinary` is set to
|
||||||
into a binary (that is, when {option}`build.isBinary` is set to
|
`false`.
|
||||||
`false`).
|
|
||||||
:::
|
:::
|
||||||
'';
|
'';
|
||||||
default = "";
|
default = "";
|
||||||
@ -117,23 +116,29 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = lib.mkMerge [
|
||||||
env.PATH = lib.concatStringsSep ":" config.pathAdd;
|
{
|
||||||
|
|
||||||
makeWrapperArgs = [
|
makeWrapperArgs = [
|
||||||
"--argv0" config.arg0
|
"--argv0" config.arg0
|
||||||
]
|
]
|
||||||
++ (builtins.map (v: "--unset ${v}") config.unset)
|
++ (builtins.map (v: "--unset ${lib.escapeShellArg v}") config.unset)
|
||||||
++ (lib.mapAttrsToList (n: v: "--set ${n} ${v}") config.env)
|
++ (lib.mapAttrsToList (n: v: "--set ${lib.escapeShellArg n} ${lib.escapeShellArg v}") config.env)
|
||||||
++ (builtins.map (v: "--add-flags ${v}") config.prependArgs)
|
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
|
||||||
++ (builtins.map (v: "--append-flags ${v}") config.appendArgs)
|
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
|
||||||
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
||||||
let
|
let
|
||||||
preScript =
|
preScript =
|
||||||
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { } config.preScript;
|
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { } config.preScript;
|
||||||
in
|
in
|
||||||
[ "--run" preScript ]));
|
[ "--run" preScript ]));
|
||||||
};
|
}
|
||||||
|
|
||||||
|
(lib.mkIf (config.pathAdd != [ ]) {
|
||||||
|
env.PATH = lib.concatStringsSep ":" config.pathAdd;
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ let
|
|||||||
cfg = config.locale;
|
cfg = config.locale;
|
||||||
|
|
||||||
localeModuleFactory = { isGlobal ? false }: {
|
localeModuleFactory = { isGlobal ? false }: {
|
||||||
locale = {
|
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = if isGlobal then true else cfg.enable;
|
default = if isGlobal then true else cfg.enable;
|
||||||
@ -28,7 +27,6 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.locale = localeModuleFactory { isGlobal = true; };
|
options.locale = localeModuleFactory { isGlobal = true; };
|
||||||
|
@ -114,8 +114,8 @@ in
|
|||||||
|
|
||||||
# Welp, we could set it to the absolute location of the wrapper
|
# 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
|
# 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
|
# so we're opting to the executable name instead. This current
|
||||||
# way of doing it is simply the next (and the simplest) best thing.
|
# 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
|
# We just have to make sure the build step for the wrapper script
|
||||||
# is consistent throughout the entire module environment.
|
# is consistent throughout the entire module environment.
|
||||||
#
|
#
|
||||||
|
@ -44,14 +44,21 @@ in
|
|||||||
xdgDirsType = { name, lib, config, ... }: {
|
xdgDirsType = { name, lib, config, ... }: {
|
||||||
options.xdg = xdgDirsOption;
|
options.xdg = xdgDirsOption;
|
||||||
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
# When set this way, we could allow the user to override everything.
|
# When set this way, we could allow the user to override everything.
|
||||||
config.xdg.configDirs = cfg.configDirs;
|
xdg.configDirs = cfg.configDirs;
|
||||||
config.xdg.dataDirs = cfg.dataDirs;
|
xdg.dataDirs = cfg.dataDirs;
|
||||||
|
}
|
||||||
|
|
||||||
config.env = {
|
(lib.mkIf (config.xdg.configDirs != [ ]) {
|
||||||
XDG_CONFIG_DIRS = lib.concatStringsSep ":" config.xdg.configDirs;
|
env.XDG_CONFIG_DIRS = lib.concatStringsSep ":" config.xdg.configDirs;
|
||||||
XDG_DATA_DIRS = lib.concatStringsSep ":" config.xdg.dataDirs;
|
})
|
||||||
};
|
|
||||||
|
(lib.mkIf (config.xdg.dataDirs != [ ]) {
|
||||||
|
env.XDG_DATA_DIRS = lib.concatStringsSep ":" config.xdg.dataDirs;
|
||||||
|
})
|
||||||
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
with lib.types; attrsOf (submodule xdgDirsType);
|
with lib.types; attrsOf (submodule xdgDirsType);
|
||||||
|
Loading…
Reference in New Issue
Block a user