diff mbox series

[v6,2/3] package/nushell: Add default configs

Message ID 20230308131554.642965-2-sebastian.weyer@smile.fr
State Rejected
Headers show
Series [v6,1/3] package/nushell: new package | expand

Commit Message

Sebastian Weyer March 8, 2023, 1:15 p.m. UTC
Automatically place default files for the nushell environment and
config in the appropriate folder to avoid the prompt at startup, asking
if you want to create them.

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---
These default configs are optional and might not even be necessary, they
only prevent the prompt at the first startup of the shell
---
 package/nushell/nushell.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Thomas Petazzoni Aug. 30, 2023, 8:36 p.m. UTC | #1
On Wed,  8 Mar 2023 14:15:52 +0100
Sebastian Weyer <sebastian.weyer@smile.fr> wrote:

> +define NUSHELL_INSTALL_DEFAULT_CONFIG
> +	$(INSTALL) -m 0644 -D $(@D)/crates/nu-utils/src/sample_config/default_config.nu \
> +		$(TARGET_DIR)/root/.config/nushell/config.nu
> +	$(INSTALL) -m 0644 -D $(@D)/crates/nu-utils/src/sample_config/default_env.nu \
> +		$(TARGET_DIR)/root/.config/nushell/env.nu
> +endef
> +NUSHELL_POST_INSTALL_TARGET_HOOKS += NUSHELL_INSTALL_DEFAULT_CONFIG

I did not apply this patch, because it installs a configuration only
for the root user, so its usefulness seems quite limited, and we
essentially never install special configuration specifically for the
root user (there's a very old exception in the fluxbox package, but
that's it).

Thomas
diff mbox series

Patch

diff --git a/package/nushell/nushell.mk b/package/nushell/nushell.mk
index b9c1ee6434..8ac3045c9f 100644
--- a/package/nushell/nushell.mk
+++ b/package/nushell/nushell.mk
@@ -10,6 +10,14 @@  NUSHELL_LICENSE = MIT
 NUSHELL_LICENSE_FILES = LICENSE
 NUSHELL_DEPENDENCIES = host-pkgconf openssl ncurses
 
+define NUSHELL_INSTALL_DEFAULT_CONFIG
+	$(INSTALL) -m 0644 -D $(@D)/crates/nu-utils/src/sample_config/default_config.nu \
+		$(TARGET_DIR)/root/.config/nushell/config.nu
+	$(INSTALL) -m 0644 -D $(@D)/crates/nu-utils/src/sample_config/default_env.nu \
+		$(TARGET_DIR)/root/.config/nushell/env.nu
+endef
+NUSHELL_POST_INSTALL_TARGET_HOOKS += NUSHELL_INSTALL_DEFAULT_CONFIG
+
 # Add /usr/bin/nu to /etc/shells as in package/bash/bash.mk
 define NUSHELL_ADD_NU_TO_SHELLS
 	grep -qsE '^/usr/bin/nu$$' $(TARGET_DIR)/etc/shells \