From def1e23be848848400d1d097d4f044e3c401f9dd Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 14 Apr 2024 23:02:32 +0200 Subject: treewide: remove lib.mdDoc --- modules/programs/bash/default.nix | 6 +++--- modules/programs/direnv.nix | 16 ++++++++-------- modules/programs/fish.nix | 22 +++++++++++----------- modules/programs/gnupg.nix | 4 ++-- modules/programs/info/default.nix | 2 +- modules/programs/man.nix | 2 +- modules/programs/nix-index/default.nix | 4 ++-- modules/programs/ssh/default.nix | 14 +++++++------- modules/programs/tmux.nix | 16 ++++++++-------- modules/programs/vim.nix | 10 +++++----- modules/programs/zsh/default.nix | 26 +++++++++++++------------- 11 files changed, 61 insertions(+), 61 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/bash/default.nix b/modules/programs/bash/default.nix index 61f82e0..2e27ff9 100644 --- a/modules/programs/bash/default.nix +++ b/modules/programs/bash/default.nix @@ -12,19 +12,19 @@ in programs.bash.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc "Whether to configure bash as an interactive shell."; + description = "Whether to configure bash as an interactive shell."; }; programs.bash.interactiveShellInit = mkOption { default = ""; - description = lib.mdDoc "Shell script code called during interactive bash shell initialisation."; + description = "Shell script code called during interactive bash shell initialisation."; type = types.lines; }; programs.bash.enableCompletion = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' Enable bash completion for all interactive bash shells. NOTE. This doesn't work with bash 3.2, which is the default on macOS. diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index 648b3f9..243068d 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -11,11 +11,11 @@ in { ]; options.programs.direnv = { - enable = lib.mkEnableOption (lib.mdDoc '' + enable = lib.mkEnableOption '' direnv integration. Takes care of both installation and setting up the sourcing of the shell. Additionally enables nix-direnv integration. - ''); + ''; package = lib.mkPackageOptionMD pkgs "direnv" {}; @@ -26,17 +26,17 @@ in { export FOO="foo" echo "loaded direnv!" ''; - description = lib.mdDoc '' + description = '' Extra lines to append to the sourced direnvrc ''; }; - silent = lib.mkEnableOption (lib.mdDoc '' + silent = lib.mkEnableOption '' the hiding of direnv logging - ''); + ''; loadInNixShell = - lib.mkEnableOption (lib.mdDoc '' + (lib.mkEnableOption '' loading direnv in `nix-shell` `nix shell` or `nix develop` '') // { @@ -45,9 +45,9 @@ in { nix-direnv = { enable = - (lib.mkEnableOption (lib.mdDoc '' + (lib.mkEnableOption '' a faster, persistent implementation of use_nix and use_flake, to replace the built-in one - '')) + '') // { default = true; }; diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 287cc71..77276e6 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -51,7 +51,7 @@ in enable = mkOption { default = false; - description = lib.mdDoc '' + description = '' Whether to configure fish as an interactive shell. ''; type = types.bool; @@ -60,7 +60,7 @@ in useBabelfish = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' If enabled, the configured environment will be translated to native fish using [babelfish](https://github.com/bouk/babelfish). Otherwise, [foreign-env](https://github.com/oh-my-fish/plugin-foreign-env) will be used. ''; @@ -69,7 +69,7 @@ in babelfishPackage = mkOption { type = types.package; default = pkgs.babelfish; - description = lib.mdDoc '' + description = '' The babelfish package to use when useBabelfish is set to true. ''; @@ -78,7 +78,7 @@ in vendor.config.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc '' + description = '' Whether fish should source configuration snippets provided by other packages. ''; }; @@ -86,7 +86,7 @@ in vendor.completions.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc '' + description = '' Whether fish should use completion files provided by other packages. ''; }; @@ -94,14 +94,14 @@ in vendor.functions.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc '' + description = '' Whether fish should autoload fish functions provided by other packages. ''; }; shellAliases = mkOption { default = config.environment.shellAliases; - description = lib.mdDoc '' + description = '' Set of aliases for fish shell. See {option}`environment.shellAliases` for an option format description. ''; @@ -110,7 +110,7 @@ in shellInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during fish shell initialisation. ''; type = types.lines; @@ -118,7 +118,7 @@ in loginShellInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during fish login shell initialisation. ''; type = types.lines; @@ -126,7 +126,7 @@ in interactiveShellInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code called during interactive fish shell initialisation. ''; type = types.lines; @@ -134,7 +134,7 @@ in promptInit = mkOption { default = ""; - description = lib.mdDoc '' + description = '' Shell script code used to initialise fish prompt. ''; type = types.lines; diff --git a/modules/programs/gnupg.nix b/modules/programs/gnupg.nix index bd2f96c..4c451ec 100644 --- a/modules/programs/gnupg.nix +++ b/modules/programs/gnupg.nix @@ -13,7 +13,7 @@ in agent.enable = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' Enables GnuPG agent for every user session. ''; }; @@ -21,7 +21,7 @@ in agent.enableSSHSupport = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' Enable SSH agent support in GnuPG agent. Also sets SSH_AUTH_SOCK environment variable correctly. ''; diff --git a/modules/programs/info/default.nix b/modules/programs/info/default.nix index 93aaf7c..cf857d9 100644 --- a/modules/programs/info/default.nix +++ b/modules/programs/info/default.nix @@ -11,7 +11,7 @@ in programs.info.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc "Whether to enable info pages and the {command}`info` command."; + description = "Whether to enable info pages and the {command}`info` command."; }; }; diff --git a/modules/programs/man.nix b/modules/programs/man.nix index fd0e018..f15485b 100644 --- a/modules/programs/man.nix +++ b/modules/programs/man.nix @@ -8,7 +8,7 @@ with lib; programs.man.enable = mkOption { type = types.bool; default = true; - description = lib.mdDoc '' + description = '' Whether to enable manual pages and the {command}`man` command. This also includes "man" outputs of all `systemPackages`. ''; diff --git a/modules/programs/nix-index/default.nix b/modules/programs/nix-index/default.nix index 0685346..b6f86f5 100644 --- a/modules/programs/nix-index/default.nix +++ b/modules/programs/nix-index/default.nix @@ -11,14 +11,14 @@ in programs.nix-index.enable = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Whether to enable nix-index and its command-not-found helper."; + description = "Whether to enable nix-index and its command-not-found helper."; }; programs.nix-index.package = mkOption { type = types.package; default = pkgs.nix-index; defaultText = "pkgs.nix-index"; - description = lib.mdDoc "This option specifies the nix-index package to use."; + description = "This option specifies the nix-index package to use."; }; }; diff --git a/modules/programs/ssh/default.nix b/modules/programs/ssh/default.nix index 5fc7415..d1a6770 100644 --- a/modules/programs/ssh/default.nix +++ b/modules/programs/ssh/default.nix @@ -14,7 +14,7 @@ let hostNames = mkOption { type = types.listOf types.str; default = []; - description = lib.mdDoc '' + description = '' A list of host names and/or IP numbers used for accessing the host's ssh service. ''; @@ -23,7 +23,7 @@ let default = null; type = types.nullOr types.str; example = "ecdsa-sha2-nistp521 AAAAE2VjZHN...UEPg=="; - description = lib.mdDoc '' + description = '' The public key data for the host. You can fetch a public key from a running SSH server with the {command}`ssh-keyscan` command. The public key should not include any host names, only @@ -33,7 +33,7 @@ let publicKeyFile = mkOption { default = null; type = types.nullOr types.path; - description = lib.mdDoc '' + description = '' The path to the public key file for the host. The public key file is read at build time and saved in the Nix store. You can fetch a public key file from a running SSH server @@ -54,7 +54,7 @@ let keys = mkOption { type = types.listOf types.str; default = []; - description = lib.mdDoc '' + description = '' A list of verbatim OpenSSH public keys that should be added to the user's authorized keys. The keys are added to a file that the SSH daemon reads in addition to the the user's authorized_keys file. @@ -68,7 +68,7 @@ let keyFiles = mkOption { type = types.listOf types.path; default = []; - description = lib.mdDoc '' + description = '' A list of files each containing one OpenSSH public key that should be added to the user's authorized keys. The contents of the files are read at build time and added to a file that the SSH daemon reads in @@ -106,7 +106,7 @@ in services.openssh.authorizedKeysFiles = mkOption { type = types.listOf types.str; default = []; - description = lib.mdDoc '' + description = '' Specify the rules for which files to read on the host. This is an advanced option. If you're looking to configure user @@ -122,7 +122,7 @@ in programs.ssh.knownHosts = mkOption { default = {}; type = types.attrsOf (types.submodule host); - description = lib.mdDoc '' + description = '' The set of system-wide known SSH hosts. ''; example = literalExpression '' diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index 7278479..ae6fcbf 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -46,47 +46,47 @@ in programs.tmux.enable = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Whether to configure tmux."; + description = "Whether to configure tmux."; }; programs.tmux.enableSensible = mkOption { type = types.bool; default = false; example = true; - description = lib.mdDoc "Enable sensible configuration options for tmux."; + description = "Enable sensible configuration options for tmux."; }; programs.tmux.enableMouse = mkOption { type = types.bool; default = false; example = true; - description = lib.mdDoc "Enable mouse support for tmux."; + description = "Enable mouse support for tmux."; }; programs.tmux.enableFzf = mkOption { type = types.bool; default = false; example = true; - description = lib.mdDoc "Enable fzf keybindings for selecting tmux sessions and panes."; + description = "Enable fzf keybindings for selecting tmux sessions and panes."; }; programs.tmux.enableVim = mkOption { type = types.bool; default = false; example = true; - description = lib.mdDoc "Enable vim style keybindings for copy mode, and navigation of tmux panes."; + description = "Enable vim style keybindings for copy mode, and navigation of tmux panes."; }; programs.tmux.iTerm2 = mkOption { type = types.bool; default = false; example = true; - description = lib.mdDoc "Cater to iTerm2 and its tmux integration, as appropriate."; + description = "Cater to iTerm2 and its tmux integration, as appropriate."; }; programs.tmux.defaultCommand = mkOption { type = types.either types.str types.package; - description = lib.mdDoc "The default command to use for tmux panes."; + description = "The default command to use for tmux panes."; }; programs.tmux.tmuxOptions = mkOption { @@ -98,7 +98,7 @@ in programs.tmux.extraConfig = mkOption { type = types.lines; default = ""; - description = lib.mdDoc "Extra configuration to add to {file}`tmux.conf`."; + description = "Extra configuration to add to {file}`tmux.conf`."; }; }; diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index d51d0ac..345532e 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -18,14 +18,14 @@ in programs.vim.enable = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Whether to configure vim."; + description = "Whether to configure vim."; }; programs.vim.enableSensible = mkOption { type = types.bool; default = false; example = true; - description = lib.mdDoc "Enable sensible configuration options for vim."; + description = "Enable sensible configuration options for vim."; }; programs.vim.extraKnownPlugins = mkOption { @@ -46,14 +46,14 @@ in }; } ''; - description = lib.mdDoc "Custom plugin declarations to add to VAM's knownPlugins."; + description = "Custom plugin declarations to add to VAM's knownPlugins."; }; programs.vim.plugins = mkOption { type = types.listOf types.attrs; default = []; example = [ { names = [ "surround" "vim-nix" ]; } ]; - description = lib.mdDoc "VAM plugin dictionaries to use for vim_configurable."; + description = "VAM plugin dictionaries to use for vim_configurable."; }; programs.vim.package = mkOption { @@ -70,7 +70,7 @@ in programs.vim.vimConfig = mkOption { type = types.lines; default = ""; - description = lib.mdDoc "Extra vimrcConfig to use for vim_configurable."; + description = "Extra vimrcConfig to use for vim_configurable."; }; }; diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index cce645c..fb928d6 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -19,13 +19,13 @@ in programs.zsh.enable = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Whether to configure zsh as an interactive shell."; + description = "Whether to configure zsh as an interactive shell."; }; programs.zsh.variables = mkOption { type = types.attrsOf (types.either types.str (types.listOf types.str)); default = {}; - description = lib.mdDoc '' + description = '' A set of environment variables used in the global environment. These variables will be set on shell initialisation. The value of each variable can be either a string or a list of @@ -38,44 +38,44 @@ in programs.zsh.shellInit = mkOption { type = types.lines; default = ""; - description = lib.mdDoc "Shell script code called during zsh shell initialisation."; + description = "Shell script code called during zsh shell initialisation."; }; programs.zsh.loginShellInit = mkOption { type = types.lines; default = ""; - description = lib.mdDoc "Shell script code called during zsh login shell initialisation."; + description = "Shell script code called during zsh login shell initialisation."; }; programs.zsh.interactiveShellInit = mkOption { type = types.lines; default = ""; - description = lib.mdDoc "Shell script code called during interactive zsh shell initialisation."; + description = "Shell script code called during interactive zsh shell initialisation."; }; programs.zsh.promptInit = mkOption { type = types.lines; default = "autoload -U promptinit && promptinit && prompt walters && setopt prompt_sp"; - description = lib.mdDoc "Shell script code used to initialise the zsh prompt."; + description = "Shell script code used to initialise the zsh prompt."; }; programs.zsh.enableCompletion = mkOption { type = types.bool; default = true; - description = lib.mdDoc "Enable zsh completion for all interactive zsh shells."; + description = "Enable zsh completion for all interactive zsh shells."; }; programs.zsh.enableBashCompletion = mkOption { type = types.bool; default = true; - description = lib.mdDoc "Enable bash completion for all interactive zsh shells."; + description = "Enable bash completion for all interactive zsh shells."; }; programs.zsh.enableGlobalCompInit = mkOption { type = types.bool; default = cfg.enableCompletion; defaultText = literalExpression "config.${opt.enableCompletion}"; - description = lib.mdDoc '' + description = '' Enable execution of compinit call for all interactive zsh shells. This option can be disabled if the user wants to extend its @@ -87,25 +87,25 @@ in programs.zsh.enableFzfCompletion = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Enable fzf completion."; + description = "Enable fzf completion."; }; programs.zsh.enableFzfGit = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Enable fzf keybindings for C-g git browsing."; + description = "Enable fzf keybindings for C-g git browsing."; }; programs.zsh.enableFzfHistory = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Enable fzf keybinding for Ctrl-r history search."; + description = "Enable fzf keybinding for Ctrl-r history search."; }; programs.zsh.enableSyntaxHighlighting = mkOption { type = types.bool; default = false; - description = lib.mdDoc "Enable zsh-syntax-highlighting."; + description = "Enable zsh-syntax-highlighting."; }; }; -- cgit v1.2.3 From c8a8faedbc2ae80951fe4b5a92fb10de003d6aed Mon Sep 17 00:00:00 2001 From: Dominik Gleich Date: Mon, 20 May 2024 09:48:03 +0200 Subject: Change zsh default prompt --- modules/programs/zsh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index fb928d6..bbf8ad9 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -55,7 +55,7 @@ in programs.zsh.promptInit = mkOption { type = types.lines; - default = "autoload -U promptinit && promptinit && prompt walters && setopt prompt_sp"; + default = "autoload -U promptinit && promptinit && prompt suse && setopt prompt_sp"; description = "Shell script code used to initialise the zsh prompt."; }; -- cgit v1.2.3 From 2839ef54aaaa0ca797659a1db45876260b93b1eb Mon Sep 17 00:00:00 2001 From: Trevor Opiyo Date: Wed, 20 Mar 2024 20:12:46 -0500 Subject: Add support for zsh-fast-syntax-highlighting --- modules/programs/zsh/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index bbf8ad9..c7ff47c 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -107,6 +107,12 @@ in default = false; description = "Enable zsh-syntax-highlighting."; }; + + programs.zsh.enableFastSyntaxHighlighting = mkOption { + type = types.bool; + default = false; + description = lib.mdDoc "Enable zsh-fast-syntax-highlighting."; + }; }; config = mkIf cfg.enable { @@ -115,7 +121,8 @@ in [ # Include zsh package pkgs.zsh ] ++ optional cfg.enableCompletion pkgs.nix-zsh-completions - ++ optional cfg.enableSyntaxHighlighting pkgs.zsh-syntax-highlighting; + ++ optional cfg.enableSyntaxHighlighting pkgs.zsh-syntax-highlighting + ++ optional cfg.enableFastSyntaxHighlighting pkgs.zsh-fast-syntax-highlighting; environment.pathsToLink = [ "/share/zsh" ]; @@ -196,6 +203,10 @@ in "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" } + ${optionalString cfg.enableFastSyntaxHighlighting + "source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh" + } + ${optionalString cfg.enableFzfCompletion "source ${fzfCompletion}"} ${optionalString cfg.enableFzfGit "source ${fzfGit}"} ${optionalString cfg.enableFzfHistory "source ${fzfHistory}"} -- cgit v1.2.3 From 44c88484c4c386f3eae8a5398e9b22a78d606e43 Mon Sep 17 00:00:00 2001 From: Trevor Opiyo Date: Wed, 29 May 2024 12:23:59 -0500 Subject: add warning for enabling syntax highlighting and fast syntax highlighting --- modules/programs/zsh/default.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index c7ff47c..d3b2f5c 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -117,6 +117,9 @@ in config = mkIf cfg.enable { + warnings = mkIf (cfg.enableFastSyntaxHighlighting && cfg.enableSyntaxHighlighting) [ + "zsh-fast-syntax-highlighting and zsh-syntax-highlighting are mutually exclusive. Disable one of them." + ]; environment.systemPackages = [ # Include zsh package pkgs.zsh -- cgit v1.2.3 From b833d4a32d965e6393a63b2c91b46eca2a5030d8 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 16 Jul 2023 16:59:43 +0100 Subject: ssh: use symlinks for `authorizedKeys` options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As explained in the changelog and activation check, the previous implementation had a nasty security bug that made removing a user’s authorized keys effectively a no‐op. --- modules/programs/ssh/default.nix | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/ssh/default.nix b/modules/programs/ssh/default.nix index d1a6770..6f72369 100644 --- a/modules/programs/ssh/default.nix +++ b/modules/programs/ssh/default.nix @@ -3,7 +3,7 @@ with lib; let - cfg = config.programs.ssh; + cfg = config.programs.ssh; knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts); @@ -81,8 +81,7 @@ let }; authKeysFiles = let - mkAuthKeyFile = u: nameValuePair "ssh/authorized_keys.d/${u.name}" { - copy = true; + mkAuthKeyFile = u: nameValuePair "ssh/nix_authorized_keys.d/${u.name}" { text = '' ${concatStringsSep "\n" u.openssh.authorizedKeys.keys} ${concatMapStrings (f: readFile f + "\n") u.openssh.authorizedKeys.keyFiles} @@ -97,28 +96,16 @@ let in { + imports = [ + (mkRemovedOptionModule [ "services" "openssh" "authorizedKeysFiles" ] "No `nix-darwin` equivalent to this NixOS option.") + ]; + options = { users.users = mkOption { type = with types; attrsOf (submodule userOptions); }; - services.openssh.authorizedKeysFiles = mkOption { - type = types.listOf types.str; - default = []; - description = '' - Specify the rules for which files to read on the host. - - This is an advanced option. If you're looking to configure user - keys, you can generally use [](#opt-users.users._name_.openssh.authorizedKeys.keys) - or [](#opt-users.users._name_.openssh.authorizedKeys.keyFiles). - - These are paths relative to the host root file system or home - directories and they are subject to certain token expansion rules. - See AuthorizedKeysFile in man sshd_config for details. - ''; - }; - programs.ssh.knownHosts = mkOption { default = {}; type = types.attrsOf (types.submodule host); @@ -148,8 +135,6 @@ in message = "knownHost ${name} must contain either a publicKey or publicKeyFile"; }); - services.openssh.authorizedKeysFiles = [ "%h/.ssh/authorized_keys" "/etc/ssh/authorized_keys.d/%u" ]; - environment.etc = authKeysFiles // { "ssh/ssh_known_hosts" = mkIf (builtins.length knownHosts > 0) { text = (flip (concatMapStringsSep "\n") knownHosts @@ -159,14 +144,20 @@ in )) + "\n"; }; "ssh/sshd_config.d/101-authorized-keys.conf" = { - text = "AuthorizedKeysFile ${toString config.services.openssh.authorizedKeysFiles}\n"; + text = '' + # sshd doesn't like reading from symbolic links, so we cat + # the file ourselves. + AuthorizedKeysCommand /bin/cat /etc/ssh/nix_authorized_keys.d/%u + # Just a simple cat, fine to use _sshd. + AuthorizedKeysCommandUser _sshd + ''; # Allows us to automatically migrate from using a file to a symlink knownSha256Hashes = [ oldAuthorizedKeysHash ]; }; }; - # Clean up .before-nix-darwin file left over from using knownSha256Hashes system.activationScripts.etc.text = '' + # Clean up .before-nix-darwin file left over from using knownSha256Hashes auth_keys_orig=/etc/ssh/sshd_config.d/101-authorized-keys.conf.before-nix-darwin if [ -e "$auth_keys_orig" ] && [ "$(shasum -a 256 $auth_keys_orig | cut -d ' ' -f 1)" = "${oldAuthorizedKeysHash}" ]; then -- cgit v1.2.3 From e00896468a4723c799b3904e2d10f0cf9a0ff847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Milojevi=C4=87?= Date: Mon, 1 Jul 2024 16:24:41 +0200 Subject: chore: remove mkpackageoptionmd deprecation --- modules/programs/direnv.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index 243068d..533fc8e 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -17,7 +17,7 @@ in { integration. ''; - package = lib.mkPackageOptionMD pkgs "direnv" {}; + package = lib.mkPackageOption pkgs "direnv" {}; direnvrcExtra = lib.mkOption { type = lib.types.lines; @@ -52,7 +52,7 @@ in { default = true; }; - package = lib.mkPackageOptionMD pkgs "nix-direnv" {}; + package = lib.mkPackageOption pkgs "nix-direnv" {}; }; }; -- cgit v1.2.3 From e88eb66c2b5e7066786f5d6343f3737567a71734 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 27 Jul 2024 13:35:35 +1000 Subject: `mapAttrsFlatten` -> `mapAttrsToList` deprecated in https://github.com/NixOS/nixpkgs/commit/473e469d5a921a57b484a09d446cee6c231cd592 --- modules/programs/fish.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 77276e6..4b76e02 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -9,7 +9,7 @@ let cfg = config.programs.fish; fishAliases = concatStringsSep "\n" ( - mapAttrsFlatten (k: v: "alias ${k} ${escapeShellArg v}") + mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}") (filterAttrs (k: v: v != null) cfg.shellAliases) ); -- cgit v1.2.3 From cf45edbf271a638637d4f1a824c429d7649ecbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 31 Jul 2024 19:34:17 +0200 Subject: programs.ssh: add certificate authorities --- modules/programs/ssh/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/ssh/default.nix b/modules/programs/ssh/default.nix index 6f72369..51c7796 100644 --- a/modules/programs/ssh/default.nix +++ b/modules/programs/ssh/default.nix @@ -11,6 +11,14 @@ let { name, ... }: { options = { + certAuthority = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + This public key is an SSH certificate authority, rather than an + individual host's key. + ''; + }; hostNames = mkOption { type = types.listOf types.str; default = []; @@ -139,7 +147,7 @@ in { "ssh/ssh_known_hosts" = mkIf (builtins.length knownHosts > 0) { text = (flip (concatMapStringsSep "\n") knownHosts (h: assert h.hostNames != []; - concatStringsSep "," h.hostNames + " " + lib.optionalString h.certAuthority "@cert-authority " + concatStringsSep "," h.hostNames + " " + (if h.publicKey != null then h.publicKey else readFile h.publicKeyFile) )) + "\n"; }; -- cgit v1.2.3 From d5dba1c6f5b4069988f9601df861fff2490fb3d2 Mon Sep 17 00:00:00 2001 From: Alice Carroll Date: Sat, 3 Aug 2024 14:57:36 +0300 Subject: refactor: rename environment.postBuild to environment.extraSetup --- modules/programs/info/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/info/default.nix b/modules/programs/info/default.nix index cf857d9..d70e377 100644 --- a/modules/programs/info/default.nix +++ b/modules/programs/info/default.nix @@ -22,7 +22,7 @@ in environment.pathsToLink = [ "/info" "/share/info" ]; environment.extraOutputsToInstall = [ "info" ]; - environment.postBuild = '' + environment.extraSetup = '' if test -w $out/share/info; then shopt -s nullglob for i in $out/share/info/*.info $out/share/info/*.info.gz; do -- cgit v1.2.3 From 75d14c62cbc4360cbd1a1b5c52dbd17b8bd08892 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 29 Aug 2024 16:25:33 -0400 Subject: gpg: Suppress stderr from gpg-connect-agent on shell init In some scenarios, the command may fail, e.g. when the shell is executed with a different $HOME from where gpg agent is configured to run from. (E.g. this happens in kitty terminal test suite.) This patch will suppress stderr errors on tty in this situation. Note that zsh does not allow to suppress execution of /etc/zshenv on startup, so it's impossible to skip it in the test suite environment. An alternative would be to set IN_NIX_SHELL in the test suite, but this was rejected in upstream: https://github.com/kovidgoyal/kitty/pull/7800 There's also a kitty package specific fix posted here but this may be unnecessary once nix-darwin is patched here: https://github.com/NixOS/nixpkgs/pull/338070 Signed-off-by: Ihar Hrachyshka --- modules/programs/gnupg.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/gnupg.nix b/modules/programs/gnupg.nix index 4c451ec..6a34e30 100644 --- a/modules/programs/gnupg.nix +++ b/modules/programs/gnupg.nix @@ -43,7 +43,7 @@ in '' + (optionalString cfg.agent.enableSSHSupport '' # SSH agent protocol doesn't support changing TTYs, so bind the agent # to every new TTY. - ${pkgs.gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null + ${pkgs.gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null 2>&1 export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket) ''); -- cgit v1.2.3 From 4d59f660bc41ba35b1f6df829e8e0b7706b35ee7 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 10 Sep 2024 21:35:35 +0200 Subject: zsh: move fpath init from /etc/zshrc to /etc/zshenv We want these to be set even when /etc/zshrc loading is disabled. NixOS/nixpkgs@f70e3f3738300ef1e94737c09364cd176893858f --- modules/programs/zsh/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index bbf8ad9..15d5ba7 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -135,6 +135,11 @@ in . ${config.system.build.setEnvironment} fi + # Tell zsh how to find installed completions + for p in ''${(z)NIX_PROFILES}; do + fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) + done + ${cfg.shellInit} # Read system-wide modifications. @@ -182,11 +187,6 @@ in ${config.environment.interactiveShellInit} ${cfg.interactiveShellInit} - # Tell zsh how to find installed completions - for p in ''${(z)NIX_PROFILES}; do - fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) - done - ${cfg.promptInit} ${optionalString cfg.enableGlobalCompInit "autoload -U compinit && compinit"} -- cgit v1.2.3 From 15f64efcaf936f3b77955018d29b4802be6b144f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Tue, 10 Sep 2024 21:40:11 +0200 Subject: zsh: prefer Nix completions these from Zsh package Zsh ships some rudimentary completions for programs where upstream also ships their own completions (e.g., curl). So as not to shadow those completions, we need to prepend to the fpath instead of appending. NixOS/nixpkgs@8dad5a22399782a4ef681174219546cb050e580f --- modules/programs/zsh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 15d5ba7..58a3155 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -137,7 +137,7 @@ in # Tell zsh how to find installed completions for p in ''${(z)NIX_PROFILES}; do - fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) + fpath=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions $fpath) done ${cfg.shellInit} -- cgit v1.2.3 From 7e6c548eef2372cef1287ef45350e29ca5740159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 Sep 2024 13:01:26 +0200 Subject: zsh: let children shells set their fpath Currently zshenv by default only sets fpath without exporting it. A parent shell would also not set those variables usually as they are shell local. It also sources a file called set-environment but this is protected by an environment variable called __NIX_DARWIN_SET_ENVIRONMENT_DONE. Hence any modification done by the parent shell should persist as long as __NIX_DARWIN_SET_ENVIRONMENT_DONE is not unset. This behavior deviates from what we do in bashrc and breaks common setups such as tmux/mosh or screen. NixOS/nixpkgs@55819e6c861f53450030eea832a76583a6786370 --- modules/programs/zsh/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 58a3155..1f36740 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -124,9 +124,8 @@ in # This file is read for all shells. # Only execute this file once per shell. - # But don't clobber the environment of interactive non-login children! if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi - export __ETC_ZSHENV_SOURCED=1 + __ETC_ZSHENV_SOURCED=1 # Don't execute this file when running in a pure nix-shell. if test -n "$IN_NIX_SHELL"; then return; fi -- cgit v1.2.3 From 6ad463a76421022de6762e6f50128febb970dcfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Wed, 11 Sep 2024 14:03:57 +0200 Subject: zsh: don't be noisy when scripts are run with -u When a script specifies the shell option "nounset" as part of the shebang (e.g., via "#!/usr/bin/env -S zsh -u"), our initialization scripts would produce error messages of the form: __ETC_FOO_SOURCED: parameter not set These messages could probably be confusing to users when running such scripts. By providing a fall-back in the parameter expansion, we can avoid them. This patch does not address interactive shell start-up, where such messages may (or may not) be less problematic. NixOS/nixpkgs@7d84dbdf5b91439f798363559310d86b21bfa86c --- modules/programs/zsh/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 1f36740..7574f8e 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -124,13 +124,13 @@ in # This file is read for all shells. # Only execute this file once per shell. - if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi + if [ -n "''${__ETC_ZSHENV_SOURCED-}" ]; then return; fi __ETC_ZSHENV_SOURCED=1 # Don't execute this file when running in a pure nix-shell. if test -n "$IN_NIX_SHELL"; then return; fi - if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]; then + if [ -z "''${__NIX_DARWIN_SET_ENVIRONMENT_DONE-}" ]; then . ${config.system.build.setEnvironment} fi @@ -152,7 +152,7 @@ in # This file is read for login shells. # Only execute this file once per shell. - if [ -n "$__ETC_ZPROFILE_SOURCED" ]; then return; fi + if [ -n "''${__ETC_ZPROFILE_SOURCED-}" ]; then return; fi __ETC_ZPROFILE_SOURCED=1 ${concatStringsSep "\n" zshVariables} -- cgit v1.2.3 From 953d02ba5958df017d9682f727d10a75cb8a0391 Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Thu, 12 Sep 2024 17:37:56 +0000 Subject: {bash,zsh}: remove nix-shell early return in /etc/{bashrc,zshenv} The condition does not match the comment, and therefore not the original intention. It currently returns early in *any* type of Nix shell, not just pure ones, including 'nix develop'. Besides being unnecessary, this check prevents Nix shells from functioning properly. For instance, it causes the initialization of the Zsh fpath to be skipped, which is critical. The fact that the user is unable to opt out of this behaviour makes this an ever bigger problem since /etc/zshenv is being loaded unconditionally by Zsh. For reference, NixOS does not perform such check, and apparently never did. --- modules/programs/bash/default.nix | 3 --- modules/programs/zsh/default.nix | 3 --- 2 files changed, 6 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/bash/default.nix b/modules/programs/bash/default.nix index 2e27ff9..3abb3e8 100644 --- a/modules/programs/bash/default.nix +++ b/modules/programs/bash/default.nix @@ -55,9 +55,6 @@ in if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi __ETC_BASHRC_SOURCED=1 - # Don't execute this file when running in a pure nix-shell. - if [ "$IN_NIX_SHELL" = "pure" ]; then return; fi - if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]; then . ${config.system.build.setEnvironment} fi diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 7574f8e..bfbfc59 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -127,9 +127,6 @@ in if [ -n "''${__ETC_ZSHENV_SOURCED-}" ]; then return; fi __ETC_ZSHENV_SOURCED=1 - # Don't execute this file when running in a pure nix-shell. - if test -n "$IN_NIX_SHELL"; then return; fi - if [ -z "''${__NIX_DARWIN_SET_ENVIRONMENT_DONE-}" ]; then . ${config.system.build.setEnvironment} fi -- cgit v1.2.3 From c9fd4820d5e33422d2a9311898e098ba492dbd34 Mon Sep 17 00:00:00 2001 From: isabel Date: Mon, 30 Sep 2024 16:30:50 +0100 Subject: programs/bash: move to completion.* a port of https://github.com/NixOS/nixpkgs/pull/291552 for darwin --- modules/programs/bash/default.nix | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/bash/default.nix b/modules/programs/bash/default.nix index 3abb3e8..2518c9c 100644 --- a/modules/programs/bash/default.nix +++ b/modules/programs/bash/default.nix @@ -7,6 +7,10 @@ let in { + imports = [ + (mkRenamedOptionModule [ "programs" "bash" "enableCompletion" ] [ "programs" "bash" "completion" "enable" ]) + ]; + options = { programs.bash.enable = mkOption { @@ -21,14 +25,18 @@ in type = types.lines; }; - programs.bash.enableCompletion = mkOption { - type = types.bool; - default = false; - description = '' - Enable bash completion for all interactive bash shells. + programs.bash.completion = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Enable bash completion for all interactive bash shells. + + NOTE: This doesn't work with bash 3.2, which is installed by default on macOS by Apple. + ''; + }; - NOTE. This doesn't work with bash 3.2, which is the default on macOS. - ''; + package = mkPackageOption pkgs "bash-completion" { }; }; }; @@ -38,9 +46,9 @@ in environment.systemPackages = [ # Include bash package pkgs.bashInteractive - ] ++ optional cfg.enableCompletion pkgs.bash-completion; + ] ++ optional cfg.completion.enable cfg.completion.package; - environment.pathsToLink = + environment.pathsToLink = optionals cfg.completion.enable [ "/etc/bash_completion.d" "/share/bash-completion/completions" ]; @@ -70,9 +78,9 @@ in ${config.environment.interactiveShellInit} ${cfg.interactiveShellInit} - ${optionalString cfg.enableCompletion '' + ${optionalString cfg.completion.enable '' if [ "$TERM" != "dumb" ]; then - source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" + source "${cfg.completion.package}/etc/profile.d/bash_completion.sh" nullglobStatus=$(shopt -p nullglob) shopt -s nullglob -- cgit v1.2.3 From 470f87c1827b51169ed4f91cdbdfd48417bfff3d Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 31 Oct 2024 15:02:36 +1100 Subject: zsh: enable by default as zsh is the default shell on macOS Historically this was a footgun because users would not always have this enabled leading to `darwin-rebuild` and other programs not being found. --- modules/programs/zsh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index bfbfc59..1665fcd 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -18,7 +18,7 @@ in options = { programs.zsh.enable = mkOption { type = types.bool; - default = false; + default = true; description = "Whether to configure zsh as an interactive shell."; }; -- cgit v1.2.3 From 63f4d40e551e7b29fbe586967c03eea1e6a70ce4 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 31 Oct 2024 15:59:09 +1100 Subject: tmux: remove `programs.tmux.defaultCommand` --- modules/programs/tmux.nix | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index ae6fcbf..d70dab1 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -41,6 +41,7 @@ in { imports = [ (mkRenamedOptionModule [ "programs" "tmux" "tmuxConfig" ] [ "programs" "tmux" "extraConfig" ]) + (mkRemovedOptionModule [ "programs" "tmux" "defaultCommand" ] "Use `programs.tmux.extraConfig` to configure the default command instead. If unset, tmux will default to using your system configured login shell.") ]; options = { programs.tmux.enable = mkOption { @@ -84,11 +85,6 @@ in description = "Cater to iTerm2 and its tmux integration, as appropriate."; }; - programs.tmux.defaultCommand = mkOption { - type = types.either types.str types.package; - description = "The default command to use for tmux panes."; - }; - programs.tmux.tmuxOptions = mkOption { internal = true; type = types.attrsOf (types.submodule text); @@ -120,12 +116,6 @@ in source-file -q /etc/tmux.conf.local ''; - programs.tmux.defaultCommand = mkDefault config.environment.loginShell; - - programs.tmux.tmuxOptions.login-shell.text = '' - set -g default-command "${cfg.defaultCommand}" - ''; - programs.tmux.tmuxOptions.sensible.text = mkIf cfg.enableSensible '' set -g default-terminal "screen-256color" setw -g aggressive-resize on -- cgit v1.2.3 From 897fc37c47d2592c475f8732f3f1a4fbc9f18f9e Mon Sep 17 00:00:00 2001 From: Trevor Opiyo Date: Tue, 5 Nov 2024 08:16:35 -0600 Subject: Update default.nix Co-authored-by: Michael Hoang --- modules/programs/zsh/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index d3b2f5c..6555bac 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -117,8 +117,11 @@ in config = mkIf cfg.enable { - warnings = mkIf (cfg.enableFastSyntaxHighlighting && cfg.enableSyntaxHighlighting) [ - "zsh-fast-syntax-highlighting and zsh-syntax-highlighting are mutually exclusive. Disable one of them." + assertions = [ + { + assertion = !(cfg.enableSyntaxHighlighting && cfg.enableFastSyntaxHighlighting); + message = "zsh-syntax-highlighting and zsh-fast-syntax-highlighting are mutually exclusive, please disable one of them."; + } ]; environment.systemPackages = [ # Include zsh package -- cgit v1.2.3 From 48e5c8de1a4575441b46cb174afebfa02732c0ff Mon Sep 17 00:00:00 2001 From: Trevor Opiyo Date: Wed, 6 Nov 2024 01:10:24 -0600 Subject: Update modules/programs/zsh/default.nix Changes added by Enzime Co-authored-by: Michael Hoang --- modules/programs/zsh/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 6555bac..652ba58 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -108,11 +108,7 @@ in description = "Enable zsh-syntax-highlighting."; }; - programs.zsh.enableFastSyntaxHighlighting = mkOption { - type = types.bool; - default = false; - description = lib.mdDoc "Enable zsh-fast-syntax-highlighting."; - }; + programs.zsh.enableFastSyntaxHighlighting = mkEnableOption "zsh-fast-syntax-highlighting"; }; config = mkIf cfg.enable { -- cgit v1.2.3 From 5fbb7b7637307c89e52d7e73ed6c848353bda6a0 Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:29:35 -0800 Subject: zsh: only run shell initialization in /etc/zshenv when RCs are enabled --- modules/programs/zsh/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index a9ffbd8..c6ec917 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -136,16 +136,18 @@ in if [ -n "''${__ETC_ZSHENV_SOURCED-}" ]; then return; fi __ETC_ZSHENV_SOURCED=1 - if [ -z "''${__NIX_DARWIN_SET_ENVIRONMENT_DONE-}" ]; then - . ${config.system.build.setEnvironment} - fi + if [[ -o rcs ]]; then + if [ -z "''${__NIX_DARWIN_SET_ENVIRONMENT_DONE-}" ]; then + . ${config.system.build.setEnvironment} + fi - # Tell zsh how to find installed completions - for p in ''${(z)NIX_PROFILES}; do - fpath=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions $fpath) - done + # Tell zsh how to find installed completions + for p in ''${(z)NIX_PROFILES}; do + fpath=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions $fpath) + done - ${cfg.shellInit} + ${cfg.shellInit} + fi # Read system-wide modifications. if test -f /etc/zshenv.local; then -- cgit v1.2.3 From 2c86af2e996ac6abbf9e1711f36c28d33b328df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 12 Aug 2024 10:26:41 +0200 Subject: programs.ssh: add extraConfig option Same interface as in NixOS. This is useful to apply configuration for remote builders. --- modules/programs/ssh/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules/programs') diff --git a/modules/programs/ssh/default.nix b/modules/programs/ssh/default.nix index 51c7796..1e87732 100644 --- a/modules/programs/ssh/default.nix +++ b/modules/programs/ssh/default.nix @@ -114,6 +114,15 @@ in type = with types; attrsOf (submodule userOptions); }; + programs.ssh.extraConfig = lib.mkOption { + type = lib.types.lines; + default = ""; + description = '' + Extra configuration text loaded in {file}`ssh_config`. + See {manpage}`ssh_config(5)` for help. + ''; + }; + programs.ssh.knownHosts = mkOption { default = {}; type = types.attrsOf (types.submodule host); @@ -151,6 +160,7 @@ in + (if h.publicKey != null then h.publicKey else readFile h.publicKeyFile) )) + "\n"; }; + "ssh/ssh_config.d/100-nix-darwin.conf".text = config.programs.ssh.extraConfig; "ssh/sshd_config.d/101-authorized-keys.conf" = { text = '' # sshd doesn't like reading from symbolic links, so we cat -- cgit v1.2.3 From 2165857a24668cc3cb09c052eb0d518a1dfa6d3f Mon Sep 17 00:00:00 2001 From: "Adam C. Stephens" Date: Wed, 18 Dec 2024 09:44:07 -0500 Subject: fish: add package option --- modules/programs/fish.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 4b76e02..65797cc 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -57,6 +57,8 @@ in type = types.bool; }; + package = lib.mkPackageOption pkgs "fish" { }; + useBabelfish = mkOption { type = types.bool; default = false; @@ -238,7 +240,7 @@ in ++ optional cfg.vendor.functions.enable "/share/fish/vendor_functions.d"; } - { systemPackages = [ pkgs.fish ]; } + { systemPackages = [ cfg.package ]; } ]; }; -- cgit v1.2.3 From daf9d9fe5d5a7a5ef25aa446582f8c656aab2b9b Mon Sep 17 00:00:00 2001 From: Xingquan Liu Date: Tue, 17 Dec 2024 23:03:57 +0800 Subject: fix(zsh): correct the path of zsh-fast-syntax-highlighting --- modules/programs/zsh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/programs') diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index c6ec917..65689ba 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -204,7 +204,7 @@ in } ${optionalString cfg.enableFastSyntaxHighlighting - "source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh" + "source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh" } ${optionalString cfg.enableFzfCompletion "source ${fzfCompletion}"} -- cgit v1.2.3