nixos-config/modules/dev/python.nix
Gabriel Arazas 49592d7f01 Use the unstable version for the nth time
I also fixed the long-time occuring error when using the newest version
of the channel (or the unstable one). It turns out to be a simple type
error with the `my.user' attribute. (To be honest the error messages are
quite horrible.)

On another note, I also accidentally bricked my NixOS setup after a
garbage collection and a horrible update. The breakage includes not
being able to use any of the builtin tools of Nix (e.g., nix, nix-env,
nixos-rebuild) due to a shared library error that has been garbage
collected. Which means I have to reinstall it.
(I seem to have a talent for breaking things, if only I'm paid for it.)
2020-10-05 09:38:58 +08:00

40 lines
1.3 KiB
Nix
Executable File

# Another language for portable shell scripting.
# This installs Python 3 with my usual packages.
# For projects with other libraries (e.g., Django, Pytorch), you can just have a `default.nix` (and a `shell.nix` for more convenience).
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.dev.python;
in {
options.modules.dev.python = let
mkBoolOption = bool: mkOption {
type = types.bool;
default = bool;
}; in {
enable = mkBoolOption false;
math.enable = mkBoolOption false;
};
config = mkIf cfg.enable {
my.packages = with pkgs; [
(python37.withPackages (p: with python3Packages; [
beautifulsoup4 # How soups are beautiful again?
requests # The requests for your often-asked questions.
pytools # It's the little things that counts.
pytest # Try to make a good grade or else.
poetry # It rhymes...
scrapy # Create an extractor from a box of scraps.
setuptools # Setup your stuff.
]
++ (if cfg.math.enable then [
numpy # Numbers are also good, right?
sympy # When will you notice that math is good?
] else [])))
];
};
}