1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-02 16:09:46 +01:00
home-manager/modules/programs/nix-your-shell.nix
nicoo f2665c346f nix-your-shell: support arbitrary CLI arguments
Useful to implement higher-level (and more ergonomic) options
2024-08-19 09:52:55 +00:00

36 lines
1,015 B
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.programs.nix-your-shell;
exe = lib.getExe pkgs.nix-your-shell;
args = lib.concatStringsSep " " cfg.extraArgs;
mkShellAliases = 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.
'';
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";
ion.shellAliases = mkShellAliases "ion";
nushell.shellAliases = mkShellAliases "nushell";
zsh.shellAliases = mkShellAliases "zsh";
};
}