hisusqristos / nix-config

reviews are welcome
0 stars 0 forks source link

ailases with/in fish shell #7

Closed hisusqristos closed 1 year ago

hisusqristos commented 1 year ago

the aliases put while running bash dont work with fish. gotta fix that, sick of typing every single charactr

antaranyan commented 1 year ago

what aliases? (knerek)

hisusqristos commented 1 year ago

ncg for nix-collect-garbage -d oriank. listgen for nix-env --list-generations

hisusqristos commented 1 year ago

02/06/31:

this method failed

environment.interactiveShellInit = ''
  alias listgen='nix-env --list-generations'
'';

i needed to disqualify it officially, because last time it failed i hadent set fish as default shell declaratively. this time i have, so the method seemed workable.

then i thought to myself. if it works with bash, apa it can work if i switch to fish before declaring aliases. and i tried this

environment.interactiveShellInit = ''
  fish && alias listgen='nix-env --list-generations'
'';

still no results. the problem is in fish && alias listgen='nix-env --list-generations'. when you run it, it switches to fish and leaves the alias in bash. guess, if there was a command <didnt search, dont know> that would declare a fish alias from bash - things may work. schrodinger once said

you're never sure about specific command-line prompt existence unless you search for it

then i entered home manager (stari dobri) and wrote this code block.

programs.fish.shellAliases = {
      listgen = "nix-env --list-generations";
      ngc = "nix-collect-garbage -d";
    };

the building process went normal. tho no result.

m? : nyet why: idk what to read any links: im not sure. still

antaranyan commented 1 year ago

then i entered home manager (stari dobri) and wrote this code block.

programs.fish.shellAliases = {
      listgen = "nix-env --list-generations";
      ngc = "nix-collect-garbage -d";
    };

the building process went normal. tho no result.

Seems correct as I check original examples at nix home-manager module for fish

{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.programs.fish;

...

in {

    programs.fish = {
      enable = mkEnableOption "fish, the friendly interactive shell";

      shellAliases = mkOption {
        type = with types; attrsOf str;
        default = { };
        example = literalExpression ''
          {
            g = "git";
            "..." = "cd ../..";
          }
        '';
        description = ''
          An attribute set that maps aliases (the top level attribute names
          in this option) to command strings or directly to build outputs.
        '';
      };
...

Not that I know how it really works, please keep posted when you find out

hisusqristos commented 1 year ago

ah.. thanks, gotta enable it first shtoli

hisusqristos commented 1 year ago

got this one as well!!

tl;dr: nix gives brilliant error messages, please read before trying to fix.

after enabling fish in home manager, it gave me another unsuccessful rebuild. with an error message similar to this.

without understanding the issue i hurried to paste the suggested command. and it didnt work. because the message of the error was telling me to delete one fish-config file to move on. after following the order it worked. like it should have. oui oui