diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-11-19 21:58:34 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-11-19 21:58:34 +0300 |
commit | edf7cc355cb1f55a9301283ebec15e01dc4ffe62 (patch) | |
tree | bf7745040efadac618168b7a9a764acb482acb07 | |
parent | 2023-11-16 (diff) |
2023-11-19
39 files changed, 214 insertions, 215 deletions
diff --git a/flake.lock b/flake.lock index 6edfe51..578e1fd 100644 --- a/flake.lock +++ b/flake.lock @@ -266,11 +266,11 @@ ] }, "locked": { - "lastModified": 1699783872, - "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", + "lastModified": 1700118404, + "narHash": "sha256-XkqpZpVoy1FV7UbiLkP+fQxxv/6KnwLYkFEHgE8z2IQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "280721186ab75a76537713ec310306f0eba3e407", + "rev": "c1a033122df8a3c74fda3780c83a104a7d60873c", "type": "github" }, "original": { @@ -309,11 +309,11 @@ ] }, "locked": { - "lastModified": 1699924656, - "narHash": "sha256-w1L/6pxu2wWSQD/mB8JNUi/BOwDwmg5C30k7bFK1kt0=", + "lastModified": 1700183996, + "narHash": "sha256-Xsl9ycyzeEDMeGKw3hfNhPX/yffpGJ1VQNqpChU6qh4=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "218d8a6c07f0cb9fa26cc66f369bbf62ca3a6872", + "rev": "dd3ca2f4efdde2940f3f15c61bf4f1c09c3d73d5", "type": "github" }, "original": { @@ -336,11 +336,11 @@ ] }, "locked": { - "lastModified": 1700011274, - "narHash": "sha256-NtZqLNEjgaCGowT2+HEeOoZsXqVSAZMA/vk2t0jikN0=", + "lastModified": 1700183987, + "narHash": "sha256-lea3Wog1Lmwj8HQT9znmB3LrYErJkTMJm79AcXRdc4Q=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "a8c236477b4251ba739463de7e863a07b124fdd3", + "rev": "4fd6ede6a7f997bab3210856335d7d34fbb70011", "type": "github" }, "original": { @@ -368,11 +368,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700014976, - "narHash": "sha256-dSGpS2YeJrXW5aH9y7Abd235gGufY3RuZFth6vuyVtU=", + "lastModified": 1700108881, + "narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3", + "rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1", "type": "github" }, "original": { @@ -384,11 +384,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1700082562, - "narHash": "sha256-1sXJRzIECv/2xfxBNfwbDkE3nlm3KfS01BdCXXtXNxU=", + "lastModified": 1700232347, + "narHash": "sha256-QzG9ZKl29Pa+drx3Cbfwtpl1+9DvPL1X2cLPb3zLuy0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7a1d45811ea4420dea5b2818c9790a86c18c1170", + "rev": "139ccb05544a8460ec48bee1f9d84e17604d8a46", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1700065082, - "narHash": "sha256-BdnIOPd39IW/mfha60I+xjqbGs2w/45KiqWeZJHI0sg=", + "lastModified": 1700200546, + "narHash": "sha256-KK9uSx+qaoyF8VZDq4pED72AW4qTTwkL1lm0AN3ibFA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "48f92ae9de20777628d2a92d9d50fb4e2ab3d0f1", + "rev": "2af91613c61e71b278ee156099f9390447490e43", "type": "github" }, "original": { @@ -428,11 +428,11 @@ ] }, "locked": { - "lastModified": 1700000610, - "narHash": "sha256-xvP14ulDdfx1MeBzIWreID3F3j0G4leAAeTC5yfE1h0=", + "lastModified": 1700219833, + "narHash": "sha256-AkLpEg7nj0KUPb4pl7XIX1TbwePgC03hiBpMANlgBY0=", "owner": "nix-community", "repo": "nixvim", - "rev": "2fcbe50f4ba80e868bd55c7f3b40e2a55c8092d0", + "rev": "1b44fe37a1c05bd00d9c727c1756461b9f1a967b", "type": "github" }, "original": { @@ -478,11 +478,11 @@ }, "nur": { "locked": { - "lastModified": 1700072577, - "narHash": "sha256-7jriJotHLpP/3jNoPW9Xc0mDKx2lOzOcLnwUfdpa51Y=", + "lastModified": 1700232428, + "narHash": "sha256-2rik7MsvQGHc31RByhEzSEvdBCWqgsIOyB2VVKonKPg=", "owner": "nix-community", "repo": "NUR", - "rev": "49a6f64d2b6dcba38a8fb2312315c13e3fe488f1", + "rev": "2347935c4aa0262ff3c2854e628c412228070fad", "type": "github" }, "original": { @@ -601,11 +601,11 @@ ] }, "locked": { - "lastModified": 1695910380, - "narHash": "sha256-CyzeiXQGm8ceEOSK1dffBCfO7JNp8XhQeNkUiJ5HxgY=", + "lastModified": 1700085753, + "narHash": "sha256-qtib7f3eRwfaUF+VziJXiBcZFqpHCAXS4HlrFsnzzl4=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "84783b661ecf33927c534b6476beb74ea3308968", + "rev": "008d78cc21959e33d0d31f375b88353a7d7121ae", "type": "gitlab" }, "original": { 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"; }; }; diff --git a/nixosConfigurations/eonwe/default.nix b/nixosConfigurations/eonwe/default.nix index e6c6e5e..dcfbb0d 100644 --- a/nixosConfigurations/eonwe/default.nix +++ b/nixosConfigurations/eonwe/default.nix @@ -48,7 +48,6 @@ with lib; { vcmi vesktop vial - wireshark xonotic ]; diff --git a/nixosConfigurations/melian/default.nix b/nixosConfigurations/melian/default.nix index f4178e2..64dd152 100644 --- a/nixosConfigurations/melian/default.nix +++ b/nixosConfigurations/melian/default.nix @@ -1,4 +1,9 @@ -{pkgs, ...}: { +{ + lib, + pkgs, + ... +}: +with lib; { nixfiles.modules = { wireguard.client.enable = true; @@ -18,7 +23,7 @@ }; powerManagement = let - modprobe = "${pkgs.kmod}/bin/modprobe"; + modprobe = getExe' pkgs.kmod "modprobe"; in { enable = true; diff --git a/overlay.nix b/overlay.nix index b8e8807..5314ab2 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,9 +1,9 @@ final: prev: { bruh = prev.callPackage ./packages/bruh.nix {}; - hiccup = prev.callPackage ./packages/hiccup.nix {}; + emacsql-sqlite = prev.callPackage ./packages/emacsql-sqlite.nix {}; - mpv-autosub = prev.callPackage ./packages/mpv-autosub.nix {}; + hiccup = prev.callPackage ./packages/hiccup.nix {}; myip = prev.callPackage ./packages/myip.nix {}; diff --git a/packages/bruh.nix b/packages/bruh.nix index bad8aa0..b41ecdb 100644 --- a/packages/bruh.nix +++ b/packages/bruh.nix @@ -29,5 +29,6 @@ stdenv.mkDerivation (finalAttrs: { license = licenses.gpl3Only; platforms = platforms.linux; maintainers = with maintainers; [azahi]; + mainProgram = "bruh"; }; }) diff --git a/packages/emacsql-sqlite.nix b/packages/emacsql-sqlite.nix new file mode 100644 index 0000000..3329e08 --- /dev/null +++ b/packages/emacsql-sqlite.nix @@ -0,0 +1,35 @@ +{ + fetchFromGitHub, + lib, + stdenv, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "emacsql-sqlite"; + version = "3.1.1"; + + src = fetchFromGitHub { + owner = "magit"; + repo = "emacsql"; + rev = finalAttrs.version; + hash = "sha256-b/QEpWMTyVOdkOEhPNJ0x8ukUy9Gc9gYGjnlh0WU9fY="; + }; + + sourceRoot = "source/sqlite"; + + installPhase = '' + runHook preInstall + + install -Dm755 -t $out/bin ${finalAttrs.meta.mainProgram} + + runHook postInstall + ''; + + meta = with lib; { + description = "SQLite interop binary for emacsql-sqlite"; + inherit (finalAttrs.src.meta) homepage; + license = licenses.unlicense; + platforms = platforms.unix; + maintainers = with maintainers; [azahi]; + mainProgram = "emacsql-sqlite"; + }; +}) diff --git a/packages/mpv-autosub.nix b/packages/mpv-autosub.nix deleted file mode 100644 index e3fc221..0000000 --- a/packages/mpv-autosub.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - fetchFromGitHub, - lib, - mpv-unwrapped, - python3Packages, - stdenvNoCC, -}: -stdenvNoCC.mkDerivation (finalAttrs: { - pname = "mpv-autosub"; - version = "unstable-2021-06-29"; - - src = fetchFromGitHub { - owner = "davidde"; - repo = finalAttrs.pname; - rev = "35115355bd339681f97d067538356c29e5b14afa"; - hash = "sha256-BKT/Tzwl5ZA4fbdc/cxz0+CYc1zyY/KOXc58x5GYow0="; - }; - - postPatch = '' - substituteInPlace autosub.lua \ - --replace '/home/david/.local/bin/subliminal' '${python3Packages.subliminal}/bin/subliminal' \ - --replace "'Dutch', 'nl', 'dut'" "'Russian', 'ru', 'rus'" \ - --replace "'tta'" "'tta', 'webm'" \ - --replace "disabled for audio files" "disabled for this filetype" - - sed -iE '/.*add_key_binding.*/d' autosub.lua - ''; - - installPhase = '' - runHook preInstall - - install -Dm644 autosub.lua $out/share/mpv/scripts/autosub.lua - - runHook postInstall - ''; - - passthru.scriptName = "autosub.lua"; - - meta = with lib; { - description = "Automatic downloading of subtitles for MPV"; - inherit (finalAttrs.src.meta) homepage; - license = licenses.mit; - inherit (mpv-unwrapped.meta) platforms; - maintainers = with maintainers; [azahi]; - }; -}) diff --git a/packages/myip.nix b/packages/myip.nix index f91872b..59a02ee 100644 --- a/packages/myip.nix +++ b/packages/myip.nix @@ -19,5 +19,6 @@ writeShellApplication { license = licenses.wtfpl; platforms = platforms.unix; maintainers = with maintainers; [azahi]; + mainProgram = "myip"; }; } diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix index 782a193..02e89f2 100644 --- a/packages/nixfiles.nix +++ b/packages/nixfiles.nix @@ -25,7 +25,7 @@ # Shamelessly appropriated from https://github.com/ncfavier/config. # Hopefully Naïm will not sue me for copyright infrigment. text = '' - nixfiles="''${NIXFILES:-$HOME/src/nixfiles}" + nixfiles="''${NIXFILES:-.}" cmd=$1 shift case $cmd in @@ -108,10 +108,10 @@ # Assumes that hosts are configured in the OpenSSH configuration. host=''${cmd#@} hostname=$(ssh -q "$host" 'echo "$HOSTNAME"') - exec nixos-rebuild -v --flake ".#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@" + exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@" ;; *) - exec nixos-rebuild -v --fast --flake "." --use-remote-sudo --show-trace "$cmd" "$@" + exec nixos-rebuild -v --fast --flake "$nixfiles" --use-remote-sudo --show-trace "$cmd" "$@" ;; esac ''; @@ -134,7 +134,7 @@ } _nixfiles() { local cur prev words cword - local nixfiles="''${NIXFILES:-$HOME/src/nixfiles}" + local nixfiles="''${NIXFILES:-.}" _init_completion -n ':=&' if [[ "$cword" == 1 ]] || [[ "$cword" == 2 && "$prev" == @* ]]; then if [[ $cur == @* ]]; then @@ -180,5 +180,6 @@ in license = licenses.wtfpl; platforms = platforms.unix; maintainers = with maintainers; [azahi]; + mainProgram = "nixfiles"; }; } |