environment.motd: add option

This commit is contained in:
Tobias Happ 2022-11-05 22:30:52 +01:00
parent a99c1e0416
commit ffac515cfb
3 changed files with 56 additions and 40 deletions

View file

@ -19,6 +19,8 @@
* In an effort to reduce the number of arguments to `lib.nixOnDroidConfiguration` * In an effort to reduce the number of arguments to `lib.nixOnDroidConfiguration`
function in flake configurations, `system` is now inferred from `pkgs.system` function in flake configurations, `system` is now inferred from `pkgs.system`
and `config` and `extraModules` are now combined into `modules` and `config` and `extraModules` are now combined into `modules`
* Add option `environment.motd` to edit the startup message that is printed in
every shell
## Release 22.05 ## Release 22.05

View file

@ -13,10 +13,11 @@ writeText "login-inner" ''
set -eo pipefail set -eo pipefail
${lib.optionalString (config.environment.motd != null) ''
if [ "$#" -eq 0 ]; then # if script is called from within nix-on-droid app if [ "$#" -eq 0 ]; then # if script is called from within nix-on-droid app
echo "Welcome to Nix-on-Droid!" echo "${lib.removeSuffix "\n" config.environment.motd}"
echo "If nothing works, open an issue at https://github.com/t184256/nix-on-droid/issues or try the rescue shell."
fi fi
''}
${lib.optionalString config.build.initialBuild '' ${lib.optionalString config.build.initialBuild ''
if [ -e /etc/UNINTIALISED ]; then if [ -e /etc/UNINTIALISED ]; then

View file

@ -1,4 +1,4 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
@ -49,7 +49,19 @@ in
options = { options = {
environment.sessionVariables = mkOption { environment = {
motd = mkOption {
default = ''
Welcome to Nix-on-Droid!
If nothing works, open an issue at https://github.com/t184256/nix-on-droid/issues or try the rescue shell.
'';
type = types.nullOr types.lines;
description = ''
Text to show on every new shell created by nix-on-droid.
'';
};
sessionVariables = mkOption {
default = { }; default = { };
type = types.attrs; type = types.attrs;
example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; }; example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; };
@ -85,6 +97,7 @@ in
</programlisting> </programlisting>
''; '';
}; };
};
}; };