nixos-config/modules/dev/web.nix
Gabriel Arazas 80cb28be86 Update the modules
* Python module now has an additional option for the package to be
installed for easier installation of other versions.
* The Python module also has a restriction of installing version 3 and
above.
* The JavaScript module has been moved into a more general module for
web-based tools (including PHP).
2020-10-27 16:33:47 +08:00

51 lines
1.4 KiB
Nix
Executable File

# Web development, the poster boy of hated programming subsets...
# I think it's pretty great, when it works.
# Otherwise, it is a disaster from the massive ecosystem among others.
# Since I use/experiment with the ecosystem so stuff like Node and Deno are combined into one module file.
{ config, options, lib, pkgs, ... }:
with lib;
let cfg = config.modules.dev.web;
in {
options.modules.dev.web = let
mkBoolOption = bool:
mkOption {
type = types.bool;
default = bool;
};
in {
enable = mkBoolOption false;
javascript = {
enable = mkBoolOption false;
deno.enable = mkBoolOption false;
node.enable = mkBoolOption false;
};
php.enable = mkBoolOption false;
};
config = mkIf cfg.enable {
my.packages = with pkgs;
[ caddy ] ++ (if cfg.javascript.deno.enable then
[
deno # The Deltarune of Node.
]
else
[ ]) ++
(if cfg.javascript.node.enable then
[
nodejs # The JavaScript framework/runtime where you don't have to kill someone for bad code. :)
]
else
[ ]) ++
(if cfg.php.enable then [
php # Behold, the most hated language (at least in my experience).
phpPackages.composer # Composes PHP projects prematurely.
phpPackages.phpcs # Quality control tool.
phpPackages.php-cs-fixer # Fixes your incorrectly formatted dirt.
] else
[ ]);
};
}