home/nil: Switch shell to Nushell

This commit is contained in:
Mikael 2024-09-27 18:31:12 +02:00
parent 24815bf465
commit beccdbf549
Signed by: mikael
SSH key fingerprint: SHA256:21QyD2Meiot7jOUVitIR5YkGB/XuXdCvLW1hE6dsri0
2 changed files with 46 additions and 8 deletions

View file

@ -30,12 +30,6 @@ in {
home.stateVersion = "24.11"; home.stateVersion = "24.11";
home.enableNixpkgsReleaseCheck = false; home.enableNixpkgsReleaseCheck = false;
home.activation = {
fish = lib.hm.dag.entryAfter ["writeBoundary"] ''
run ${lib.getExe config.programs.fish.package} -c 'set -U fish_greeting'
'';
};
home.packages = with pkgs; [ home.packages = with pkgs; [
# Terminfo # Terminfo
kitty.terminfo kitty.terminfo
@ -306,6 +300,51 @@ in {
''; '';
}; };
programs.nushell = {
enable = true;
envFile.text = ''
load-env {
PROMPT_COMMAND: {
let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) {
null => $env.PWD
"" => '~'
$relative_pwd => ([~ $relative_pwd] | path join)
}
[
(if (is-admin) { ansi red_bold } else { ansi green_bold })
(sys host | get hostname)
(char space)
(ansi blue_bold)
($dir | path split | last)
(ansi reset)
(char space)
] | str join
}
PROMPT_COMMAND_RIGHT: {
let duration = $env.CMD_DURATION_MS | into int
if $duration >= 2000 {
[ (ansi light_red) ($duration | into duration --unit ms) ] | str join
}
}
PROMPT_INDICATOR: { " " }
SSH_AUTH_SOCK: $"($env.XDG_RUNTIME_DIR)/ssh-agent"
TMPDIR: $"($env.XDG_RUNTIME_DIR)/tmp"
}
'';
configFile.text = ''
$env.config = {
show_banner: false
use_kitty_protocol: true
};
'';
};
services.ssh-agent.enable = true; services.ssh-agent.enable = true;
systemd.user.tmpfiles.rules = [ systemd.user.tmpfiles.rules = [

View file

@ -14,7 +14,6 @@ in {
(pkg: builtins.elem (lib.getName pkg) [ "obsidian" ]); (pkg: builtins.elem (lib.getName pkg) [ "obsidian" ]);
programs.dconf.enable = lib.mkIf graphical true; programs.dconf.enable = lib.mkIf graphical true;
programs.fish.enable = true;
services.udev.packages = [ services.udev.packages = [
(pkgs.writeTextDir "/etc/udev/rules.d/98-user-power-supply.rules" '' (pkgs.writeTextDir "/etc/udev/rules.d/98-user-power-supply.rules" ''
@ -48,7 +47,7 @@ in {
users.users.nil = { users.users.nil = {
isNormalUser = true; isNormalUser = true;
shell = config.programs.fish.package; shell = pkgs.nushell;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAICczPHRwY9MAwDGlcB0QgMOJjcpLJhVU3covrW9RBS62AAAABHNzaDo= primary" "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAICczPHRwY9MAwDGlcB0QgMOJjcpLJhVU3covrW9RBS62AAAABHNzaDo= primary"