Skip to content

fix: Nix installs assume.fish to share/ but alias setup only checks bin/ #920

@pyrex41

Description

@pyrex41

Summary

When Granted is installed via Nix, the assume.fish and assume.tcsh scripts are placed in the share/ directory rather than bin/. However, the alias setup code in pkg/alias/alias.go only knows about:

  • /usr/local/bin/assume.fish (default)
  • $(brew --prefix)/bin/assume.fish (Homebrew)

This causes fish and tcsh users on Nix to get a broken alias that points to a non-existent path.

Actual paths on Nix

$ which granted
/nix/store/ga93f7hvqn2zbnkdmghy5whsmwg3vbdw-granted-0.38.0/bin/granted

$ ls /nix/store/ga93f7hvqn2zbnkdmghy5whsmwg3vbdw-granted-0.38.0/share/
assume.fish

$ ls /nix/store/ga93f7hvqn2zbnkdmghy5whsmwg3vbdw-granted-0.38.0/bin/
assume      assumego    granted

Note: bin/assume is the POSIX shell script (bash/zsh), not the fish script.

Root cause

The nixpkgs package correctly installs assume.fish to share/ (following FHS conventions), but GetFishAlias() and GetTcshAlias() in pkg/alias/alias.go don't detect Nix installations.

Fix

PR #921 adds Nix detection by checking if the granted binary is in /nix/store/, then constructs the correct path to share/assume.fish.

Environment

  • Granted version: 0.38.0
  • Shell: fish 3.x
  • Install method: Nix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions