diff --git a/hm/common.nix b/hm/common.nix index e90acfd..b30bcd7 100644 --- a/hm/common.nix +++ b/hm/common.nix @@ -1,237 +1,131 @@ { pkgs, config, lib, ... }: { - - nixpkgs.config.allowUnfree = true; - nix = { - package = lib.mkDefault pkgs.nixFlakes; - settings = { - experimental-features = [ "nix-command" "flakes" ]; - warn-dirty = false; - }; - }; - - programs = - let - # TODO Those directory creations should probably done on home-manager activation - commonSessionVariables = { - TIME_STYLE = "+%Y-%m-%d %H:%M:%S"; - # Less colors - LESS = "-R"; - LESS_TERMCAP_mb = "$(echo $'\\E[1;31m')"; # begin blink - LESS_TERMCAP_md = "$(echo $'\\E[1;36m')"; # begin bold - LESS_TERMCAP_me = "$(echo $'\\E[0m')"; # reset bold/blink - LESS_TERMCAP_so = "$(echo $'\\E[01;44;33m')"; # begin reverse video - LESS_TERMCAP_se = "$(echo $'\\E[0m')"; # reset reverse video - LESS_TERMCAP_us = "$(echo $'\\E[1;32m')"; # begin underline - LESS_TERMCAP_ue = "$(echo $'\\E[0m')"; # reset underline - # Fzf - FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}"; - }; - commonShellAliases = { - # Replacement commands - # ls = "lsd"; # lsd is suuuper slow for large directories - cat = "bat -pp"; - - # Completion for existing commands - mkdir = "mkdir -v"; - # cp = "cp -i"; # Disabled because conflicts with the ZSH/Bash one. This separation is confusing I swear. - mv = "mv -iv"; - free = "free -h"; - df = "df -h"; - ffmpeg = "ffmpeg -hide_banner"; - ffprobe = "ffprobe -hide_banner"; - ffplay = "ffplay -hide_banner"; - numbat = "numbat --intro-banner off"; - insect = "numbat"; - - # Frequent mistakes - sl = "ls"; - al = "la"; - mdkir = "mkdir"; - systemclt = "systemctl"; - please = "sudo"; - - # Shortcuts for commonly used commands - ll = "lsd -l"; - la = "lsd -la"; - s = "sudo -s -E"; - - - # Give additional config to those programs, and not have them in my path - bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links"; - iftop = "iftop -c ${config.xdg.configHome}/iftoprc"; - lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml"; - - # Preference - vi = "nvim"; - vim = "nvim"; - wol = "wakeonlan"; # TODO Really, isn't wol better? Also wtf Arch aliases to pass because neither is installed anyways x) - mutt = "neomutt"; - - # Bash/Zsh only - cp = "cp -i --reflink=auto"; - grep = "grep --color=auto"; - dd = "dd status=progress"; - rm = "rm -v --one-file-system"; - # free = "free -m"; # Disabled because... no? Why? - diff = "diff --color=auto"; - dmesg = "dmesg --ctime"; - wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts"; - - # Imported from scripts - rms = ''${pkgs.findutils}/bin/find . -name "*.sync-conflict-*" -delete''; # Remove syncthing conflict files - pw = ''${pkgs.pwgen}/bin/pwgen 32 -y''; # Generate passwords. ln((26*2+10)**32)/ln(2) ≅ 190 bits of entropy - newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail''; - oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head''; - tracefiles = ''${pkgs.strace}/bin/strace -f -t -e trace=file''; - }; - historySize = 100000; - historyFile = "${config.xdg.stateHome}/shell_history"; - in - { - - home-manager.enable = true; - bash = { - enable = true; - bashrcExtra = '' - shopt -s expand_aliases - shopt -s histappend - ''; - sessionVariables = commonSessionVariables; - historySize = historySize; - historyFile = historyFile; - historyFileSize = historySize; - historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; - shellAliases = commonShellAliases // config.frogeye.shellAliases; - }; - zsh = { - enable = true; - enableAutosuggestions = true; - enableCompletion = true; - syntaxHighlighting.enable = true; - historySubstringSearch.enable = true; - initExtra = builtins.readFile ./zshrc.sh; - defaultKeymap = "viins"; - history = { - size = historySize; - save = historySize; - path = historyFile; - expireDuplicatesFirst = true; - }; - sessionVariables = commonSessionVariables; - shellAliases = commonShellAliases // config.frogeye.shellAliases; - }; - bat = { - enable = true; - config = { - theme = "base16"; - style = "full"; - }; - }; - lsd = { - enable = true; - settings = { - size = "short"; - }; - colors = { - # Base16 only, so it reuses the current theme. - date = { day-old = 4; hour-old = 6; older = 5; }; - git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; }; - group = 6; - inode = { invalid = 245; valid = 13; }; - links = { invalid = 9; valid = 14; }; - permission = { acl = 6; context = 14; exec = 1; exec-sticky = 5; no-access = 245; octal = 6; read = 2; write = 3; }; - size = { large = 1; medium = 9; none = 11; small = 3; }; - tree-edge = 13; - user = 2; - }; - }; - dircolors = { - enable = true; - enableBashIntegration = true; - enableZshIntegration = true; - # UPST This thing put stuff in .dircolors when it actually doesn't have to - }; - powerline-go = { - enable = true; - modules = [ "user" "host" "venv" "cwd" "perms" "git" ]; - modulesRight = [ "jobs" "exit" "duration" "load" ]; - settings = { - colorize-hostname = true; - max-width = 25; - cwd-max-dir-size = 10; - duration = "$( test -n \"$__TIMER\" && echo $(( $EPOCHREALTIME - $\{__TIMER:-EPOCHREALTIME})) || echo 0 )"; - # UPST Implement this properly in home-manager, would allow for bash support - }; - extraUpdatePS1 = '' - unset __TIMER - echo -en "\033]0; $USER@$HOST $PWD\007" - ''; - }; - git.enable = true; - gpg.enable = true; - fzf = { - enable = true; - enableZshIntegration = true; - defaultOptions = [ "--height 40%" "--layout=default" ]; - fileWidgetOptions = [ "--preview '[[ -d {} ]] && ${pkgs.coreutils}/bin/ls -l --color=always {} || [[ \$(${pkgs.file}/bin/file --mime {}) =~ binary ]] && ${pkgs.file}/bin/file --brief {} || (${pkgs.highlight}/bin/highlight -O ansi -l {} || coderay {} || rougify {} || ${pkgs.coreutils}/bin/cat {}) 2> /dev/null | head -500'" ]; - # TODO Above not working... not really used either? - # file and friends are not in PATH by default... so here we want aboslute paths, which means those won't get reloaded. Meh. - }; - nix-index = { - # For non-NixOS systems - enable = false; # TODO Index is impossible to generate, should use https://github.com/nix-community/nix-index-database - # but got no luck without flakes - enableZshIntegration = true; - }; - less.enable = true; - nixvim.enable = true; - readline = { - enable = true; - variables = { - "bell-style" = "none"; - "colored-completion-prefix" = true; - "colored-stats" = true; - "completion-ignore-case" = true; - "completion-query-items" = 200; - "editing-mode" = "vi"; - "history-preserve-point" = true; - "history-size" = 10000; - "horizontal-scroll-mode" = false; - "mark-directories" = true; - "mark-modified-lines" = false; - "mark-symlinked-directories" = true; - "match-hidden-files" = true; - "menu-complete-display-prefix" = true; - "page-completions" = true; - "print-completions-horizontally" = false; - "revert-all-at-newline" = false; - "show-all-if-ambiguous" = true; - "show-all-if-unmodified" = true; - "show-mode-in-prompt" = true; - "skip-completed-text" = true; - "visible-stats" = false; - }; - extraConfig = builtins.readFile ./inputrc; - }; - tmux.enable = true; - translate-shell.enable = true; # TODO Cool config? - password-store.enable = true; - }; - xdg = { - configFile = { - "iftoprc" = { - text = '' - port-resolution: no - promiscuous: no - port-display: on - link-local: yes - use-bytes: yes - show-totals: yes - log-scale: yes - ''; + programs = { + home-manager.enable = true; + bat = { + enable = true; + config = { + theme = "base16"; + style = "full"; }; }; + bash.shellAliases = { + # Replacement commands + # ls = "lsd"; # lsd is suuuper slow for large directories + cat = "bat -pp"; + + # Completion for existing commands + mkdir = "mkdir -v"; + # cp = "cp -i"; # Disabled because conflicts with the ZSH/Bash one. This separation is confusing I swear. + mv = "mv -iv"; + free = "free -h"; + df = "df -h"; + ffmpeg = "ffmpeg -hide_banner"; + ffprobe = "ffprobe -hide_banner"; + ffplay = "ffplay -hide_banner"; + numbat = "numbat --intro-banner off"; + insect = "numbat"; + + # Frequent mistakes + sl = "ls"; + al = "la"; + mdkir = "mkdir"; + systemclt = "systemctl"; + please = "sudo"; + + # Shortcuts for commonly used commands + ll = "lsd -l"; + la = "lsd -la"; + s = "sudo -s -E"; + + + # Preference + wol = "wakeonlan"; # TODO Really, isn't wol better? Also wtf Arch aliases to pass because neither is installed anyways x) + mutt = "neomutt"; + + # Bash/Zsh only + cp = "cp -i --reflink=auto"; + grep = "grep --color=auto"; + dd = "dd status=progress"; + rm = "rm -v --one-file-system"; + # free = "free -m"; # Disabled because... no? Why? + diff = "diff --color=auto"; + dmesg = "dmesg --ctime"; + wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts"; + + # Imported from scripts + rms = ''${pkgs.findutils}/bin/find . -name "*.sync-conflict-*" -delete''; # Remove syncthing conflict files + pw = ''${pkgs.pwgen}/bin/pwgen 32 -y''; # Generate passwords. ln((26*2+10)**32)/ln(2) ≅ 190 bits of entropy + newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail''; + oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head''; + }; + lsd = { + enable = true; + settings = { + size = "short"; + }; + colors = { + # Base16 only, so it reuses the current theme. + date = { day-old = 4; hour-old = 6; older = 5; }; + git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; }; + group = 6; + inode = { invalid = 245; valid = 13; }; + links = { invalid = 9; valid = 14; }; + permission = { acl = 6; context = 14; exec = 1; exec-sticky = 5; no-access = 245; octal = 6; read = 2; write = 3; }; + size = { large = 1; medium = 9; none = 11; small = 3; }; + tree-edge = 13; + user = 2; + }; + }; + dircolors = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + # UPST This thing put stuff in .dircolors when it actually doesn't have to + }; + git.enable = true; + gpg.enable = true; + fzf = { + enable = true; + enableZshIntegration = true; + defaultOptions = [ "--height 40%" "--layout=default" ]; + fileWidgetOptions = [ "--preview '[[ -d {} ]] && ${pkgs.coreutils}/bin/ls -l --color=always {} || [[ \$(${pkgs.file}/bin/file --mime {}) =~ binary ]] && ${pkgs.file}/bin/file --brief {} || (${pkgs.highlight}/bin/highlight -O ansi -l {} || coderay {} || rougify {} || ${pkgs.coreutils}/bin/cat {}) 2> /dev/null | head -500'" ]; + # TODO Above not working... not really used either? + # file and friends are not in PATH by default... so here we want aboslute paths, which means those won't get reloaded. Meh. + }; + less.enable = true; + nixvim.enable = true; + readline = { + enable = true; + variables = { + "bell-style" = "none"; + "colored-completion-prefix" = true; + "colored-stats" = true; + "completion-ignore-case" = true; + "completion-query-items" = 200; + "editing-mode" = "vi"; + "history-preserve-point" = true; + "history-size" = 10000; + "horizontal-scroll-mode" = false; + "mark-directories" = true; + "mark-modified-lines" = false; + "mark-symlinked-directories" = true; + "match-hidden-files" = true; + "menu-complete-display-prefix" = true; + "page-completions" = true; + "print-completions-horizontally" = false; + "revert-all-at-newline" = false; + "show-all-if-ambiguous" = true; + "show-all-if-unmodified" = true; + "show-mode-in-prompt" = true; + "skip-completed-text" = true; + "visible-stats" = false; + }; + extraConfig = builtins.readFile ./inputrc; + }; + tmux.enable = true; + translate-shell.enable = true; # TODO Cool config? + password-store.enable = true; }; home = { activation = { @@ -272,11 +166,6 @@ tldr neofetch - # nix utils - nix-diff - nix-tree - nix-output-monitor - # remote wget curl @@ -291,16 +180,6 @@ duperemove compsize - # local monitoring - htop - iotop - iftop - lsof - strace - pv - progress - speedtest-cli - # toolbox sox imagemagick @@ -312,28 +191,16 @@ ]; sessionVariables = { # Favourite commands - PAGER = "less"; - EDITOR = "nvim"; # Extra config - BOOT9_PATH = "${config.xdg.dataHome}/citra-emu/sysdata/boot9.bin"; - CCACHE_CONFIGPATH = "${config.xdg.configHome}/ccache.conf"; # INPUTRC = "${config.xdg.configHome}/inputrc"; # UPST Will use programs.readline, but doesn't allow path setting - LESSHISTFILE = "${config.xdg.stateHome}/lesshst"; - NODE_REPL_HISTORY = "${config.xdg.cacheHome}/node_repl_history"; - # TODO I think we're not using the urxvt daemon on purpose? - # TODO this should be desktop only, as a few things are too. SQLITE_HISTFILE = "${config.xdg.stateHome}/sqlite_history"; - YARN_DISABLE_SELF_UPDATE_CHECK = "true"; # This also disable the creation of a ~/.yarnrc file - } // lib.optionalAttrs config.frogeye.desktop.xorg { - # Favourite commands - VISUAL = "nvim"; - # Extra config - RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed - # XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs + # Bash/ZSH only? + TIME_STYLE = "+%Y-%m-%d %H:%M:%S"; + # Fzf + FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}"; }; - # TODO Session variables only get reloaded on login I think. sessionPath = [ "${config.home.homeDirectory}/.local/bin" "${config.home.homeDirectory}/.config/dotfiles/hm/scripts" # Not Nix path otherwise it gets converted into store, diff --git a/hm/default.nix b/hm/default.nix index 8cb1d3c..83c4156 100644 --- a/hm/default.nix +++ b/hm/default.nix @@ -10,7 +10,12 @@ ./git ./gpg ./homealone.nix + ./monitoring + ./nix + ./pager + ./prompt ./rebuild + ./shell ./ssh.nix ./style.nix ./tmux diff --git a/hm/desktop/default.nix b/hm/desktop/default.nix index 19a579f..ff24f4b 100644 --- a/hm/desktop/default.nix +++ b/hm/desktop/default.nix @@ -10,12 +10,6 @@ in ./qutebrowser.nix ]; config = lib.mkIf config.frogeye.desktop.xorg { - frogeye.shellAliases = { - noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise''; - beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null''; - - x = "startx ${config.home.homeDirectory}/${config.xsession.scriptPath}; logout"; - }; xsession = { enable = true; # Not using config.xdg.configHome because it needs to be $HOME-relative paths and path manipulation is hard @@ -80,6 +74,14 @@ in }; }; }; + bash.shellAliases = { + noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise''; + beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null''; + + x = "startx ${config.home.homeDirectory}/${config.xsession.scriptPath}; logout"; + + lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml"; + }; # Backup terminal urxvt = { enable = true; @@ -291,6 +293,9 @@ in MPD_PORT = "${toString config.services.mpd.network.port}"; ALSA_PLUGIN_DIR = "${pkgs.alsa-plugins}/lib/alsa-lib"; # Fixes an issue with sox (Cannot open shared library libasound_module_pcm_pulse.so) # UPST Patch this upstream like: https://github.com/NixOS/nixpkgs/blob/216b111fb87091632d077898df647d1438fc2edb/pkgs/applications/audio/espeak-ng/default.nix#L84 + + RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed + # XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs }; }; }; diff --git a/hm/dev/c.nix b/hm/dev/c.nix index a8dba5e..fffdeae 100644 --- a/hm/dev/c.nix +++ b/hm/dev/c.nix @@ -11,18 +11,23 @@ "ddd" "ghidra" ]; - shellAliases = { - gdb = "gdb -x ${config.xdg.configHome}/gdbinit"; + }; + home = { + packages = with pkgs; [ + binwalk + ccache + clang + cmake + ddd + gdb + ]; + sessionVariables = { + CCACHE_CONFIGPATH = "${config.xdg.configHome}/ccache.conf"; }; }; - home.packages = with pkgs; [ - binwalk - ccache - clang - cmake - ddd - gdb - ]; + programs.bash.shellAliases = { + gdb = "gdb -x ${config.xdg.configHome}/gdbinit"; + }; programs.nixvim.extraPlugins = [ pkgs.vimPlugins.nvim-dap ]; # Debug Adapter Protocol client xdg.configFile = { "ccache.conf" = { diff --git a/hm/dev/default.nix b/hm/dev/default.nix index 6216240..a71e778 100644 --- a/hm/dev/default.nix +++ b/hm/dev/default.nix @@ -3,6 +3,7 @@ ./c.nix ./common.nix ./go.nix + ./node.nix ./python.nix ]; } diff --git a/hm/dev/node.nix b/hm/dev/node.nix new file mode 100644 index 0000000..92f681e --- /dev/null +++ b/hm/dev/node.nix @@ -0,0 +1,21 @@ +# Untested post-nix +{ pkgs, lib, config, ... }: +{ + config = lib.mkIf config.frogeye.dev.node { + frogeye = { + direnv = { + npm_config_cache = "${config.xdg.cacheHome}/npm"; + YARN_CACHE_FOLDER = "${config.xdg.cacheHome}/yarn"; + }; + }; + home = { + sessionVariables = { + NODE_REPL_HISTORY = "${config.xdg.cacheHome}/node_repl_history"; + YARN_DISABLE_SELF_UPDATE_CHECK = "true"; # This also disable the creation of a ~/.yarnrc file + }; + }; + programs.bash.shellAliases = { + bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links"; + }; + }; +} diff --git a/hm/dev/python.nix b/hm/dev/python.nix index d23f3db..9eeb8c4 100644 --- a/hm/dev/python.nix +++ b/hm/dev/python.nix @@ -1,11 +1,6 @@ { pkgs, lib, config, ... }: { config = lib.mkIf config.frogeye.dev.python { - frogeye = { - shellAliases = { - ipython = "ipython --no-confirm-exit --pdb"; - }; - }; home = { packages = with pkgs; [ python3 @@ -15,6 +10,9 @@ PYTHONSTARTUP = "${config.xdg.configHome}/pythonstartup.py"; }; }; + programs.bash.shellAliases = { + ipython = "ipython --no-confirm-exit --pdb"; + }; programs.nixvim.plugins.lsp.servers.pylsp = { # Python enable = config.frogeye.dev.python; diff --git a/hm/gaming/default.nix b/hm/gaming/default.nix index 3eaf8c2..b45f283 100644 --- a/hm/gaming/default.nix +++ b/hm/gaming/default.nix @@ -3,13 +3,18 @@ config = lib.mkIf config.frogeye.gaming { # Using config.nixpkgs. creates an infinite recursion, # but the above might not be correct in case of cross-compiling? - home.packages = with pkgs; [ - # gaming - yuzu-mainline - minecraft - # TODO factorio + home = { + packages = with pkgs; [ + # gaming + yuzu-mainline + minecraft + # TODO factorio - steam # Common pitfall: https://github.com/NixOS/nixpkgs/issues/86506#issuecomment-623746883 - ]; + steam # Common pitfall: https://github.com/NixOS/nixpkgs/issues/86506#issuecomment-623746883 + ]; + sessionVariables = { + BOOT9_PATH = "${config.xdg.dataHome}/citra-emu/sysdata/boot9.bin"; + }; + }; }; } diff --git a/hm/homealone.nix b/hm/homealone.nix index 519dc28..428fd6b 100644 --- a/hm/homealone.nix +++ b/hm/homealone.nix @@ -9,11 +9,9 @@ GRADLE_USER_HOME = "${config.xdg.cacheHome}/gradle"; MIX_ARCHIVES = "${config.xdg.cacheHome}/mix/archives"; MONO_GAC_PREFIX = "${config.xdg.cacheHome}/mono"; - npm_config_cache = "${config.xdg.cacheHome}/npm"; PARALLEL_HOME = "${config.xdg.cacheHome}/parallel"; TERMINFO = "${config.xdg.configHome}/terminfo"; WINEPREFIX = "${config.xdg.stateHome}/wineprefix/default"; - YARN_CACHE_FOLDER = "${config.xdg.cacheHome}/yarn"; }; junkhome = [ "adb" @@ -25,7 +23,6 @@ "wpa_cli" # TODO Maybe we can do something about node-gyp ]; - shellAliases = lib.attrsets.mergeAttrsList (map (p: { "${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}"; }) config.frogeye.junkhome); }; home = { activation.createDirenvFolders = lib.hm.dag.entryAfter [ "writeBoundary" ] @@ -35,6 +32,7 @@ sessionVariables = config.frogeye.direnv; }; + programs.bash.shellAliases = lib.attrsets.mergeAttrsList (map (p: { "${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}"; }) config.frogeye.junkhome); }; options.frogeye = { direnv = lib.mkOption { diff --git a/hm/monitoring/default.nix b/hm/monitoring/default.nix new file mode 100644 index 0000000..832e6c0 --- /dev/null +++ b/hm/monitoring/default.nix @@ -0,0 +1,35 @@ +{ pkgs, lib, config, ... }: +{ + config = { + home.packages = with pkgs; [ + htop + iftop + iotop + lsof + progress + pv + speedtest-cli + strace + ]; + programs.bash.shellAliases = { + iftop = "iftop -c ${config.xdg.configHome}/iftoprc"; + tracefiles = ''${pkgs.strace}/bin/strace -f -t -e trace=file''; + }; + xdg = { + configFile = { + "iftoprc" = { + text = '' + port-resolution: no + promiscuous: no + port-display: on + link-local: yes + use-bytes: yes + show-totals: yes + log-scale: yes + ''; + }; + }; + }; + }; + +} diff --git a/hm/nix/default.nix b/hm/nix/default.nix new file mode 100644 index 0000000..e0f8929 --- /dev/null +++ b/hm/nix/default.nix @@ -0,0 +1,24 @@ +{ pkgs, lib, config, ... }: +{ + config = { + home.packages = with pkgs; [ + nix-diff + nix-tree + nix-output-monitor + ]; + programs.nix-index = { + # For non-NixOS systems + enable = false; # TODO Index is impossible to generate, should use https://github.com/nix-community/nix-index-database + # but got no luck without flakes + enableZshIntegration = true; + }; + nix = { + package = lib.mkDefault pkgs.nixFlakes; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + warn-dirty = false; + }; + }; + nixpkgs.config.allowUnfree = true; + }; +} diff --git a/hm/pager/default.nix b/hm/pager/default.nix new file mode 100644 index 0000000..94017c0 --- /dev/null +++ b/hm/pager/default.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, config, ... }: +{ + config = { + home = { + sessionVariables = { + PAGER = "less"; + LESSHISTFILE = "${config.xdg.stateHome}/lesshst"; + LESS = "-R"; + LESS_TERMCAP_mb = "$(echo $'\\E[1;31m')"; # begin blink + LESS_TERMCAP_md = "$(echo $'\\E[1;36m')"; # begin bold + LESS_TERMCAP_me = "$(echo $'\\E[0m')"; # reset bold/blink + LESS_TERMCAP_se = "$(echo $'\\E[0m')"; # reset reverse video + LESS_TERMCAP_so = "$(echo $'\\E[01;44;33m')"; # begin reverse video + LESS_TERMCAP_ue = "$(echo $'\\E[0m')"; # reset underline + LESS_TERMCAP_us = "$(echo $'\\E[1;32m')"; # begin underline + }; + }; + }; +} diff --git a/hm/prompt/default.nix b/hm/prompt/default.nix new file mode 100644 index 0000000..9ed72ef --- /dev/null +++ b/hm/prompt/default.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, config, ... }: +{ + config = lib.mkIf config.programs.less.enable { + programs.powerline-go = { + enable = true; + modules = [ "user" "host" "venv" "cwd" "perms" "git" ]; + modulesRight = [ "jobs" "exit" "duration" "load" ]; + settings = { + colorize-hostname = true; + max-width = 25; + cwd-max-dir-size = 10; + duration = "$( test -n \"$__TIMER\" && echo $(( $EPOCHREALTIME - $\{__TIMER:-EPOCHREALTIME})) || echo 0 )"; + # UPST Implement this properly in home-manager, would allow for bash support + }; + extraUpdatePS1 = '' + unset __TIMER + echo -en "\033]0; $USER@$HOST $PWD\007" + ''; + }; + }; +} diff --git a/hm/shell/default.nix b/hm/shell/default.nix new file mode 100644 index 0000000..1dcc90e --- /dev/null +++ b/hm/shell/default.nix @@ -0,0 +1,38 @@ +{ pkgs, lib, config, ... }: +let + cfg = config.programs.bash; +in +{ + config = { + programs = { + bash = { + enable = true; + bashrcExtra = '' + shopt -s expand_aliases + shopt -s histappend + ''; + historySize = 100000; + historyFile = "${config.xdg.stateHome}/shell_history"; + historyFileSize = 100000; + # TODO Check out Atuin + historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; + }; + zsh = { + enable = true; + enableAutosuggestions = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + historySubstringSearch.enable = true; + initExtra = builtins.readFile ./zshrc.sh; + defaultKeymap = "viins"; + history = { + size = cfg.historySize; + save = cfg.historyFileSize; + path = cfg.historyFile; + expireDuplicatesFirst = true; + }; + shellAliases = cfg.shellAliases; + }; + }; + }; +} diff --git a/hm/zshrc.sh b/hm/shell/zshrc.sh similarity index 100% rename from hm/zshrc.sh rename to hm/shell/zshrc.sh diff --git a/hm/vim/default.nix b/hm/vim/default.nix index 1a5fac5..0836392 100644 --- a/hm/vim/default.nix +++ b/hm/vim/default.nix @@ -27,6 +27,15 @@ in { # config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion? config = { + home.sessionVariables = { + EDITOR = "nvim"; + } // lib.optionalAttrs config.frogeye.desktop.xorg { + VISUAL = "nvim"; + }; + programs.bash.shellAliases = { + vi = "nvim"; + vim = "nvim"; + }; programs.nixvim = { # Setting a custom base16 theme via nixvim is required so feline works, and # because stylix makes a config that otherwise only works with dark diff --git a/options.nix b/options.nix index a60985d..222912a 100644 --- a/options.nix +++ b/options.nix @@ -36,25 +36,12 @@ c = lib.mkEnableOption "C/C++ dev stuff"; docker = lib.mkEnableOption "Docker dev stuff"; fpga = lib.mkEnableOption "FPGA dev stuff"; - go = lib.mkEnableOption "Python dev stuff"; + go = lib.mkEnableOption "Go dev stuff"; + node = lib.mkEnableOption "NodeJS dev stuff"; perl = lib.mkEnableOption "Perl dev stuff"; php = lib.mkEnableOption "PHP dev stuff"; python = lib.mkEnableOption "Python dev stuff"; }; - shellAliases = lib.mkOption { # TODO Just use bash option and copy it for zsh - default = { }; - example = lib.literalExpression '' - { - ll = "ls -l"; - ".." = "cd .."; - } - ''; - description = '' - An attribute set that maps aliases (the top level attribute names in - this option) to command strings or directly to build outputs. - ''; - type = lib.types.attrsOf lib.types.str; - }; }; config = {