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:
parent
4e0c6a7e4e
commit
f2665c346f
1 changed files with 18 additions and 6 deletions
|
@ -3,17 +3,29 @@ let
|
||||||
cfg = config.programs.nix-your-shell;
|
cfg = config.programs.nix-your-shell;
|
||||||
|
|
||||||
exe = lib.getExe pkgs.nix-your-shell;
|
exe = lib.getExe pkgs.nix-your-shell;
|
||||||
|
args = lib.concatStringsSep " " cfg.extraArgs;
|
||||||
|
|
||||||
mkShellAliases = shell: {
|
mkShellAliases = shell: {
|
||||||
nix = "${exe} ${shell} nix --";
|
nix = "${exe} ${args} ${shell} nix --";
|
||||||
nix-shell = "${exe} ${shell} nix-shell --";
|
nix-shell = "${exe} ${args} ${shell} nix-shell --";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.maintainers; [ nicoo ];
|
meta.maintainers = with lib.maintainers; [ nicoo ];
|
||||||
|
|
||||||
options.programs.nix-your-shell.enable = lib.mkEnableOption ''
|
options.programs.nix-your-shell = {
|
||||||
`nix-your-shell`, a wrapper for `nix develop` or `nix-shell`
|
enable = lib.mkEnableOption ''
|
||||||
to run the same shell inside the new environment.
|
`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 {
|
config.programs = lib.mkIf cfg.enable {
|
||||||
fish.shellAliases = mkShellAliases "fish";
|
fish.shellAliases = mkShellAliases "fish";
|
||||||
|
|
Loading…
Reference in a new issue