[NixOS] Add functions autoload

This commit is contained in:
Ivan Malison 2021-08-02 03:13:44 -06:00
parent 46d938a171
commit adfc010f65
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
function get_cols {
FS="${FS:- }"
gawk -f "$HOME/.lib/get_cols.awk" -v "cols=$*" -v "FS=$FS"
}
get_cols "$@"

View File

@ -1,4 +1,5 @@
#!/usr/bin/env gawk -f #!/usr/bin/env gawk -f
BEGIN { BEGIN {
column_count=split(cols,column_numbers," "); column_count=split(cols,column_numbers," ");
} }

42
nixos/environment.nix Normal file
View File

@ -0,0 +1,42 @@
{ config, pkgs, options, lib, ... }:
with lib;
{
options = {
dotfiles-directory = mkOption {
type = types.str;
default = "/home/imalison/dotfiles";
};
};
config = let libDir = "${config.dotfiles-directory}/dotfiles/lib";
in {
# Shell configuration
programs.zsh = {
enable = true;
syntaxHighlighting = {
enable = true;
};
ohMyZsh = {
enable = true;
plugins = [ "git" "sudo" "pip" ];
};
spaceship-prompt.enable = true;
shellInit = ''
fpath+="${libDir}/functions"
for file in "${libDir}/functions/"*
do
autoload "''${file##*/}"
done
'';
};
environment = {
homeBinInPath = true;
localBinInPath = true;
extraInit = ''
export PATH="${libDir}/bin:$PATH"
export PATH="${libDir}/functions:$PATH"
'';
};
};
}