Use fish instead of bash as default shell
This commit is contained in:
parent
c258230d74
commit
9d2272b3df
@ -14,6 +14,9 @@ in
|
||||
description = "Whether home-manager is running inside a NixOS system or not.";
|
||||
};
|
||||
|
||||
shell = mkOpt' str null "User's shell (so NixOS or others can set it externally).";
|
||||
fishCompletionsFrequency = mkOpt' (nullOr str) "daily" "How often to generate fish completions from manpages.";
|
||||
|
||||
ssh = {
|
||||
authKeys = {
|
||||
literal = mkOpt' (listOf singleLineStr) [ ] "List of OpenSSH keys to allow";
|
||||
@ -42,6 +45,8 @@ in
|
||||
my = {
|
||||
isStandalone = !(args ? osConfig);
|
||||
|
||||
shell = mkDefault "${config.programs.fish.package}/bin/fish";
|
||||
|
||||
ssh = {
|
||||
matchBlocks = {
|
||||
nix-dev-vm = {
|
||||
@ -99,7 +104,10 @@ in
|
||||
};
|
||||
|
||||
bash = {
|
||||
# This not only installs bash but has home-manager control .bashrc and friends
|
||||
# This does not install bash but has home-manager control .bashrc and friends
|
||||
# Bash has some really weird behaviour with non-login and non-interactive shells, particularly around which
|
||||
# of profile and bashrc are loaded when. This causes issues with PATH not being set correctly for
|
||||
# non-interactive SSH...
|
||||
enable = mkDefault true;
|
||||
initExtra =
|
||||
''
|
||||
@ -107,6 +115,25 @@ in
|
||||
cd "$(nix eval "''${@:2}" --impure --raw --expr "builtins.getFlake \"$1\"")"
|
||||
}
|
||||
'';
|
||||
shellAliases = {
|
||||
hm = "home-manager";
|
||||
};
|
||||
};
|
||||
|
||||
fish = {
|
||||
enable = mkDefault true;
|
||||
functions = {
|
||||
# Silence the default greeting
|
||||
fish_greeting = ":";
|
||||
flake-src = {
|
||||
description = "cd into a flake reference's source directory";
|
||||
body = ''cd (nix eval $argv[2..] --impure --raw --expr "builtins.getFlake $argv[1]")'';
|
||||
};
|
||||
};
|
||||
shellAbbrs = {
|
||||
hm = "home-manager";
|
||||
k = "kubectl";
|
||||
};
|
||||
};
|
||||
|
||||
ssh = {
|
||||
@ -161,9 +188,6 @@ in
|
||||
sessionVariables = {
|
||||
EDITOR = "vim";
|
||||
};
|
||||
shellAliases = {
|
||||
hm = "home-manager";
|
||||
};
|
||||
|
||||
language.base = mkDefault "en_IE.UTF-8";
|
||||
};
|
||||
@ -192,5 +216,31 @@ in
|
||||
];
|
||||
};
|
||||
})
|
||||
(mkIf pkgs.stdenv.isLinux (mkMerge [
|
||||
(mkIf (config.my.isStandalone && config.programs.fish.enable && config.my.fishCompletionsFrequency != null) {
|
||||
systemd.user = {
|
||||
services.fish-update-completions = {
|
||||
Unit.Description = "fish completions update";
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${config.programs.fish.package}/bin/fish -c fish_update_completions";
|
||||
};
|
||||
};
|
||||
|
||||
timers.fish-update-completions = {
|
||||
Unit.Description = "fish completions update timer";
|
||||
|
||||
Timer = {
|
||||
OnCalendar = config.my.fishCompletionsFrequency;
|
||||
Persistent = true;
|
||||
Unit = "fish-update-completions.service";
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
})
|
||||
]))
|
||||
];
|
||||
}
|
||||
|
@ -24,6 +24,11 @@ in
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
system = {
|
||||
stateVersion = "21.11";
|
||||
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
# Installs packages in the system config instead of in the local profile on activation
|
||||
useUserPackages = mkDefault true;
|
||||
@ -105,6 +110,12 @@ in
|
||||
vim
|
||||
];
|
||||
|
||||
programs = {
|
||||
# This will enable generating completions at build time and prevent home-manager fish from generating them
|
||||
# locally
|
||||
fish.enable = mkDefault true;
|
||||
};
|
||||
|
||||
services = {
|
||||
kmscon = {
|
||||
# As it turns out, kmscon hasn't been updated in years and has some bugs...
|
||||
@ -124,11 +135,6 @@ in
|
||||
passwordAuthentication = mkDefault false;
|
||||
};
|
||||
};
|
||||
|
||||
system = {
|
||||
stateVersion = "21.11";
|
||||
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
||||
};
|
||||
}
|
||||
(mkIf config.services.kmscon.enable {
|
||||
fonts.fonts = with pkgs; [
|
||||
|
@ -32,6 +32,9 @@ in
|
||||
uid = mkDefault 1000;
|
||||
extraGroups = mkDefault [ "wheel" ];
|
||||
password = mkDefault "hunter2"; # TODO: secrets...
|
||||
shell =
|
||||
let shell = cfg.homeConfig.my.shell;
|
||||
in mkIf (shell != null) (mkDefault' shell);
|
||||
openssh.authorizedKeys.keyFiles = [ lib.my.authorizedKeys ];
|
||||
};
|
||||
# In order for this option to evaluate on its own, home-manager expects the `name` (which is derived from the
|
||||
|
Loading…
Reference in New Issue
Block a user