home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8b4168373adceb50db6aa6f39c7456a04fe3b529
parent 16a7e1d09e6c5a70ee01fd24c6f9696a335e9bc0
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 10 Apr 2020 14:04:11 +0200

nixpkgs-fmt: dev.go.nix and zsh.nix

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mmodules/profiles/dev.go.nix | 96+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mmodules/profiles/zsh.nix | 279++++++++++++++++++++++++++++++++++++++++---------------------------------------
2 files changed, 192 insertions(+), 183 deletions(-)

diff --git a/modules/profiles/dev.go.nix b/modules/profiles/dev.go.nix @@ -10,51 +10,55 @@ in enable = mkEnableOption "Enable go development profile"; }; }; - config = mkIf cfg.enable (mkMerge [ - { - home.sessionVariables = { - GOPATH = "${config.home.homeDirectory}"; - }; - profiles.dev.enable = true; - home.packages = with pkgs; [ - gcc - go - godef - golangci-lint - golint - gopkgs - go-outline - go-symbols - delve - # vendoring tools - dep - nur.repos.vdemeester.dep-collector - # misc - protobuf - nur.repos.vdemeester.protobuild - nur.repos.vdemeester.ram - nur.repos.vdemeester.sec - nur.repos.vdemeester.goreturns - nur.repos.vdemeester.esc - nur.repos.vdemeester.yaspell - ]; - xdg.configFile."nr/go" = { - text = builtins.toJSON [ - {cmd = "pprof"; chan = "unstable";} - {cmd = "vndr"; chan = "unstable";} - {cmd = "go2nix"; } - {cmd = "dep2nix"; } + config = mkIf cfg.enable ( + mkMerge [ + { + home.sessionVariables = { + GOPATH = "${config.home.homeDirectory}"; + }; + profiles.dev.enable = true; + home.packages = with pkgs; [ + gcc + go + godef + golangci-lint + golint + gopkgs + go-outline + go-symbols + delve + # vendoring tools + dep + nur.repos.vdemeester.dep-collector + # misc + protobuf + nur.repos.vdemeester.protobuild + nur.repos.vdemeester.ram + nur.repos.vdemeester.sec + nur.repos.vdemeester.goreturns + nur.repos.vdemeester.esc + nur.repos.vdemeester.yaspell ]; - onChange = "${pkgs.nur.repos.vdemeester.nr}/bin/nr go"; - }; - } - (mkIf config.profiles.fish.enable { - xdg.configFile."fish/conf.d/go.fish".source = ./assets/fish/go.fish; - programs.fish.shellAbbrs = { - got = "go test -v"; - gob = "go build -v"; - gol = "golangci-lint run"; - }; - }) - ]); + xdg.configFile."nr/go" = { + text = builtins.toJSON [ + { cmd = "pprof"; chan = "unstable"; } + { cmd = "vndr"; chan = "unstable"; } + { cmd = "go2nix"; } + { cmd = "dep2nix"; } + ]; + onChange = "${pkgs.nur.repos.vdemeester.nr}/bin/nr go"; + }; + } + ( + mkIf config.profiles.fish.enable { + xdg.configFile."fish/conf.d/go.fish".source = ./assets/fish/go.fish; + programs.fish.shellAbbrs = { + got = "go test -v"; + gob = "go build -v"; + gol = "golangci-lint run"; + }; + } + ) + ] + ); } diff --git a/modules/profiles/zsh.nix b/modules/profiles/zsh.nix @@ -14,143 +14,148 @@ in }; }; }; - config = mkIf cfg.enable (mkMerge [ - { - home.packages = with pkgs; [ - zsh-syntax-highlighting - nix-zsh-completions - ]; - home.file."${config.programs.zsh.dotDir}/completion.zsh".source = ./assets/zsh/completion.zsh; - home.file."${config.programs.zsh.dotDir}/prompt.zsh".source = ./assets/zsh/prompt.zsh; - home.file."${config.programs.zsh.dotDir}/functions/j".source = ./assets/zsh/j; - programs.zsh = { - enable = true; - dotDir = ".config/zsh"; - autocd = true; - defaultKeymap = "emacs"; - enableAutosuggestions = true; - history = { - size = 100000; - expireDuplicatesFirst = true; - ignoreDups = true; + config = mkIf cfg.enable ( + mkMerge [ + { + home.packages = with pkgs; [ + zsh-syntax-highlighting + nix-zsh-completions + ]; + home.file."${config.programs.zsh.dotDir}/completion.zsh".source = ./assets/zsh/completion.zsh; + home.file."${config.programs.zsh.dotDir}/prompt.zsh".source = ./assets/zsh/prompt.zsh; + home.file."${config.programs.zsh.dotDir}/functions/j".source = ./assets/zsh/j; + programs.zsh = { + enable = true; + dotDir = ".config/zsh"; + autocd = true; + defaultKeymap = "emacs"; + enableAutosuggestions = true; + history = { + size = 100000; + expireDuplicatesFirst = true; + ignoreDups = true; + }; + localVariables = { + EMOJI_CLI_KEYBIND = "^n"; + EMOJI_CLI_USE_EMOJI = "yes"; + ZSH_HIGHLIGHT_HIGHLIGHTERS = [ "main" "brackets" "pattern" ]; + }; + shellAliases = import ./aliases.shell.nix; + plugins = [ + { + name = "emoji-cli"; + src = pkgs.fetchFromGitHub { + owner = "b4b4r07"; + repo = "emoji-cli"; + rev = "26e2d67d566bfcc741891c8e063a00e0674abc92"; + sha256 = "0n88w4k5vaz1iyikpmlzdrrkxmfn91x5s4q405k1fxargr1w6bmx"; + }; + } + { + name = "zsh-z"; + src = pkgs.fetchFromGitHub { + owner = "agkozak"; + repo = "zsh-z"; + rev = "5b903f8f5489783ee2a4af668a941b7d9a02efc9"; + sha256 = "07h6ksiqgqyf5m84hv5xf4jcqrl8q1cj8wd4z52cjmy82kk10fkn"; + }; + } + { + name = "async"; + src = pkgs.fetchFromGitHub { + owner = "mafredri"; + repo = "zsh-async"; + rev = "v1.7.0"; + sha256 = "1jbbypgn0r4pilhv2s2p11vbkkvlnf75wrhxfcvr7bfjpzyp9wbc"; + }; + } + { + name = "zsh-completions"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-completions"; + rev = "922eee0706acb111e9678ac62ee77801941d6df2"; + sha256 = "04skzxv8j06f1snsx62qnca5f2183w0wfs5kz78rs8hkcyd6g89w"; + }; + } + # romkatv/powerlevel10k + { + name = "powerlevel10k"; + src = pkgs.fetchFromGitHub { + owner = "romkatv"; + repo = "powerlevel10k"; + rev = "700910cd0421a7d25d2800cefa76eb6d80dc62a8"; + sha256 = "011ja4r3a8vbcs42js9nri4p8pi8z4ccqxl2qyf52pn3pfnidigj"; + }; + } + ]; + envExtra = '' + export GOPATH=${config.home.homeDirectory} + export WEBKIT_DISABLE_COMPOSITING_MODE=1; + if [ -d $HOME/.krew/bin ]; then + export PATH=$HOME/.krew/bin:$PATH + fi + ''; + loginExtra = '' + export GOPATH=${config.home.homeDirectory} + ''; + initExtra = '' + path+="$HOME/${config.programs.zsh.dotDir}/functions" + fpath+="$HOME/.nix-profile/share/zsh/site-functions" + fpath+="$HOME/${config.programs.zsh.dotDir}/functions" + for func ($HOME/${config.programs.zsh.dotDir}/functions) autoload -U $func/*(x:t) + autoload -Uz select-word-style; select-word-style bash + if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi + #if [ -n "$INSIDE_EMACS" ]; then + # chpwd() { print -P "\033AnSiTc %d" } + # print -P "\033AnSiTu %n" + # print -P "\033AnSiTc %d" + #fi + if [[ "$TERM" == "dumb" || "$TERM" == "emacs" ]] + then + TERM=eterm-color + unsetopt zle + unsetopt prompt_cr + unsetopt prompt_subst + unfunction precmd + unfunction preexec + PS1='$ ' + return + fi + # make sure navigation using emacs keybindings works on all non-alphanumerics + # syntax highlighting + source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') + ZSH_HIGHLIGHT_PATTERNS+=('rm -fR *' 'fg=white,bold,bg=red') + ZSH_HIGHLIGHT_PATTERNS+=('rm -fr *' 'fg=white,bold,bg=red') + source $HOME/${config.programs.zsh.dotDir}/completion.zsh + source $HOME/${config.programs.zsh.dotDir}/plugins/powerlevel10k/powerlevel10k.zsh-theme + source $HOME/${config.programs.zsh.dotDir}/prompt.zsh + setopt hist_ignore_space + alias -g L="|less" + alias -g EEL=' 2>&1 | less' + alias -g GB='`git rev-parse --abbrev-ref HEAD`' + alias -g GR='`git rev-parse --show-toplevel`' + (( $+commands[jq] )) && alias -g MJ="| jq -C '.'" || alias -g MJ="| ${pkgs.python3}/bin/python -mjson.tool" + ''; + profileExtra = '' + if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi + export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH + ''; }; - localVariables = { - EMOJI_CLI_KEYBIND = "^n"; - EMOJI_CLI_USE_EMOJI = "yes"; - ZSH_HIGHLIGHT_HIGHLIGHTERS = [ "main" "brackets" "pattern" ]; + programs.fzf = { + enable = true; + enableZshIntegration = true; + defaultOptions = [ "--bind=ctrl-j:accept" ]; }; - shellAliases = import ./aliases.shell.nix; - plugins = [ - { - name = "emoji-cli"; - src = pkgs.fetchFromGitHub { - owner = "b4b4r07"; - repo = "emoji-cli"; - rev = "26e2d67d566bfcc741891c8e063a00e0674abc92"; - sha256 = "0n88w4k5vaz1iyikpmlzdrrkxmfn91x5s4q405k1fxargr1w6bmx"; - }; - } - { - name = "zsh-z"; - src = pkgs.fetchFromGitHub { - owner = "agkozak"; - repo = "zsh-z"; - rev = "5b903f8f5489783ee2a4af668a941b7d9a02efc9"; - sha256 = "07h6ksiqgqyf5m84hv5xf4jcqrl8q1cj8wd4z52cjmy82kk10fkn"; - }; - } - { - name = "async"; - src = pkgs.fetchFromGitHub { - owner = "mafredri"; - repo = "zsh-async"; - rev = "v1.7.0"; - sha256 = "1jbbypgn0r4pilhv2s2p11vbkkvlnf75wrhxfcvr7bfjpzyp9wbc"; - }; - } - { - name = "zsh-completions"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-completions"; - rev = "922eee0706acb111e9678ac62ee77801941d6df2"; - sha256 = "04skzxv8j06f1snsx62qnca5f2183w0wfs5kz78rs8hkcyd6g89w"; - }; - } - # romkatv/powerlevel10k - { - name = "powerlevel10k"; - src = pkgs.fetchFromGitHub { - owner = "romkatv"; - repo = "powerlevel10k"; - rev = "700910cd0421a7d25d2800cefa76eb6d80dc62a8"; - sha256 = "011ja4r3a8vbcs42js9nri4p8pi8z4ccqxl2qyf52pn3pfnidigj"; - }; - } - ]; - envExtra = '' - export GOPATH=${config.home.homeDirectory} - if [ -d $HOME/.krew/bin ]; then - export PATH=$HOME/.krew/bin:$PATH - fi - ''; - loginExtra = '' - export GOPATH=${config.home.homeDirectory} - ''; - initExtra = '' - path+="$HOME/${config.programs.zsh.dotDir}/functions" - fpath+="$HOME/.nix-profile/share/zsh/site-functions" - fpath+="$HOME/${config.programs.zsh.dotDir}/functions" - for func ($HOME/${config.programs.zsh.dotDir}/functions) autoload -U $func/*(x:t) - autoload -Uz select-word-style; select-word-style bash - if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi - #if [ -n "$INSIDE_EMACS" ]; then - # chpwd() { print -P "\033AnSiTc %d" } - # print -P "\033AnSiTu %n" - # print -P "\033AnSiTc %d" - #fi - if [[ "$TERM" == "dumb" || "$TERM" == "emacs" ]] - then - TERM=eterm-color - unsetopt zle - unsetopt prompt_cr - unsetopt prompt_subst - unfunction precmd - unfunction preexec - PS1='$ ' - return - fi - # make sure navigation using emacs keybindings works on all non-alphanumerics - # syntax highlighting - source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') - ZSH_HIGHLIGHT_PATTERNS+=('rm -fR *' 'fg=white,bold,bg=red') - ZSH_HIGHLIGHT_PATTERNS+=('rm -fr *' 'fg=white,bold,bg=red') - source $HOME/${config.programs.zsh.dotDir}/completion.zsh - source $HOME/${config.programs.zsh.dotDir}/plugins/powerlevel10k/powerlevel10k.zsh-theme - source $HOME/${config.programs.zsh.dotDir}/prompt.zsh - setopt hist_ignore_space - alias -g L="|less" - alias -g EEL=' 2>&1 | less' - alias -g GB='`git rev-parse --abbrev-ref HEAD`' - alias -g GR='`git rev-parse --show-toplevel`' - (( $+commands[jq] )) && alias -g MJ="| jq -C '.'" || alias -g MJ="| ${pkgs.python3}/bin/python -mjson.tool" - ''; - profileExtra = '' - if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi - export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH - ''; - }; - programs.fzf = { - enable = true; - enableZshIntegration = true; - defaultOptions = [ "--bind=ctrl-j:accept" ]; - }; - } - (mkIf config.profiles.emacs.enable { - /*programs.zsh.initExtra = '' - export EDITOR=et - '';*/ - }) - ]); + } + ( + mkIf config.profiles.emacs.enable { + /*programs.zsh.initExtra = '' + export EDITOR=et + '';*/ + } + ) + ] + ); }