I’m a very new nix user, so I’m not even sure what I’m trying to do is a good idea.
We have internal project that is currently very tied to Ubuntu, and I’d like to make it more portable. The core of the project is C++ with some Python tools and shell scripts that depend on some common command line utilities.
I’d love to nix-ify the whole thing, but one step at a time. I thought a good first start would be to create a shell.nix
for the project to provide some of the support tools we need, instead relying on sudo apt install ...
However, even the simplest nix shell environments seems to bring in gcc and the rest of the toolchain components automatically. I’d like to keep using the system compiler for the time being.
I know I could remove gcc et al from the PATH, but that seems like a kludge.
Also I thought “nativeBuildInputs” might work, but it didn’t seem to.
Here’s my shell.nix:
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/65c9cc79f1d179713c227bf447fb0dac384cdcda.tar.gz") {} }:
pkgs.mkShell {
buildInputs = [
pkgs.curl
pkgs.rsync
];
}
After I run nix-shell
or use direnv
…
$ which gcc
/nix/store/azayfhqyg9mjyv6rv9bcypi6ws8aqfmy-gcc-wrapper-9.3.0/bin/gcc
Is there a clean way to set up up a nix shell environment without overriding the gcc toolchain?