feat(dev): add enableGlobally opt
I only need the envvars set. All my development environments are in shell.nix's and global installations are usually unneeded.
This commit is contained in:
parent
233297ae71
commit
3afaee991c
|
@ -8,33 +8,40 @@
|
|||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.dev.node;
|
||||
node = pkgs.nodejs_latest;
|
||||
in {
|
||||
options.modules.dev.node = {
|
||||
enable = mkBoolOpt false;
|
||||
enableGlobally = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
user.packages = with pkgs; [
|
||||
nodejs
|
||||
yarn
|
||||
];
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.enableGlobally {
|
||||
user.packages = with pkgs; [
|
||||
node
|
||||
yarn
|
||||
];
|
||||
|
||||
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 = [ "$(${pkgs.yarn}/bin/yarn global bin)" ];
|
||||
# Run locally installed bin-script, e.g. n coffee file.coffee
|
||||
environment.shellAliases = {
|
||||
n = "PATH=\"$(${node}/bin/npm bin):$PATH\"";
|
||||
ya = "yarn";
|
||||
};
|
||||
|
||||
# Run locally installed bin-script, e.g. n coffee file.coffee
|
||||
environment.shellAliases = {
|
||||
n = "PATH=\"$(${pkgs.nodejs}/bin/npm bin):$PATH\"";
|
||||
ya = "yarn";
|
||||
};
|
||||
env.PATH = [ "$(${pkgs.yarn}/bin/yarn global bin)" ];
|
||||
})
|
||||
|
||||
home.configFile."npm/config".text = ''
|
||||
cache=$XDG_CACHE_HOME/npm
|
||||
prefix=$XDG_DATA_HOME/npm
|
||||
'';
|
||||
};
|
||||
{
|
||||
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";
|
||||
|
||||
home.configFile."npm/config".text = ''
|
||||
cache=$XDG_CACHE_HOME/npm
|
||||
prefix=$XDG_DATA_HOME/npm
|
||||
'';
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -12,35 +12,40 @@ let cfg = config.modules.dev.python;
|
|||
in {
|
||||
options.modules.dev.python = {
|
||||
enable = mkBoolOpt false;
|
||||
enableGlobally = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
user.packages = with pkgs; [
|
||||
python37
|
||||
python37Packages.pip
|
||||
python37Packages.ipython
|
||||
python37Packages.black
|
||||
python37Packages.setuptools
|
||||
python37Packages.pylint
|
||||
python37Packages.poetry
|
||||
];
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.enableGlobally {
|
||||
user.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";
|
||||
env.PYTHON_EGG_CACHE = "$XDG_CACHE_HOME/python-eggs";
|
||||
env.JUPYTER_CONFIG_DIR = "$XDG_CONFIG_HOME/jupyter";
|
||||
environment.shellAliases = {
|
||||
py = "python";
|
||||
py2 = "python2";
|
||||
py3 = "python3";
|
||||
po = "poetry";
|
||||
ipy = "ipython --no-banner";
|
||||
ipylab = "ipython --pylab=qt5 --no-banner";
|
||||
};
|
||||
})
|
||||
|
||||
environment.shellAliases = {
|
||||
py = "python";
|
||||
py2 = "python2";
|
||||
py3 = "python3";
|
||||
po = "poetry";
|
||||
ipy = "ipython --no-banner";
|
||||
ipylab = "ipython --pylab=qt5 --no-banner";
|
||||
};
|
||||
};
|
||||
{
|
||||
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";
|
||||
env.PYTHON_EGG_CACHE = "$XDG_CACHE_HOME/python-eggs";
|
||||
env.JUPYTER_CONFIG_DIR = "$XDG_CONFIG_HOME/jupyter";
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -15,21 +15,26 @@ let cfg = config.modules.dev.rust;
|
|||
in {
|
||||
options.modules.dev.rust = {
|
||||
enable = mkBoolOpt false;
|
||||
enableGlobally = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
user.packages = with pkgs; [
|
||||
rustup
|
||||
];
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.enableGlobally {
|
||||
user.packages = [ pkgs.rustup ];
|
||||
|
||||
env.RUSTUP_HOME = "$XDG_DATA_HOME/rustup";
|
||||
env.CARGO_HOME = "$XDG_DATA_HOME/cargo";
|
||||
env.PATH = [ "$CARGO_HOME/bin" ];
|
||||
env.PATH = [ "$(${pkgs.yarn}/bin/yarn global bin)" ];
|
||||
})
|
||||
|
||||
environment.shellAliases = {
|
||||
rs = "rustc";
|
||||
rsp = "rustup";
|
||||
ca = "cargo";
|
||||
};
|
||||
};
|
||||
{
|
||||
env.RUSTUP_HOME = "$XDG_DATA_HOME/rustup";
|
||||
env.CARGO_HOME = "$XDG_DATA_HOME/cargo";
|
||||
env.PATH = [ "$CARGO_HOME/bin" ];
|
||||
|
||||
environment.shellAliases = {
|
||||
rs = "rustc";
|
||||
rsp = "rustup";
|
||||
ca = "cargo";
|
||||
};
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue