diff options
author | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2023-07-19 13:07:29 +0200 |
---|---|---|
committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2023-09-29 00:24:34 +0200 |
commit | 5b9cdda1c2ae43315574bbe9950470be9911b0cd (patch) | |
tree | f7fa05ad920ae52958e41bbb6e82f3eee5ce292a | |
parent | d90e8fdfb7ea4885907c1570877197160cff2d44 (diff) | |
download | nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.tar nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.tar.gz nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.tar.bz2 nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.tar.lz nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.tar.xz nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.tar.zst nixpkgs-5b9cdda1c2ae43315574bbe9950470be9911b0cd.zip |
nixos/nano: add enable, package option, do not create /etc/nanorc by default
and remove nano from environment.defaultPackages. In addition also cleanup the file in general. This is a follow up to #220481 Co-authored-by: pennae <82953136+pennae@users.noreply.github.com>
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2311.section.md | 4 | ||||
-rw-r--r-- | nixos/modules/config/system-path.nix | 3 | ||||
-rw-r--r-- | nixos/modules/programs/nano.nix | 34 |
3 files changed, 20 insertions, 21 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index 3363f8faee2..f5f964b12a0 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -196,6 +196,10 @@ - `spamassassin` no longer supports the `Hashcash` module. The module needs to be removed from the `loadplugin` list if it was copied over from the default `initPreConf` option. +- `nano` was removed from `environment.defaultPackages`. To not leave systems without a editor, now `programs.nano.enable` is enabled by default. + +- `programs.nano.nanorc` and `programs.nano.syntaxHighlight` no longer have an effect unless `programs.nano.enable` is set to true which is the default. + - `services.outline.sequelizeArguments` has been removed, as `outline` no longer executes database migrations via the `sequelize` cli. - The binary of the package `cloud-sql-proxy` has changed from `cloud_sql_proxy` to `cloud-sql-proxy`. diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 222da3e02e8..7e623dec4b1 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -42,8 +42,7 @@ let ]; defaultPackageNames = - [ "nano" - "perl" + [ "perl" "rsync" "strace" ]; diff --git a/nixos/modules/programs/nano.nix b/nixos/modules/programs/nano.nix index 7705bf0ddc7..28ddb4aaf66 100644 --- a/nixos/modules/programs/nano.nix +++ b/nixos/modules/programs/nano.nix @@ -2,14 +2,16 @@ let cfg = config.programs.nano; - LF = "\n"; in { - ###### interface - options = { programs.nano = { + enable = lib.mkEnableOption (lib.mdDoc "nano") // { + default = true; + }; + + package = lib.mkPackageOptionMD pkgs "nano" { }; nanorc = lib.mkOption { type = lib.types.lines; @@ -24,28 +26,22 @@ in set tabsize 2 ''; }; + syntaxHighlight = lib.mkOption { type = lib.types.bool; - default = true; + default = false; description = lib.mdDoc "Whether to enable syntax highlight for various languages."; }; }; }; - ###### implementation - - config = lib.mkIf (cfg.nanorc != "" || cfg.syntaxHighlight) { - environment.etc.nanorc.text = lib.concatStringsSep LF ( - ( lib.optionals cfg.syntaxHighlight [ - "# The line below is added because value of programs.nano.syntaxHighlight is set to true" - ''include "${pkgs.nano}/share/nano/*.nanorc"'' - "" - ]) - ++ ( lib.optionals (cfg.nanorc != "") [ - "# The lines below have been set from value of programs.nano.nanorc" - cfg.nanorc - ]) - ); + config = lib.mkIf cfg.enable { + environment = { + etc.nanorc.text = (lib.optionalString cfg.syntaxHighlight '' + # load syntax highlighting files + include "${cfg.package}/share/nano/*.nanorc" + '') + cfg.nanorc; + systemPackages = [ cfg.package ]; + }; }; - } |