From 05a12cd80da7c0f1f9fc23e938e91f9585e12989 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 12 Jan 2020 19:47:33 -0500 Subject: [PATCH] Rewrite & add dev modules For python, rust, love2D/lua, and node --- machines/kuro.nix | 2 +- modules/dev/{cpp.nix => cc.nix} | 3 +++ modules/dev/godot.nix | 2 +- modules/dev/love2d.nix | 10 ++++++++++ modules/dev/node.nix | 23 ++++++++++++++--------- modules/dev/python.nix | 31 +++++++++++++++++++++++++++++++ modules/dev/rust.nix | 19 ++++++++++++++++--- modules/editors/emacs.nix | 3 --- 8 files changed, 76 insertions(+), 17 deletions(-) rename modules/dev/{cpp.nix => cc.nix} (84%) diff --git a/machines/kuro.nix b/machines/kuro.nix index eecd6e57..b424958f 100644 --- a/machines/kuro.nix +++ b/machines/kuro.nix @@ -15,7 +15,7 @@ # virtualbox for testing - + diff --git a/modules/dev/cpp.nix b/modules/dev/cc.nix similarity index 84% rename from modules/dev/cpp.nix rename to modules/dev/cc.nix index 870741a4..0225cac7 100644 --- a/modules/dev/cpp.nix +++ b/modules/dev/cc.nix @@ -6,7 +6,10 @@ my.packages = with pkgs; [ clang gcc + bear + gdb cmake llvmPackages.libcxx + ccls ]; } diff --git a/modules/dev/godot.nix b/modules/dev/godot.nix index 8db3c0f0..864af43d 100644 --- a/modules/dev/godot.nix +++ b/modules/dev/godot.nix @@ -4,7 +4,7 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ godot ]; } diff --git a/modules/dev/love2d.nix b/modules/dev/love2d.nix index e69de29b..14fed997 100644 --- a/modules/dev/love2d.nix +++ b/modules/dev/love2d.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: + +{ + my.packages = with pkgs; [ + love + lua + luaPackages.moonscript + luarocks + ]; +} diff --git a/modules/dev/node.nix b/modules/dev/node.nix index 0be59411..2934fdf4 100644 --- a/modules/dev/node.nix +++ b/modules/dev/node.nix @@ -3,16 +3,21 @@ { imports = [ ./. ]; - environment = { - variables = { - NPM_CONFIG_USERCONFIG = "$XDG_CONFIG_HOME/npm/config"; - NPM_CONFIG_CACHE = "$XDG_CACHE_HOME/npm"; - NPM_CONFIG_TMP = "$XDG_RUNTIME_DIR/npm"; - NPM_CONFIG_PREFIX = "$XDG_CACHE_HOME/npm"; - }; - - systemPackages = with pkgs; [ + my = { + packages = with pkgs; [ nodejs + nodePackages.javascript-typescript-langserver ]; + + env.NPM_CONFIG_USERCONFIG = "$XDG_CONFIG_HOME/npm/config"; + env.NPM_CONFIG_CACHE = "$XDG_CACHE_HOME/npm"; + env.NPM_CONFIG_TMP = "$XDG_RUNTIME_DIR/npm"; + env.NPM_CONFIG_PREFIX = "$XDG_CACHE_HOME/npm"; + env.NODE_REPL_HISTORY = "$XDG_CACHE_HOME/node/repl_history"; + env.PATH = [ "$(yarn global bin)" ]; + + # Run locally installed bin-script, e.g. n coffee file.coffee + alias.n = "PATH=\"$(npm bin):$PATH\""; + alias.ya = "yarn"; }; } diff --git a/modules/dev/python.nix b/modules/dev/python.nix index e69de29b..aae0438e 100644 --- a/modules/dev/python.nix +++ b/modules/dev/python.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +{ + my = { + packages = with pkgs; [ + python37 + python37Packages.pip + python37Packages.ipython + python37Packages.black + python37Packages.setuptools + python37Packages.pylint + python37Packages.poetry + ]; + + env.IPYTHONDIR = "$XDG_CONFIG_HOME/ipython"; + env.PIP_CONFIG_FILE = "$XDG_CONFIG_HOME/pip/pip.conf"; + env.PIP_LOG_FILE = "$XDG_DATA_HOME/pip/log"; + env.PYLINTHOME = "$XDG_DATA_HOME/pylint"; + env.PYLINTRC = "$XDG_CONFIG_HOME/pylint/pylintrc"; + env.PYTHONSTARTUP = "$XDG_CONFIG_HOME/python/pythonrc"; + + zsh.rc = lib.readFile ; + + alias.py = "python"; + alias.py2 = "python2"; + alias.py3 = "python3"; + alias.po = "poetry"; + alias.ipy = "ipython --no-banner"; + alias.ipylab = "ipython --pylab=qt5 --no-banner"; + }; +} diff --git a/modules/dev/rust.nix b/modules/dev/rust.nix index d43a7400..f73fede3 100644 --- a/modules/dev/rust.nix +++ b/modules/dev/rust.nix @@ -1,10 +1,23 @@ { config, lib, pkgs, ... }: - { my = { - packages = with pkgs; [ rustup ]; - env.CARGO_HOME = "$XDG_DATA_HOME/cargo"; + packages = with pkgs; [ + rustup + rustfmt + rls + ]; + env.RUSTUP_HOME = "$XDG_DATA_HOME/rustup"; + env.CARGO_HOME = "$XDG_DATA_HOME/cargo"; env.PATH = [ "$CARGO_HOME/bin" ]; + + alias.rs = "rustc"; + alias.rsp = "rustup"; + alias.ca = "cargo"; + + setup = '' + ${pkgs.rustup}/bin/rustup update nightly + ${pkgs.rustup}/bin/rustup default nightly + ''; }; } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index edadb061..a90b0ff2 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -22,9 +22,6 @@ # Module dependencies sqlite # :tools (lookup +docsets) texlive.combined.scheme-medium # :lang org -- for latex previews - ccls # :lang (cc +lsp) - nodePackages.javascript-typescript-langserver # :lang (javascript +lsp) - rls ]; env.PATH = [ "$HOME/.emacs.d/bin" ];