Skip to content

Basic Guide Error #209

@c4lliope

Description

@c4lliope

(copied here from Matrix, happy to discuss there if anyone's online this week)

hello - I'm seeing an odd error as I go through the basic guide:
https://github.com/rustshop/flakebox/blob/master/docs/building-new-project.md#extra-dependencies

➜ hx flake.nix; nd nix build .#gitoxide
warning: Git tree '/home/calliope/disc/nvme0n1p6/code/gitoxidelabs/gitoxide' is dirty
error:
       … while evaluating the attribute 'devShells'
         at /nix/store/kwpljf3n2xlxlrq5k0p02c6kghc4n6ca-source/flake.nix:56:7:
           55|       packages.default = legacyPackages.gitoxide;
           56|       devShells = flakeboxLib.mkShells {
             |       ^
           57|         packages = [ ];

       … while evaluating the attribute 'lib.x86_64-linux'
         at /nix/store/qrv62r966lcw0pmivndiqibn24swahzy-source/flake.nix:54:7:
           53|
           54|       lib = {
             |       ^
           55|         inherit mkLib;

       error: attribute 'x86_64-linux' missing
       at /nix/store/kwpljf3n2xlxlrq5k0p02c6kghc4n6ca-source/flake.nix:34:21:
           33|       pkgs = import nixpkgs { system = arch; };
           34|       flakeboxLib = flakebox.lib.${arch} { };
             |                     ^
           35|

why would flakebox.lib.x86_64-linux be missing?

Here is the flake.nix that I am adding to https://github.com/gitoxideLabs/gitoxide
(Using other approaches I fell into the same problematic dependencies you chose - openssl and libsqlite3-sys).
I'll read up on how to use Crane manually but flakebox may be a nicer place to begin. I hope to learn more.

{
  description = "`gitoxide` compiled in a nix shell, using `crane` and `flakebox`.";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05";
    flake-utils.url = "github:numtide/flake-utils";
    flakebox = {
      url = "github:rustshop/flakebox";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, flakebox, flake-utils }:
    flake-utils.lib.eachDefaultSystem (arch: let
      pkgs = import nixpkgs { system = arch; };
      flakeboxLib = flakebox.lib.${arch} { };

      rustSrc = flakeboxLib.filterSubPaths {
        root = builtins.path { name = "gitoxide"; path = ./.; };
        paths = [ "Cargo.toml" "Cargo.lock" ".cargo" "src" ];
      };

      legacyPackages = (flakeboxLib.craneMultiBuild { }) (craneLib': let
          craneLib = with pkgs; (craneLib'.overrideArgs {
            pname = "gitoxide";
            src = rustSrc;
            buildInputs = [ openssl.dev ];
            nativeBuildInputs = [ pkg-config ];
          });
        in rec {
          workspaceDeps = craneLib.buildWorkspaceDepsOnly { };
          workspaceBuild = craneLib.buildWorkspace { cargoArtifacts = workspaceDeps; };
          gitoxide = craneLib.buildPackage { };
        });
    in {
      inherit legacyPackages;
      packages.default = legacyPackages.gitoxide;
      devShells = flakeboxLib.mkShells {
        packages = [ ];
      };
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions