I am happily using with-inputs for a non-Flake project, with npins pulling in some flakes and non-flakes, but I tried adding a flake repo that uses flake-parts and got a confusing error.
This Bash script is a minimal example that re-creates the same error:
#! /usr/bin/env bash
mkdir /tmp/test
# Set up a minimal flake-parts flake using flake-parts' init template, which exports `packages.default`
cd /tmp/test
mkdir flake-parts-hello
cd flake-parts-hello
nix --extra-experimental-features flakes flake init -t github:hercules-ci/flake-parts
git init --initial-branch main
git add . && git commit -m "init: flake-parts template"
# Create a minimal not-flake nix project using with-inputs and npins that depends on the above flake-parts-hello
cd /tmp/test
mkdir with-inputs-hello
cd with-inputs-hello
npins init
npins add github denful with-inputs --branch main
npins add git file:/tmp/test/flake-parts-hello --branch 'main'
cat << EOF > default.nix
let
sources = import ./npins;
with-inputs = import sources.with-inputs sources {};
outputs = inputs: {
packages.default = inputs.flake-parts-hello.packages.default;
};
in
with-inputs outputs
EOF
# Try running `hello` via with-inputs-hello
nix run --file default.nix 'packages.default'
The last line resulted in this error:
error:
… while evaluating an expression to select 'packages' on it
at /tmp/test/with-inputs-hello/default.nix:8:50:
7| outputs = inputs: {
8| packages.default = inputs.flake-parts-hello.packages.hello;
| ^
9| };
… while evaluating self
at /nix/store/k6vflcbgj5q5cnnfqfi4cg3pnxv5g922-source/with-inputs.nix:170:5:
169| in
170| self;
| ^
171|
(stack trace truncated; use '--show-trace' to show the full trace)
error: attribute 'lib' missing
at /nix/store/5rcpjz7wqmcw6jl7vrz1630cjiciscdc-flake-parts-hello-6acf8c7/flake.nix:10:17:
9| outputs = inputs@{ flake-parts, ... }:
10| flake-parts.lib.mkFlake { inherit inputs; } {
| ^
11| imports = [
I am happily using
with-inputsfor a non-Flake project, with npins pulling in some flakes and non-flakes, but I tried adding a flake repo that uses flake-parts and got a confusing error.This Bash script is a minimal example that re-creates the same error:
The last line resulted in this error: