I want to use gnu-cobol in a devShell so I created the following flake:
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
outputs = {nixpkgs, ...}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in {
devShells.${system}.default = pkgs.mkShell {
packages = [pkgs.gnu-cobol];
shellHook = ''
ls ${pkgs.gnu-cobol} # contains a bin directory
ls ${pkgs.gnu-cobol}/bin # contains a cobc executable
${pkgs.gnu-cobol}/bin/cobc # works
cobc # cobc not found
'';
};
};
}
$ nix develop --ignore-environment
bin share
cobc cob-config cobcrun
cobc: error: no input files
cobc: command not found
This however doesn’t allow me to run cobc in the shell.
Adding export PATH=${pkgs.gnu-cobol}/bin:$PATH
to the shellHook would solve the issue however that seems like a hack.
I thought that a devShell includes the /bin
directory from each package automatically.