lol

Merge pull request #244324 from SuperSandro2000/nixos-nano

nixos/nano: add enable, package option, do not create /etc/nanorc by …

authored by

pennae and committed by
GitHub
bb6c5f9f ab7256be

+20 -21
+4
nixos/doc/manual/release-notes/rl-2311.section.md
··· 200 200 201 201 - `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. 202 202 203 + - `nano` was removed from `environment.defaultPackages`. To not leave systems without a editor, now `programs.nano.enable` is enabled by default. 204 + 205 + - `programs.nano.nanorc` and `programs.nano.syntaxHighlight` no longer have an effect unless `programs.nano.enable` is set to true which is the default. 206 + 203 207 - `services.outline.sequelizeArguments` has been removed, as `outline` no longer executes database migrations via the `sequelize` cli. 204 208 205 209 - The binary of the package `cloud-sql-proxy` has changed from `cloud_sql_proxy` to `cloud-sql-proxy`.
+1 -2
nixos/modules/config/system-path.nix
··· 42 42 ]; 43 43 44 44 defaultPackageNames = 45 - [ "nano" 46 - "perl" 45 + [ "perl" 47 46 "rsync" 48 47 "strace" 49 48 ];
+15 -19
nixos/modules/programs/nano.nix
··· 2 2 3 3 let 4 4 cfg = config.programs.nano; 5 - LF = "\n"; 6 5 in 7 6 8 7 { 9 - ###### interface 10 - 11 8 options = { 12 9 programs.nano = { 10 + enable = lib.mkEnableOption (lib.mdDoc "nano") // { 11 + default = true; 12 + }; 13 + 14 + package = lib.mkPackageOptionMD pkgs "nano" { }; 13 15 14 16 nanorc = lib.mkOption { 15 17 type = lib.types.lines; ··· 24 26 set tabsize 2 25 27 ''; 26 28 }; 29 + 27 30 syntaxHighlight = lib.mkOption { 28 31 type = lib.types.bool; 29 - default = true; 32 + default = false; 30 33 description = lib.mdDoc "Whether to enable syntax highlight for various languages."; 31 34 }; 32 35 }; 33 36 }; 34 37 35 - ###### implementation 36 - 37 - config = lib.mkIf (cfg.nanorc != "" || cfg.syntaxHighlight) { 38 - environment.etc.nanorc.text = lib.concatStringsSep LF ( 39 - ( lib.optionals cfg.syntaxHighlight [ 40 - "# The line below is added because value of programs.nano.syntaxHighlight is set to true" 41 - ''include "${pkgs.nano}/share/nano/*.nanorc"'' 42 - "" 43 - ]) 44 - ++ ( lib.optionals (cfg.nanorc != "") [ 45 - "# The lines below have been set from value of programs.nano.nanorc" 46 - cfg.nanorc 47 - ]) 48 - ); 38 + config = lib.mkIf cfg.enable { 39 + environment = { 40 + etc.nanorc.text = (lib.optionalString cfg.syntaxHighlight '' 41 + # load syntax highlighting files 42 + include "${cfg.package}/share/nano/*.nanorc" 43 + '') + cfg.nanorc; 44 + systemPackages = [ cfg.package ]; 45 + }; 49 46 }; 50 - 51 47 }