xmonad: removed buildScriptPackages and cleaned up

From the code-review, buildScriptPackages was deemed unnecessary and so
has been removed. The ghc package with dependencies was not needed when
building without a custom build script so this build dependency has been
made contingent on the presence of a custom build script. The install
command is used instead of cp and chmod. Finally, an example has been
added for the documentation.
This commit is contained in:
James Hobson
2026-01-07 11:35:00 +01:00
committed by Matthieu Coudron
parent 0d3183953c
commit 93da26b426

View File

@@ -119,12 +119,13 @@ in
description = ''
Build script for your xmonad configuration.
'';
};
buildScriptPackages = mkOption {
type = types.listOf types.package;
default = [ ];
description = ''
Extra packages needed to run the build script.
example = literalExpression ''
pkgs.writeText "build" '''
#!/bin/sh
# Enable -threaded
ghc --make xmonad.hs -threaded -i -ilib -fforce-recomp -main-is main -v0 -O2 -o "$1"
'''
'';
};
};
@@ -144,9 +145,10 @@ in
{
nativeBuildInputs = [
xmonad
ghc-builder
]
++ cfg.buildScriptPackages;
++ lib.optional (cfg.buildScript != null) [
ghc-builder
];
}
''
mkdir -p $out/bin
@@ -159,7 +161,7 @@ in
cp ${cfg.config} xmonad-config/xmonad.hs
${lib.optionalString (cfg.buildScript != null) ''
cp ${cfg.buildScript} xmonad-config/build && chmod +x xmonad-config/build
install -m 555 ${cfg.buildScript} xmonad-config/build
''}
declare -A libFiles
libFiles=(${