Add nix shell
detection to tide
This commit is contained in:
parent
a4acdec715
commit
091897fbca
|
@ -1,10 +1,17 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./tide/nix-shell.nix
|
||||
];
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
package = pkgs.unstable.fish;
|
||||
functions = {
|
||||
functions = { };
|
||||
|
||||
tide = {
|
||||
nix-shell.enable = true;
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
|
@ -18,6 +25,13 @@
|
|||
today = "date +%F";
|
||||
};
|
||||
|
||||
shellInit = ''
|
||||
# Source brew integration
|
||||
if test -e /opt/homebrew/bin/brew
|
||||
/opt/homebrew/bin/brew shellenv | source
|
||||
end
|
||||
'';
|
||||
|
||||
interactiveShellInit = ''
|
||||
set fish_greeting
|
||||
|
||||
|
|
21
home/fish/tide/nix-shell.nix
Normal file
21
home/fish/tide/nix-shell.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.fish.tide.nix-shell;
|
||||
in
|
||||
{
|
||||
options.programs.fish.tide.nix-shell = {
|
||||
enable = mkEnableOption "An indicator of having a `nix shell` environment";
|
||||
};
|
||||
|
||||
config.programs.fish = mkIf cfg.enable {
|
||||
functions._tide_item_nix_shell = ''
|
||||
if string match -q "/nix/store/*" $PATH
|
||||
set -U tide_nix_shell_color blue
|
||||
set -U tide_nix_shell_bg_color normal
|
||||
_tide_print_item nix_shell "❄"
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue