How to set startup script in Fish shell using home-manager?

I am running Debian with home-manager.

I want to run a script when the Fish shell starts. It is usually placed at ~/.config/fish/conf.d/ but how do I do it with home-manager?

What I tried: = mkOption {
        type = types.lines;
        default = "fnm env --use-on-cd | source";
        description = ''
          Shell script code called during interactive fish shell

But it gives the following error:

❯ home-manager switch
error: undefined variable 'mkOption'

       at /home/user/.config/nixpkgs/home.nix:71:48:

           71| = mkOption {
             |                                                ^
           72|     type = types.lines;
(use '--show-trace' to show detailed location information)

Basically I am tring to setup fnm for fish shell.

That’s how you would create a completely new option. You’d also have to make mkOption available from nixpkgs’ lib to do this.

But this option already exists: Appendix A. Configuration Options

Just set it: = ''
  fnm env --use-on-cd | source
1 Like