nixos/modules/nixos/shells/fish.nix
2026-01-11 01:42:54 +00:00

34 lines
671 B
Nix
Executable file

{ config
, lib
, pkgs
, ...
}:
let
cfg = config.custom.shells.fish;
in
{
options.custom.shells.fish = {
enable = lib.mkEnableOption "Enable the Fish shell.";
defaultFor = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "Users to set Fish as their default shell. If set the shell must be enabled.";
};
};
config = {
# Actually enable and assign the shell
programs = lib.mkIf cfg.enable {
fish.enable = true;
};
users.users = lib.mkIf cfg.enable (
lib.genAttrs cfg.defaultFor (user: {
shell = lib.mkOverride 900 "${pkgs.fish}/bin/fish";
})
);
};
}