1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

nix-your-shell: support arbitrary CLI arguments

Useful to implement higher-level (and more ergonomic) options
This commit is contained in:
nicoo 2024-08-19 09:44:43 +00:00
parent 4e0c6a7e4e
commit f2665c346f

View file

@ -3,17 +3,29 @@ let
cfg = config.programs.nix-your-shell;
exe = lib.getExe pkgs.nix-your-shell;
args = lib.concatStringsSep " " cfg.extraArgs;
mkShellAliases = shell: {
nix = "${exe} ${shell} nix --";
nix-shell = "${exe} ${shell} nix-shell --";
nix = "${exe} ${args} ${shell} nix --";
nix-shell = "${exe} ${args} ${shell} nix-shell --";
};
in {
meta.maintainers = with lib.maintainers; [ nicoo ];
options.programs.nix-your-shell.enable = lib.mkEnableOption ''
`nix-your-shell`, a wrapper for `nix develop` or `nix-shell`
to run the same shell inside the new environment.
'';
options.programs.nix-your-shell = {
enable = lib.mkEnableOption ''
`nix-your-shell`, a wrapper for `nix develop` or `nix-shell`
to run the same shell inside the new environment.
'';
extraArgs = lib.mkOption {
default = [ ];
description = ''
additional command-line arguments, to be passed to `nix-your-shell`
'';
type = with lib.types; listOf str;
};
};
config.programs = lib.mkIf cfg.enable {
fish.shellAliases = mkShellAliases "fish";