diff options
Diffstat (limited to '')
-rw-r--r-- | modules/common/common/shell/default.nix | 13 | ||||
-rw-r--r-- | modules/common/curl.nix | 2 | ||||
-rw-r--r-- | modules/common/emacs/default.nix | 58 | ||||
-rw-r--r-- | modules/common/git.nix | 4 | ||||
-rw-r--r-- | modules/common/nmap.nix | 7 | ||||
-rw-r--r-- | modules/common/profiles/dev/containers.nix | 2 | ||||
-rw-r--r-- | modules/common/profiles/dev/default.nix | 4 | ||||
-rw-r--r-- | modules/common/profiles/dev/sql.nix | 2 | ||||
-rw-r--r-- | modules/common/profiles/email.nix | 8 | ||||
-rw-r--r-- | modules/common/profiles/headful.nix | 2 | ||||
-rw-r--r-- | modules/common/qutebrowser.nix | 13 | ||||
-rw-r--r-- | modules/common/subversion.nix | 4 | ||||
-rw-r--r-- | modules/common/vim/default.nix | 2 | ||||
-rw-r--r-- | modules/common/vscode.nix | 63 |
14 files changed, 97 insertions, 87 deletions
diff --git a/modules/common/common/shell/default.nix b/modules/common/common/shell/default.nix index 01db7a5..b05b279 100644 --- a/modules/common/common/shell/default.nix +++ b/modules/common/common/shell/default.nix @@ -47,10 +47,21 @@ with lib; { ${readFile ./functions.bash} - # Colourise certain programs' outputs. + # https://github.com/garabik/grc?tab=readme-ov-file#bash GRC_ALIASES=true source ${pkgs.grc}/etc/profile.d/grc.sh + # https://github.com/akermu/emacs-libvterm?tab=readme-ov-file#shell-side-configuration + vterm_printf() { + if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ]); then + printf "\ePtmux;\e\e]%s\007\e\\" "$1" + elif [ "''${TERM%%-*}" = "screen" ]; then + printf "\eP\e]%s\007\e\\" "$1" + else + printf "\e]%s\e\\" "$1" + fi + } + # This makes sure we always source these tweaks for both interactive # and login sessions. if [ -z "$_PROFILE_SOURCED" ] && [ -f "$HOME/.profile" ]; then diff --git a/modules/common/curl.nix b/modules/common/curl.nix index 4149f80..97b4b55 100644 --- a/modules/common/curl.nix +++ b/modules/common/curl.nix @@ -29,7 +29,7 @@ in { form="$form-" fi - ${curl}/bin/curl --form "$form" "$url" + ${getExe curl} --form "$form" "$url" '') ]; }; diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix index b16fb83..fe2618d 100644 --- a/modules/common/emacs/default.nix +++ b/modules/common/emacs/default.nix @@ -22,6 +22,9 @@ in { fonts.enable = true; git.client.enable = true; gnupg.enable = true; + password-store.enable = true; + profiles.dev.enable = true; + profiles.email.enable = true; }; hm = { @@ -33,7 +36,7 @@ in { export DOOMDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/doom" if [[ ! -d "$EMACSDIR/.git" ]]; then - ${git.package}/bin/git clone --depth=1 --branch=master \ + ${getExe git.package} clone --depth=1 --branch=master \ "https://github.com/doomemacs/doomemacs" "$EMACSDIR" fi @@ -58,19 +61,24 @@ in { text = concatLines [ ( let + # NOTE Packages required for vterm here are mostly only used for + # initially compiling the libvterm library. extraBins = with pkgs; [ (aspellWithDicts (p: with p; [en ru])) # :checkers (spell +aspell) asmfmt # :editor format cargo # :lang rust clang-tools # :lang (cc +lsp) :editor format + cmake # :lang cc :term vterm cmake-format # :lang cc :editor format cmigemo # :lang japanese dockerfile-language-server-nodejs # :tools (docker +lsp) dockfmt # :tools docker :editor format editorconfig-core-c # :tools editorconfig fd # doom! + gcc # :lang cc :term vterm ghc # :lang haskell + gnumake # :term vterm gnuplot # :lang (org +gnuplot) gnutls # doom! go # :lang go @@ -89,6 +97,7 @@ in { haskellPackages.ormolu # :lang haskell :editor format html-tidy # :lang web :editor format jre # :lang plantuml + libtool # :term vterm libxml2 # :lang data :editor format nil # :lang (nix +lsp) nodePackages.bash-language-server # :lang (sh +lsp) @@ -98,6 +107,7 @@ in { nodePackages.stylelint # :lang web nodejs # :tools debugger pandoc # :lang org markdown latex + perl # :term vterm pinentry-emacs # doom! pipenv # :lang python pre-commit # :tools magit @@ -108,7 +118,7 @@ in { python3Packages.pyflakes # :lang python :editor format python3Packages.pytest # :lang python python3Packages.python-lsp-server # :lang python :editor format - racket # :lang racket :editor format + racket # :lang racket scheme :editor format ripgrep # doom! rust-analyzer # :lang (rust +lsp) rustc # :lang rust @@ -135,8 +145,8 @@ in { else [lldb] # :tools debugger ); in '' - ;; This will integrate packages which are required by various - ;; modules without polluting the user's profile. + ;; Integrate packages which are required by various modules + ;; without polluting the user's profile. (setq exec-path (append exec-path '(${ concatMapStringsSep " " (x: ''"${x}/bin"'') extraBins }))) @@ -146,6 +156,8 @@ in { (appendq! auth-sources '(("${config.secrets.authinfo.path}"))) + (setq emacsql-sqlite-executable "${getExe pkgs.emacsql-sqlite}") + ;; The font must be set to n+2, otherwise it looks too small. (setq doom-font (font-spec :family "${config.fontScheme.monospaceFont.family}" @@ -159,7 +171,7 @@ in { ;; :lang plantuml (setq plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar" - plantuml-executable-path "${pkgs.plantuml}/bin/plantuml" + plantuml-executable-path "${getExe' pkgs.plantuml "plantuml"}" org-plantuml-jar-path plantuml-jar-path org-plantuml-executable-path plantuml-executable-path) @@ -170,8 +182,9 @@ in { (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L") ;; :lang nix + ;; HACK Trick `nix-mode' to use alejandra instead of nixfmt. (setq nix-nixfmt-bin "${pkgs.writeShellScript "nixfmt" '' - ${pkgs.alejandra}/bin/alejandra --quiet "$@" + ${getExe pkgs.alejandra} "$@" ''}") '' ) @@ -197,8 +210,7 @@ in { '') muAccounts; in '' - ;; A stupid hack. This needs to be fixed upstream in either Doom - ;; or Nixpkgs. + ;; HACK Load missing site-lisp for `mu4e'. (add-to-list 'load-path "${pkgs.mu.mu4e}/share/emacs/site-lisp/mu4e") (setq mu4e-root-maildir "${maildirBasePath}") @@ -216,7 +228,7 @@ in { (pkgs.emacs29.override (finalAttrs: { stdenv = with pkgs; useMoldLinker - (withCFlags ["-O2"] + (withCFlags ["-O3"] (impureUseNativeOptimizations finalAttrs.stdenv)); })) .overrideAttrs (_: final: { @@ -227,34 +239,6 @@ in { "--without-pop" ]; }); - # TODO https://github.com/NixOS/nixpkgs/issues/267548 - # packageX = let - # emacs = "emacs29"; # Pin the version to avoid surprises. - # in - # (pkgs.${emacs}.pkgs.overrideScope - # (_: super: { - # emacs = - # (pkgs.${emacs}.override (finalAttrs: { - # stdenv = with pkgs; - # useMoldLinker - # (withCFlags ["-O2"] - # (impureUseNativeOptimizations finalAttrs.stdenv)); - # })) - # .overrideAttrs (_: final: { - # configureFlags = - # final.configureFlags - # ++ [ - # "--without-mailutils" - # "--without-pop" - # ]; - # }); - # })) - # .withPackages (p: - # with p; [ - # emacsql # :tools magit - # mu4e # :email mu4e - # vterm # :term vterm - # ]); }; }; }; diff --git a/modules/common/git.nix b/modules/common/git.nix index 4ed7c03..aa157ed 100644 --- a/modules/common/git.nix +++ b/modules/common/git.nix @@ -106,8 +106,8 @@ in { }; aliases = let - git = "${config.hm.programs.git.package}/bin/git"; - curl = "${pkgs.curl}/bin/curl"; + git = getExe config.hm.programs.git.package; + curl = getExe pkgs.curl; in { amend = "commit --amend"; cat = "cat-file -p"; diff --git a/modules/common/nmap.nix b/modules/common/nmap.nix index c13a9bc..ba06af3 100644 --- a/modules/common/nmap.nix +++ b/modules/common/nmap.nix @@ -21,7 +21,7 @@ in { packages = with pkgs; [nmap nmap-formatter]; activation.regenerateNmapScripts = with pkgs; '' - ${nmap}/bin/nmap --script-updatedb + ${getExe' nmap "nmap"} --script-updatedb ''; }; @@ -56,13 +56,14 @@ in { "xforce" ) for i in "''${vulscandbs[@]}"; do - ${curl}/bin/curl \ + ${getExe curl} \ -o "${config.my.home}/.nmap/scripts/vulscan/$i.csv" \ "https://www.computec.ch/projekte/vulscan/download/$i.csv" done ''; }; - in "${pkg}/bin/update-nmap-vulscan-lists"; + in + getExe pkg; }; }; diff --git a/modules/common/profiles/dev/containers.nix b/modules/common/profiles/dev/containers.nix index 38852ad..6e9346a 100644 --- a/modules/common/profiles/dev/containers.nix +++ b/modules/common/profiles/dev/containers.nix @@ -10,7 +10,7 @@ in { options.nixfiles.modules.profiles.dev.containers.enable = mkEnableOption "Tools for working with containers and container orchestration" // { - default = config.nixfiles.modules.profiles.dev.default.enable; + default = config.nixfiles.modules.profiles.dev.enable; }; config = mkIf cfg.enable { diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix index 4c52961..2d0c0f6 100644 --- a/modules/common/profiles/dev/default.nix +++ b/modules/common/profiles/dev/default.nix @@ -5,14 +5,14 @@ ... }: with lib; let - cfg = config.nixfiles.modules.profiles.dev.default; + cfg = config.nixfiles.modules.profiles.dev; in { imports = [ ./containers.nix ./sql.nix ]; - options.nixfiles.modules.profiles.dev.default.enable = + options.nixfiles.modules.profiles.dev.enable = mkEnableOption "Catch-all profile for stuff related to software development and etc."; config = mkIf cfg.enable { diff --git a/modules/common/profiles/dev/sql.nix b/modules/common/profiles/dev/sql.nix index 6a32a76..b290c16 100644 --- a/modules/common/profiles/dev/sql.nix +++ b/modules/common/profiles/dev/sql.nix @@ -10,7 +10,7 @@ in { options.nixfiles.modules.profiles.dev.sql.enable = mkEnableOption "SQL stuff and database management tools" // { - default = config.nixfiles.modules.profiles.dev.default.enable; + default = config.nixfiles.modules.profiles.dev.enable; }; config = mkIf cfg.enable { diff --git a/modules/common/profiles/email.nix b/modules/common/profiles/email.nix index 19eaee5..3c809af 100644 --- a/modules/common/profiles/email.nix +++ b/modules/common/profiles/email.nix @@ -6,9 +6,9 @@ ... }: with lib; let - cfg = config.nixfiles.modules.profiles.email.default; + cfg = config.nixfiles.modules.profiles.email; in { - options.nixfiles.modules.profiles.email.default.enable = + options.nixfiles.modules.profiles.email.enable = mkEnableOption "Local Email management" // {default = this.isHeadful;}; config = mkIf cfg.enable { @@ -46,13 +46,13 @@ in { assert (builtins.isInt line); concatStringsSep " " ( [ - "${config.hm.programs.password-store.package}/bin/pass" + (getExe config.hm.programs.password-store.package) "show" path ] ++ optionals (line > 0) [ "|" - "${pkgs.gnused}/bin/sed" + (getExe pkgs.gnused) "-e" "'${toString line}!d'" ] diff --git a/modules/common/profiles/headful.nix b/modules/common/profiles/headful.nix index f85e793..094d5dd 100644 --- a/modules/common/profiles/headful.nix +++ b/modules/common/profiles/headful.nix @@ -13,7 +13,7 @@ in { config = mkIf cfg.enable { nixfiles.modules = { - profiles.dev.default.enable = true; + profiles.dev.enable = true; alacritty.enable = true; aria2.enable = true; diff --git a/modules/common/qutebrowser.nix b/modules/common/qutebrowser.nix index e59917b..9f234a4 100644 --- a/modules/common/qutebrowser.nix +++ b/modules/common/qutebrowser.nix @@ -10,12 +10,17 @@ in { options.nixfiles.modules.qutebrowser.enable = mkEnableOption "Qutebrowser"; config = mkIf cfg.enable { + nixfiles.modules = { + mpv.enable = true; + vim.enable = true; + }; + hm.programs.qutebrowser = with config.nixfiles.modules; { enable = true; keyBindings.normal = mkIf mpv.enable { "z" = let - mpv = "${config.hm.programs.mpv.package}/bin/mpv"; + mpv = getExe config.hm.programs.mpv.package; in "hint links spawn --detach ${mpv} {hint-url}"; }; @@ -160,11 +165,11 @@ in { editor.command = [ ( if alacritty.enable - then "${pkgs.alacritty}/bin/alacritty" - else "${pkgs.xterm}/bin/xterm" + then getExe pkgs.alacritty + else getExe pkgs.xterm ) "-e" - "${config.programs.vim.package}/bin/vim" + (getExe' config.programs.vim.package "vim") "-f" "{}" ]; diff --git a/modules/common/subversion.nix b/modules/common/subversion.nix index 40ea07d..2bd5e42 100644 --- a/modules/common/subversion.nix +++ b/modules/common/subversion.nix @@ -22,8 +22,8 @@ in { store-auth-creds = "yes"; }; helpers = { - editor-cmd = "${config.programs.vim.package}/bin/vim"; - diff-cmd = "${pkgs.colordiff}/bin/colordiff"; + editor-cmd = getExe config.programs.vim.package; + diff-cmd = getExe pkgs.colordiff; }; miscellany = { global-ignores = with config.hm.programs.git; diff --git a/modules/common/vim/default.nix b/modules/common/vim/default.nix index 3755201..cd24768 100644 --- a/modules/common/vim/default.nix +++ b/modules/common/vim/default.nix @@ -35,7 +35,7 @@ in { environment = with config.programs.vim; { systemPackages = [package]; variables = rec { - EDITOR = mkOverride 100 "${package}/bin/vim"; + EDITOR = mkOverride 15 (getExe' package "vim"); VISUAL = EDITOR; }; }; diff --git a/modules/common/vscode.nix b/modules/common/vscode.nix index 3ae9800..62abcf8 100644 --- a/modules/common/vscode.nix +++ b/modules/common/vscode.nix @@ -41,6 +41,8 @@ in { gitlab.gitlab-workflow golang.go graphql.vscode-graphql + graphql.vscode-graphql-execution + graphql.vscode-graphql-syntax hashicorp.hcl hashicorp.terraform haskell.haskell @@ -54,11 +56,13 @@ in { redhat.vscode-xml redhat.vscode-yaml rust-lang.rust + skellock.just streetsidesoftware.code-spell-checker streetsidesoftware.code-spell-checker-british-english streetsidesoftware.code-spell-checker-russian streetsidesoftware.code-spell-checker-scientific-terms tamasfe.even-better-toml + task.vscode-task vscode-org-mode.org-mode ziglang.vscode-zig ] @@ -99,7 +103,7 @@ in { }; workbench = { - activityBar.visible = false; + activityBar.location = "hidden"; editor.highlightModifiedTabs = true; enableExperiments = false; settings.enableNaturalLanguageSearch = false; @@ -149,71 +153,76 @@ in { useFullyQualifiedCollectionNames = true; reuseTerminal = true; }; - validation.lint.path = "${pkgs.ansible-lint}/bin/ansible-lint"; + validation.lint.path = getExe' pkgs.ansible-lint "ansible-lint"; }; - bashIde.shellcheckPath = "${pkgs.shellcheck}/bin/shellcheck"; + bashIde.shellcheckPath = getExe' pkgs.shellcheck "shellcheck"; - cSpell.language = "en-GB,ru"; + cSpell.language = "en-GB,en,ru"; + + direnv = { + restart.automatic = true; + }; magit = { forge-enabled = true; - git-path = "${config.hm.programs.git.package}/bin/git"; + git-path = getExe config.hm.programs.git.package; }; + git.openRepositoryInParentFolders = "always"; + github = { branchProtection = true; gitProtocol = "ssh"; }; terraform = { - languageServer.path = "${pkgs.terraform-ls}/bin/terraform-ls"; - languageServer.terraform.path = "${pkgs.opentofu}/bin/tofu"; + languageServer.path = getExe' pkgs.terraform-ls "terraform-ls"; + languageServer.terraform.path = getExe pkgs.opentofu; }; haskell = { formattingProvider = "ormolu"; - serverExecutablePath = "${pkgs.haskell-language-server}/bin/haskell-language-server"; + serverExecutablePath = getExe' pkgs.haskell-language-server "haskell-language-server"; }; nix = { enableLanguageServer = true; - serverPath = "${pkgs.nil}/bin/nil"; + serverPath = getExe pkgs.nil; }; python = with pkgs.python311Packages; { experiments.optOutFrom = ["All"]; - pipenvPath = "${pkgs.pipenv}/bin/pipenv"; - poetryPath = "${pkgs.poetry}/bin/poetry"; + pipenvPath = getExe' pkgs.pipenv "pipenv"; + poetryPath = getExe' pkgs.poetry "poetry"; formatting = { provider = "black"; - autopep8Path = "${autopep8}/bin/autopep8"; - blackPath = "${black}/bin/black"; - yapfPath = "${yapf}/bin/yapf"; + autopep8Path = getExe' autopep8 "autopep8"; + blackPath = getExe' black "black"; + yapfPath = getExe' yapf "yapf"; }; linting = { enabled = true; - banditPath = "${bandit}/bin/bandit"; - flake8Path = "${flake8}/bin/flake8"; - mypyPath = "${mypy}/bin/mypy"; - pycodestylePath = "${pycodestyle}/bin/pycodestyle"; - pydocstylePath = "${pydocstyle}/bin/pydocstyle"; - pylamaPath = "${pylama}/bin/pylama"; - pylintPath = "${pylint}/bin/pylint"; + banditPath = getExe' bandit "bandit"; + flake8Path = getExe' flake8 "flake8"; + mypyPath = getExe' mypy "mypy"; + pycodestylePath = getExe' pycodestyle "pycodestyle"; + pydocstylePath = getExe' pydocstyle "pydocstyle"; + pylamaPath = getExe' pylama "pylama"; + pylintPath = getExe' pylint "pylint"; }; testing = { - pytestPath = "${pytest}/bin/pytest"; + pytestPath = getExe' pytest "pytest"; }; }; rust-client = { disableRustup = true; - rustupPath = "${pkgs.rustup}/bin/rustup"; - rlsPath = "${pkgs.rustup}/bin/rls"; - rustfmt_path = "${pkgs.rustfmt}/bin/rustfmt"; + rustupPath = getExe' pkgs.rustup "rustup"; + rustfmt_path = getExe pkgs.rustfmt; }; - vim = mkIf cfg.vim.enable rec { + vim = mkIf cfg.vim.enable { easymotion = true; easymotionMarkerFontFamily = fontFamily; easymotionMarkerFontSize = fontSize; @@ -225,7 +234,7 @@ in { zig.zls = { checkForUpdate = false; - path = "${pkgs.zls}/bin/zls"; + path = getExe' pkgs.zls "zls"; }; redhat.telemetry.enabled = false; |