34 lines
671 B
Nix
Executable file
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";
|
|
})
|
|
);
|
|
};
|
|
}
|
|
|