Hi, I’m a bit of a noob, trying to get a workflow up an running using flakes.
I’ve got two repo’s, each with a flake.nix in it. They’re called i3f-schema
and gnize
. The goal is for gnize
to depend on i3f-schema
.
gnize
is a nim application, so I’m using GitHub - nix-community/flake-nimble: Nimble packages Nix flake [maintainer=@ehmry] to build it. Here’s its flake.nix
:
{
description = "gnize";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/22.05;
flake-utils.url = github:numtide/flake-utils;
flake-nimble.url = github:nix-community/flake-nimble;
i3f-schema = {
url = "/home/matt/src/i3f-schema";
};
};
outputs = { self, nixpkgs, flake-utils, flake-nimble, i3f-schema }:
flake-utils.lib.eachDefaultSystem (system:
let
version = "0.0.1";
pkgs = nixpkgs.legacyPackages.${system};
nimblePkgs = flake-nimble.packages.${system};
in {
packages.gnize = pkgs.nimPackages.buildNimPackage {
name = "gnize";
inherit version;
#buildInputs= [
# i3f-schema
#];
src = ./.;
};
defaultPackage = self.packages.${system}.gnize;
}
This works, I can nix build && ./result/bin/gnize
and everything seems ok. But if I comment out this part:
#buildInputs= [
# i3f-schema
#];
Then I get the following error:
error: Dependency is not of a valid type: element 1 of buildInputs for gnize
the dependency I need out of i3f-schema is a json schema file. Its flake looks like this:
{
description = "i3f-schema";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
rec {
schema = ./i3f.schema.json;
packages.i3f-schema = pkgs.stdenv.mkDerivation {
name = "i3f-schema";
builder = "${pkgs.bash}/bin/bash";
args = [
"-c"
"${pkgs.coreutils}/bin/cp ${schema} $out"
];
inherit system;
};
defaultPackage = self.packages.${system}.i3f-schema;
}
);
}
So the question is: what changes do I need to make (to either flake) so that I can reference an env var in the gnize build which points me at the schema file in the nix store?
I’m not attached to buildInputs
but it would seem that that’s related to how flake-nimble is going to want non-nim dependencies.