[SOLVED] Make application available under a different name

Here’s the flake I use to work on a Python project:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = {
    self,
    nixpkgs,
  }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      system = system;
      config.allowUnfree = true;
    };
    # nixpkgs.legacyPackages.${system};
    fhs = pkgs.buildFHSUserEnv {
      name = "python311";
      targetPkgs = pkgs: [
        pkgs.gcc.cc
        pkgs.glibc
        pkgs.zlib
        pkgs.python311
        pkgs.chromedriver
        pkgs.google-chrome
      ];
      runScript = "zsh";
    };
  in {
    devShells.${system}.default = fhs.env;
  };
}

As you can see, I use an FHS-compliant shell for this. Now the issue:
My python test suite expects an executable called google-chrome, but installed with nix packages I end up with a binary that is called google-chrome-stable.

Is there a way to have it appear under a different name? I tried creating a symbolic link, but that is (could have known) not possible within the shell. Any idea?

I truly appreciate any tips!

Simon

One way to create a symlink in the FHS would be to add another package with the symlink:

(pkgs.runCommand "symlink-to-chrome" {} ''
  mkdir -p $out/bin
  ln -s ${pkgs.google-chrome}/bin/google-chrome-stable $out/bin/google-chrome
'')
4 Likes

Works like a charm! Thank you so much for helping me out.

1 Like