Created
January 10, 2019 06:38
-
-
Save sdorminey/c138bbf94d702ebebcd45044dfdc5f0b to your computer and use it in GitHub Desktop.
Python environment!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} | |
, extraPkgs ? "" | |
, extraPaths ? ""}: | |
let | |
python-env = import ./envs/python-env.nix { | |
inherit pkgs; | |
}; | |
split = str: builtins.filter (s: builtins.stringLength s > 0) (pkgs.lib.splitString "," str); | |
in | |
{ | |
env-python = python-env.override { | |
extraPkgs = split extraPkgs; | |
extraPaths = split extraPaths; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? (import <nixpkgs> {}) }: | |
with pkgs; | |
let | |
vim-vdebug = vimUtils.buildVimPlugin { | |
name = "vim-vdebug"; | |
version = "2018-11-30T17:38:29+01:00"; | |
src = fetchFromGitHub { | |
owner = "vim-vdebug"; | |
repo = "vdebug"; | |
rev = "903305f8e7895cddf838639e9280fb73568cfe69"; | |
sha256 = "17dw9ckq2jkjfvibsnsbznywk7i151pqglphvkvdsxd929l5l6z9"; | |
}; | |
}; | |
extras = { | |
inherit vim-vdebug; | |
}; | |
nvim-base = import ../neovim.nix pkgs; | |
nvim = nvim-base { | |
knownPlugins = extras; | |
pluginDictionaries = [ | |
{ name = "vim-vdebug"; } | |
]; | |
}; | |
pydbgp = callPackage ../pkgs/pydbgp.nix { | |
inherit stdenv fetchFromGitHub; | |
inherit (python36Packages) buildPythonPackage; | |
}; | |
basePips = ps: with ps; [ | |
pydbgp | |
python-language-server | |
pyls-mypy | |
flake8 | |
# pylint | |
]; | |
envFun = {extraPkgs ? [], extraPaths ? []}: | |
let | |
pypkgs = ps: (basePips ps) | |
++ (builtins.map (p: builtins.getAttr p ps) extraPkgs) | |
++ (builtins.map (p: callPackage {}) extraPaths); | |
in stdenv.mkDerivation rec { | |
name = "env-python"; | |
ENV_NAME = name; | |
shellHook = '' | |
export SHELL=${fish}/bin/fish | |
''; | |
buildInputs = [ | |
cowsay | |
nvim | |
fish | |
(python36.withPackages pypkgs) | |
]; | |
}; | |
in lib.makeOverridable envFun {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment