divnix / std

A DevOps framework for the SDLC with the power of Nix and Flakes. Good for keeping deadlines!
https://std.divnix.com
377 stars 41 forks source link

`harvest` is not pulling in packages from extrenous nixpkgs library #379

Closed ironman820 closed 1 month ago

ironman820 commented 1 month ago

I have a hive setup that I'm trying to install an older version of openssh. I am getting an error that the input I'm using does not have the package I know to be there. I have recreated this in a simple flake to ensure it's not a hive or other dependency error:

flake.nix:

{
  description = "Testing package import in plain std";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixpkgs-2311.url = "github:nixos/nixpkgs/nixos-23.11";
    std = {
      inputs.nixpkgs.follows = "nixpkgs";
      url = "github:divnix/std";
    };
  };
  outputs = {std, ...} @ inputs:
    std.growOn {
      inherit inputs;
      cellsFrom = ./nix;
      cellBlocks = with std.blockTypes; [
        (installables "packages")
      ];
    }
    {
      packages = std.harvest inputs.self [["mine" "packages"]];
    };
}

nix/mine/packages.nix:

{
  cell,
  inputs,
}: let
  inherit (inputs) nixpkgs-2311;
in {
  inherit (nixpkgs-2311) openssh;
}

Output:

openssh-test on  main [+]
❯ nix flake check
warning: Git tree '/home/ironman/git/openssh-test' is dirty
warning: unknown flake output '__functor'
error:
       … while checking flake output 'packages'

         at «none»:0: (source not available)

       … while checking the derivation 'packages.x86_64-linux.openssh'

         at /nix/store/ynqdg2nyw8lblmk8186djh7r4nlqz0ly-nix/mine/packages.nix:7:25:

            6| in {
            7|   inherit (nixpkgs-2311) openssh;
             |                         ^
            8| }

       error: attribute 'openssh' missing

       at /nix/store/ynqdg2nyw8lblmk8186djh7r4nlqz0ly-nix/mine/packages.nix:6:5:

            5|   inherit (inputs) nixpkgs-2311;
            6| in {
             |     ^
            7|   inherit (nixpkgs-2311) openssh;

If I replace nixpkgs-2311 with my unstable reference, nixpkgs, the flake evaluates just fine.

ironman820 commented 1 month ago

I apologize... RTFD, found it in the pkgs block type and got it working.