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).
This commit is contained in:
Gabriel Arazas 2020-10-27 16:33:47 +08:00
parent c74dd2ff17
commit 80cb28be86
8 changed files with 96 additions and 73 deletions

View File

@ -113,10 +113,6 @@
}; };
go.enable = true; go.enable = true;
java.enable = true; java.enable = true;
javascript = {
deno.enable = true;
node.enable = true;
};
lisp = { lisp = {
clojure.enable = true; clojure.enable = true;
guile.enable = true; guile.enable = true;
@ -130,6 +126,14 @@
}; };
rust.enable = true; rust.enable = true;
vcs.enable = true; vcs.enable = true;
web = {
enable = true;
javascript = {
deno.enable = true;
node.enable = true;
};
php.enable = true;
};
}; };
drivers = { veikk.enable = true; }; drivers = { veikk.enable = true; };
@ -189,7 +193,7 @@
] ]
# My custom packages. # My custom packages.
++ (with pkgs.nur.foo-dogsquared; [ segno ]); ++ (with pkgs.nur.foo-dogsquared; [ julia-bin license-cli openring segno ]);
# Setting up the shell environment. # Setting up the shell environment.
my.env = { my.env = {

View File

@ -21,11 +21,11 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
# Enable JACK for the most serious audio applications. # Enable JACK for the most serious audio applications.
services.jack = { # services.jack = {
jackd.enable = true; # jackd.enable = true;
alsa.enable = false; # alsa.enable = false;
loopback = { enable = true; }; # loopback = { enable = true; };
}; # };
hardware.pulseaudio.package = hardware.pulseaudio.package =
pkgs.pulseaudio.override { jackaudioSupport = true; }; pkgs.pulseaudio.override { jackaudioSupport = true; };

View File

@ -10,12 +10,12 @@
./gamedev.nix ./gamedev.nix
./go.nix ./go.nix
./java.nix ./java.nix
./javascript.nix
./lisp.nix ./lisp.nix
./math.nix ./math.nix
./perl.nix ./perl.nix
./python.nix ./python.nix
./rust.nix ./rust.nix
./vcs.nix ./vcs.nix
./web.nix
]; ];
} }

View File

@ -1,37 +0,0 @@
# JavaScript, the poster boy of hated languages...
# I think it's pretty great, when it works.
# Otherwise, it is a disaster from its syntax and 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.javascript;
in {
options.modules.dev.javascript = let
mkBoolOption = bool:
mkOption {
type = types.bool;
default = bool;
};
in {
deno.enable = mkBoolOption false;
node.enable = mkBoolOption false;
};
config = {
my.packages = with pkgs;
(if cfg.deno.enable then
[
deno # The Deltarune of Node.
]
else
[ ]) ++
(if cfg.node.enable then
[
nodejs # The JavaScript framework/runtime where you don't have to kill someone for bad code. :)
]
else
[ ]);
};
}

View File

@ -16,17 +16,23 @@ in {
in { in {
enable = mkBoolOption false; enable = mkBoolOption false;
math.enable = mkBoolOption false; math.enable = mkBoolOption false;
pkg = mkOption {
type = types.package;
default = pkgs.python37;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.packages = with pkgs; assertions = [{
[ assertion = versionAtLeast cfg.pkg.version "3";
(python37.withPackages (p: message = "Python version should be only 3 and above.";
}];
my.packages = with pkgs; [
(cfg.pkg.withPackages (p:
with python3Packages; with python3Packages;
[ [
beautifulsoup4 # How soups are beautiful again? beautifulsoup4 # How soups are beautiful again?
requests # The requests for your often-asked questions. requests # The requests for your often-asked questions.
pip # Named after a certain mouse that lives in a barnyard and its ability to keep track of dependencies.
pytools # It's the little things that counts. pytools # It's the little things that counts.
pytest # Try to make a good grade or else. pytest # Try to make a good grade or else.
poetry # It rhymes... poetry # It rhymes...
@ -39,6 +45,7 @@ in {
sympy # When will you notice that math is good? sympy # When will you notice that math is good?
] else ] else
[ ]))) [ ])))
python3Packages.pip # Named after a certain animal that lives in a barnyard.
]; ];
}; };
} }

50
modules/dev/web.nix Executable file
View File

@ -0,0 +1,50 @@
# 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
[ ]);
};
}

View File

@ -5,6 +5,7 @@
with lib; with lib;
let let
cfg = config.modules.editors.emacs;
emacsOrgProtocolDesktopEntry = pkgs.makeDesktopItem { emacsOrgProtocolDesktopEntry = pkgs.makeDesktopItem {
name = "org-protocol"; name = "org-protocol";
desktopName = "Org-Protocol"; desktopName = "Org-Protocol";
@ -27,10 +28,9 @@ in {
}; };
}; };
config = mkIf config.modules.editors.emacs.enable { config = mkIf cfg.enable {
my.packages = with pkgs; [ my.packages = with pkgs; [
((emacsPackagesNgGen config.modules.editors.emacs.pkg).emacsWithPackages ((emacsPackagesNgGen cfg.pkg).emacsWithPackages (epkgs: [ epkgs.vterm ]))
(epkgs: [ epkgs.vterm ]))
emacsOrgProtocolDesktopEntry emacsOrgProtocolDesktopEntry

View File

@ -1,11 +1,10 @@
[ [
(self: super: (self: super:
with super; { with super; {
# Add packages from the unstable channel with `pkgs.unstable.$PKG`.
veikk-linux-driver = veikk-linux-driver =
(callPackage ./veikk-driver.nix { kernel = pkgs.linux_5_8; }); (callPackage ./veikk-driver.nix { kernel = pkgs.linux_5_8; });
nur.foo-dogsquared = import (fetchTarball nur.foo-dogsquared = import (fetchTarball
"https://github.com/foo-dogsquared/nur-packages/archive/develop.tar.gz") { "https://github.com/foo-dogsquared/nur-packages/archive/master.tar.gz") {
inherit pkgs; inherit pkgs;
}; };
}) })