Fish alias added by NixOS, can't delete

I am running unstable. In my configuration.nix i added the following:

`environment.systemPackages = with pkgs; [
…(unrelated packages)…
]; = true; = true;`

I built the configuration (switch) without errors.

Thereafter, fish showed an error regarding cat so i commented the following entries and ran the configuration again (switch).

fishPlugins.grc grc fishPlugins.done

However, NixOS added 3 aliases to /etc/fish/ and i can’t delete them, because the file is read only:

alias l 'ls -alh' alias ll 'ls -l' alias ls 'ls --color=tty'

How can i delete these aliases? Why were they added in the first place?

What I have in configuration.nix is this:

environment.shellAliases = {
    l = null;
    ls = null;
    ll = null;

These are the only aliases added by the nix AFAIK.

Adding = {} may also work, but that is for fish only. The environment.shellAliases is for all the shells and I prefer that.

Thank you for the suggestion and your quick reply!

I added

environment.shellAliases = {}; = {};

but the aliases are still there.

1 Like

I remember that setting environment.shellAliases = {}; didn’t work, I had to manually set every alias to null. Try forcing the value like this environment.shellAliases = lib.mkForce {};?

When compiling it says building the system configuration... error: undefined variable 'lib'

Yes, you have to include it in the top of the file. Change the line{ config, pkgs, ... }: to { config, pkgs, lib, ... }:

And I just made the change in my configuration, and lib.mkForce {} does the job.

That worked. Thanks for your help! :grinning:

1 Like