I’ve written the following flake.nix
file:
{
description = "Just a C++ project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
};
outputs = {
self, nixpkgs
}: let
system = "x86_64-linux";
in {
defaultPackage.${system} =
with import nixpkgs {inherit system;};
stdenv.mkDerivation {
name = "dummy-project";
version = "v1.0.0";
src = ./.;
nativeBuildInputs = [ cmake ];
buildInputs = [
dummy-dependency # this causes me a headache
gtest
];
};
};
}
As you can see, this flake has a dependency on dummy-dependency
. Since dummy-dependency
is a company internal dependency, I can’t make it public through git or even publish it to the nixpkgs directory so it is built locally from a locally cloned repository (I know, not ideal, but it’s a first step in testing this package manager without too much work).
The dummy-dependency
repository has a default.nix
file writte by me, which looks like this:
with import <nixpkgs> {};
stdenv.mkDerivation {
pname = "dummy-dependency"
version = "1.0.0";
src = ./.;
system = "x86_64-linux";
nativeBuildInputs = [
cmake
];
buildInputs = [
boost
gtest
];
}
This package has been built using nix build
and it seems like the files have landed correctly in the /nix/store/
directory.
$ find /nix/store/ -type d -name "*dummy-dependency*" -print
/nix/store/l52xdhnbh7l1pd9vzlavwjp9kw7db16h-dummy-dependency
/nix/store/pyfba247zhs377plyy2kkd1vxvc1xsj0-dummy-dependency
/nix/store/6vvd6v3kiascqcb58zb1xch2vk00ians-dummy-dependency
Although building the initially mentioned flake (first field), throws the following error:
error: undefined variable 'dummy-dependency'
How does one build and install packages locally without having to upload / make them public, and at the same time be able to import them as dependencies for further projects?