From edf7cc355cb1f55a9301283ebec15e01dc4ffe62 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 19 Nov 2023 21:58:34 +0300 Subject: 2023-11-19 --- modules/common/common/shell/default.nix | 13 +++++- modules/common/curl.nix | 2 +- modules/common/emacs/default.nix | 58 ++++++++++----------------- modules/common/git.nix | 4 +- modules/common/nmap.nix | 7 ++-- modules/common/profiles/dev/containers.nix | 2 +- modules/common/profiles/dev/default.nix | 4 +- modules/common/profiles/dev/sql.nix | 2 +- modules/common/profiles/email.nix | 8 ++-- modules/common/profiles/headful.nix | 2 +- modules/common/qutebrowser.nix | 13 ++++-- modules/common/subversion.nix | 4 +- modules/common/vim/default.nix | 2 +- modules/common/vscode.nix | 63 +++++++++++++++++------------- modules/darwin/default.nix | 1 - modules/darwin/emacs.nix | 15 ------- modules/nixos/common/documentation.nix | 2 +- modules/nixos/dwm.nix | 5 ++- modules/nixos/emacs.nix | 8 +--- modules/nixos/matrix/dendrite.nix | 4 +- modules/nixos/mpd.nix | 2 +- modules/nixos/podman.nix | 4 +- modules/nixos/profiles/dev/default.nix | 13 +++++- modules/nixos/psd.nix | 10 +++-- modules/nixos/rtorrent.nix | 7 ++-- modules/nixos/shadowsocks.nix | 2 +- modules/nixos/soju.nix | 2 +- modules/nixos/solaar.nix | 5 ++- modules/nixos/unbound.nix | 3 +- modules/nixos/xmonad.nix | 2 +- 30 files changed, 136 insertions(+), 133 deletions(-) delete mode 100644 modules/darwin/emacs.nix (limited to 'modules') 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; diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index 6ea9663..fbc5c1e 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -1,7 +1,6 @@ _: { imports = [ ./common - ./emacs.nix ./fonts.nix ./gnupg.nix ./homebrew.nix diff --git a/modules/darwin/emacs.nix b/modules/darwin/emacs.nix deleted file mode 100644 index fd32276..0000000 --- a/modules/darwin/emacs.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.nixfiles.modules.emacs; -in { - config = mkIf cfg.enable { - services.emacs = { - enable = false; # TODO Figure out how to use this. - inherit (config.hm.programs.doom-emacs) package; - }; - }; -} diff --git a/modules/nixos/common/documentation.nix b/modules/nixos/common/documentation.nix index f909108..cb66818 100644 --- a/modules/nixos/common/documentation.nix +++ b/modules/nixos/common/documentation.nix @@ -25,7 +25,7 @@ with lib; { environment.sessionVariables = { MANOPT = "--no-hyphenation"; - MANPAGER = "${pkgs.less}/bin/less -+F"; + MANPAGER = "${getExe pkgs.less} -+F"; }; }; } diff --git a/modules/nixos/dwm.nix b/modules/nixos/dwm.nix index 618d8ed..459aae5 100644 --- a/modules/nixos/dwm.nix +++ b/modules/nixos/dwm.nix @@ -89,7 +89,7 @@ in { NULL, }; static const char *termcmd[] = { - "${pkgs.alacritty}/bin/alacritty", + "${getExe pkgs.alacritty}", NULL, }; @@ -143,7 +143,8 @@ in { }; ''; }; - in "${pkg}/bin/dwm"; + in + getExe' pkg "dwm"; }; hm.services.dwm-status = { diff --git a/modules/nixos/emacs.nix b/modules/nixos/emacs.nix index 8163c45..c851389 100644 --- a/modules/nixos/emacs.nix +++ b/modules/nixos/emacs.nix @@ -8,7 +8,7 @@ with lib; let in { config = mkIf cfg.enable { nixfiles.modules = { - common.xdg.defaultApplications.emacsclient = [ + common.xdg.defaultApplications.emacs = [ "application/atom+xml" "application/json" "application/rss+xml" @@ -21,11 +21,5 @@ in { x11.enable = true; }; - - hm.services.emacs = { - enable = true; - client.enable = true; - socketActivation.enable = true; - }; }; } diff --git a/modules/nixos/matrix/dendrite.nix b/modules/nixos/matrix/dendrite.nix index efeef3c..7528792 100644 --- a/modules/nixos/matrix/dendrite.nix +++ b/modules/nixos/matrix/dendrite.nix @@ -178,12 +178,12 @@ in { }; in concatStringsSep " " [ - "${pkgs.envsubst}/bin/envsubst" + (getExe pkgs.envsubst) "-i ${(pkgs.formats.yaml {}).generate "dendrite.yaml" settings}" "-o /run/dendrite/dendrite.yaml" ]; ExecStart = concatStringsSep " " [ - "${pkgs.dendrite}/bin/dendrite" + (getExe' pkgs.dendrite "dendrite") "--config /run/dendrite/dendrite.yaml" "--http-bind-address 127.0.0.1:${toString cfg.port}" ]; diff --git a/modules/nixos/mpd.nix b/modules/nixos/mpd.nix index 6db83f8..485cde3 100644 --- a/modules/nixos/mpd.nix +++ b/modules/nixos/mpd.nix @@ -138,7 +138,7 @@ in { mouse_support = false; - external_editor = "${config.programs.vim.package}/bin/vim"; + external_editor = getExe' config.programs.vim.package "vim"; use_console_editor = true; colors_enabled = true; diff --git a/modules/nixos/podman.nix b/modules/nixos/podman.nix index ec9b346..0f6db48 100644 --- a/modules/nixos/podman.nix +++ b/modules/nixos/podman.nix @@ -49,14 +49,14 @@ in { driver = "overlay" [storage.options] - mount_program = "${pkgs.fuse-overlayfs}/bin/fuse-overlayfs" + mount_program = "${getExe' pkgs.fuse-overlayfs "fuse-overlayfs"}" mountopt = "noatime,nodev,nosuid" ''; }; programs.bash = { shellAliases = { - podman = "grc -es ${pkgs.podman}/bin/podman"; + podman = "grc -es ${getExe' pkgs.podman "podman"}"; p = "podman"; }; initExtra = mkAfter '' diff --git a/modules/nixos/profiles/dev/default.nix b/modules/nixos/profiles/dev/default.nix index bba8ebd..5253e95 100644 --- a/modules/nixos/profiles/dev/default.nix +++ b/modules/nixos/profiles/dev/default.nix @@ -1,10 +1,11 @@ { config, lib, + pkgs, ... }: with lib; let - cfg = config.nixfiles.modules.profiles.dev.default; + cfg = config.nixfiles.modules.profiles.dev; in { imports = [ ./containers.nix @@ -16,6 +17,14 @@ in { messages = "C"; }; - my.extraGroups = ["kvm"]; + programs.wireshark = { + enable = true; + package = pkgs.wireshark; + }; + + my.extraGroups = [ + "kvm" + "wireshark" + ]; }; } diff --git a/modules/nixos/psd.nix b/modules/nixos/psd.nix index 77d3c66..eb5a1a8 100644 --- a/modules/nixos/psd.nix +++ b/modules/nixos/psd.nix @@ -20,7 +20,9 @@ in { }; systemd.user = { - services = { + services = let + exe = getExe' pkgs.profile-sync-daemon "profile-sync-daemon"; + in { psd = { unitConfig = { Description = "Profile-sync-daemon"; @@ -30,8 +32,8 @@ in { }; serviceConfig = { RemainAfterExit = true; - ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon startup"; - ExecStop = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon unsync"; + ExecStart = "${exe} startup"; + ExecStop = "${exe} unsync"; }; wantedBy = ["graphical.target"]; }; @@ -43,7 +45,7 @@ in { Wants = ["psd-resync.timer"]; BindsTo = ["psd.service"]; }; - serviceConfig.ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon resync"; + serviceConfig.ExecStart = "${exe} resync"; wantedBy = ["graphical.target"]; }; }; diff --git a/modules/nixos/rtorrent.nix b/modules/nixos/rtorrent.nix index 5d2dba5..847f12d 100644 --- a/modules/nixos/rtorrent.nix +++ b/modules/nixos/rtorrent.nix @@ -63,7 +63,8 @@ in { mv -fv "$leech_path" "$seed_path" ''; }; - in "${pkg}/bin/move-completed"; + in + getExe pkg; in pkgs.writeText "rtorrent.rc" '' method.insert = cfg.leech, private|const|string, (cat, "${leechDir}") @@ -143,7 +144,7 @@ in { logDir ]; ExecStart = concatStringsSep " " [ - "${pkgs.rtorrent}/bin/rtorrent" + (getExe pkgs.rtorrent) "-n" "-o system.daemon.set=true" "-o network.bind_address.set=0.0.0.0" @@ -245,7 +246,7 @@ in { Group = group; ExecStart = concatStringsSep " " [ - "${pkg}/bin/flood" + (getExe pkg) "--allowedpath=${baseDir}" "--baseuri=/" "--rundir=${baseDir}/flood" diff --git a/modules/nixos/shadowsocks.nix b/modules/nixos/shadowsocks.nix index c04799b..97eb17f 100644 --- a/modules/nixos/shadowsocks.nix +++ b/modules/nixos/shadowsocks.nix @@ -79,7 +79,7 @@ in { }); in pkgs.writeShellScript "meregeJson" '' - ${pkgs.jq}/bin/jq \ + ${getExe pkgs.jq} \ -s '.[0] * .[1]' \ ${configFile} \ $CREDENTIALS_DIRECTORY/secret.json \ diff --git a/modules/nixos/soju.nix b/modules/nixos/soju.nix index 3cfe015..569e218 100644 --- a/modules/nixos/soju.nix +++ b/modules/nixos/soju.nix @@ -96,7 +96,7 @@ in { ''; in concatStringsSep " " [ - "${pkgs.soju}/bin/soju" + (getExe' pkgs.soju "soju") "-config ${configFile}" ]; DynamicUser = true; diff --git a/modules/nixos/solaar.nix b/modules/nixos/solaar.nix index ceff23d..64aafc8 100644 --- a/modules/nixos/solaar.nix +++ b/modules/nixos/solaar.nix @@ -38,8 +38,9 @@ in { done ''; }; - in "${pkg}/bin/solaar-pre"; - ExecStart = "${pkgs.solaar}/bin/solaar --window=hide"; + in + getExe pkg; + ExecStart = "${getExe pkgs.solaar "solaar"} --window=hide"; }; Install.WantedBy = ["graphical-session.target"]; }; diff --git a/modules/nixos/unbound.nix b/modules/nixos/unbound.nix index dd7e757..2fab1e0 100644 --- a/modules/nixos/unbound.nix +++ b/modules/nixos/unbound.nix @@ -184,7 +184,8 @@ in { fi ''; }; - in "${pkg}/bin/unbound-adblock-update"; + in + getExe pkg; }; }; }; diff --git a/modules/nixos/xmonad.nix b/modules/nixos/xmonad.nix index c5fedc2..b4eb4a0 100644 --- a/modules/nixos/xmonad.nix +++ b/modules/nixos/xmonad.nix @@ -18,7 +18,7 @@ in { scriptPath = ".xinitrc"; - windowManager.command = "${pkgs.xmonad-ng}/bin/xmonad-ng"; + windowManager.command = getExe' pkgs.xmonad-ng "xmonad-ng"; }; }; -- cgit v1.2.3