system.services: Remove ambiguous, redundant pkgs module argument

Primary reasons: remove implicit dependencies and force uniformity.
See nixos/modules/system/service/README.md for detailed rationale.
This commit is contained in:
Robert Hensing
2025-08-19 22:22:12 +02:00
parent ce81f5cb0f
commit d88b9464b0
13 changed files with 174 additions and 41 deletions

View File

@@ -3,7 +3,6 @@
{
config,
lib,
pkgs,
...
}:
let
@@ -16,7 +15,6 @@ in
python-http-server = {
package = mkOption {
type = types.package;
default = pkgs.python3;
description = "Python package to use for the web server";
};
@@ -46,21 +44,9 @@ in
];
configData = {
# This should probably just be {} if we were to put this module in production.
"webroot" = lib.mkDefault {
source = pkgs.runCommand "default-webroot" { } ''
mkdir -p $out
cat > $out/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head><title>Python Web Server</title></head>
<body>
<h1>Welcome to the Python Web Server</h1>
<p>Serving from port ${toString config.python-http-server.port}</p>
</body>
</html>
EOF
'';
"webroot" = {
# Enable only if directory is set to use this path
enable = lib.mkDefault (config.python-http-server.directory == config.configData."webroot".path);
};
};
};