125 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			125 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{pkgs, lib, ...}: {
 | 
						||
  programs.fish = {
 | 
						||
    enable = true;
 | 
						||
    # initExtra = ''
 | 
						||
    #   export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
 | 
						||
    # '';
 | 
						||
 | 
						||
    shellAliases = {
 | 
						||
      # ls aliases
 | 
						||
      ls = "eza --color";
 | 
						||
      la = "eza -l -all --color";
 | 
						||
      ll = "eza -l --color";
 | 
						||
      lt = "eza -l --color --git";
 | 
						||
 | 
						||
      # lazygit alias
 | 
						||
      lg = "lazygit";
 | 
						||
 | 
						||
      # cat, less, more alias
 | 
						||
      cat = "bat";
 | 
						||
      less = "bat";
 | 
						||
      more = "bat";
 | 
						||
 | 
						||
      # top alias
 | 
						||
      top = "btm";
 | 
						||
    };
 | 
						||
 | 
						||
    functions = {
 | 
						||
      fish_greeting = {
 | 
						||
        body = ''
 | 
						||
          set memes \
 | 
						||
            "Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \
 | 
						||
            "Daddy, chill!" \
 | 
						||
            "What the hell is even that?!" \
 | 
						||
            "Road work ahead? Yeah, I sure hope it does!" \
 | 
						||
            "Look at all those chickens!" \
 | 
						||
            "I smell like beef" \
 | 
						||
            "Say, Coloardo - I'M A GIRAFFE" \
 | 
						||
            "I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \
 | 
						||
            "This is the dollar store, how good can it be?" \
 | 
						||
            "That was legitness" \
 | 
						||
            "Deez nuts" \
 | 
						||
            "I wanna be a cowboy baby" \
 | 
						||
            "Can I get a waffle? Can I please get a waffle?" \
 | 
						||
            "I'm lesbian. I thought you were American." \
 | 
						||
            "You gotta give 'em that 'hawk tuah' and spit on that thang!" \
 | 
						||
            "We don't do that here..." \
 | 
						||
            "What are those?! They are my crocs..." \
 | 
						||
            "It's an avocado... Thanks!" \
 | 
						||
            "I am once again asking for your financial support" \
 | 
						||
            "Is that a weed?" \
 | 
						||
            "No, this is Patrick!" \
 | 
						||
            "Come ride, heroes, ride" \
 | 
						||
            "Away with the tide" \
 | 
						||
            "Concede your mind unto the fiend" \
 | 
						||
            "Darkness come, rend the shield of light" \
 | 
						||
            "The sun is setting, darkness taking over - a date with chaos and you're dressed to the nines" \
 | 
						||
            "Now kneel overdweller, your lord commands, there's no salvation for the sons of man" \
 | 
						||
            "Snap click clank whirr whizz wham boom!" \
 | 
						||
            "Rohs an kyn ala na" \
 | 
						||
            "If you’ve brought your ivory standard, I’ll be happy to tell you where you can stick it" \
 | 
						||
            "Speeches? Oh, yes, I love them. There's nothing like a good exposition when you're having trouble sleeping!" \
 | 
						||
            "Somehow, the boy just isn't very buoyant" \
 | 
						||
            "I am...not interested, little sun. Try again when you have become a man"
 | 
						||
 | 
						||
 | 
						||
          set choose_meme (random)"%"(count $memes)
 | 
						||
          set choose_meme $memes[(math $choose_meme"+1")]
 | 
						||
 | 
						||
          printf (set_color F90)"%s\n" $choose_meme
 | 
						||
        '';
 | 
						||
        onEvent = "fish_greeting";
 | 
						||
      };
 | 
						||
    } // lib.optionalAttrs pkgs.stdenv.isLinux {
 | 
						||
      block = {
 | 
						||
        body = ''
 | 
						||
          systemd-inhibit --what=sleep --who="$USER" --why="manual invocation" --mode=block sleep infinity &
 | 
						||
          set -g INHIBIT_PID $last_pid
 | 
						||
          echo "Sleep inhibited. PID: $INHIBIT_PID"
 | 
						||
        '';
 | 
						||
      };
 | 
						||
 | 
						||
      unblock = {
 | 
						||
        body = ''
 | 
						||
          if set -q INHIBIT_PID
 | 
						||
            kill $INHIBIT_PID 2>/dev/null
 | 
						||
            and echo "Sleep inhibitor removed. PID: $INHIBIT_PID"
 | 
						||
            or echo "Failed to kill process or already terminated."
 | 
						||
            set -e INHIBIT_PID
 | 
						||
          else
 | 
						||
            echo "No active sleep inhibitor found."
 | 
						||
          end
 | 
						||
        '';
 | 
						||
      };
 | 
						||
    };
 | 
						||
  };
 | 
						||
 | 
						||
  programs.zsh = {
 | 
						||
    enable = true;
 | 
						||
    initContent = ''
 | 
						||
      if [[ -z "$BASH_EXECUTION_STRING" ]]; then
 | 
						||
        if [[ -n "$ZSH_VERSION" ]]; then
 | 
						||
          LOGIN_OPTION="--login"
 | 
						||
        else
 | 
						||
          LOGIN_OPTION=""
 | 
						||
        fi
 | 
						||
        exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
 | 
						||
      fi
 | 
						||
    '';
 | 
						||
  };
 | 
						||
 | 
						||
  programs.bash = {
 | 
						||
    enable = true;
 | 
						||
    initExtra = ''
 | 
						||
      if [[ -z "$BASH_EXECUTION_STRING" ]]; then
 | 
						||
        if [[ -n "$ZSH_VERSION" ]]; then
 | 
						||
          LOGIN_OPTION="--login"
 | 
						||
        else
 | 
						||
          LOGIN_OPTION=""
 | 
						||
        fi
 | 
						||
        exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
 | 
						||
      fi
 | 
						||
    '';
 | 
						||
  };
 | 
						||
}
 |