Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please expand on usage documentation #54

Open
AidanWelch opened this issue Jun 8, 2024 · 7 comments
Open

Please expand on usage documentation #54

AidanWelch opened this issue Jun 8, 2024 · 7 comments

Comments

@AidanWelch
Copy link

For me(and I assume others new to Nix), adding the flake as an input is fine, but I don't understand how to actually add and use the Zig package.

@Yappaholic
Copy link

For me(and I assume others new to Nix), adding the flake as an input is fine, but I don't understand how to actually add and use the Zig package.

You can check my latest pull request, I described in the README on how to add zig as a package

@adihodos
Copy link

adihodos commented Jun 27, 2024

I'm trying to use this in a flake like this:

{
  description = "A devShell example";

  inputs = {
    nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";

    flake-utils.url = "github:numtide/flake-utils";
    zig-overlay = {
      url = "github:mitchellh/zig-overlay";
    };
  };

  outputs = {
    self,
    nixpkgs,
    zig-overlay,
    flake-utils,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (
      system: let
        overlays = [(import zig-overlay)];
        pkgs = import nixpkgs {
          inherit system overlays;
        };
      in {
        devShells.default = with pkgs;
          mkShell {
            buildInputs = [
              openssl
              pkg-config
              eza
              fd
              zig
            ];

            shellHook = ''
              alias ls=eza
              alias find=fd
            '';
          };
      }
    );
}

This is the error I get when I do nix develop :

error:
       … <borked>

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

       … while evaluating a branch condition

         at /nix/store/bi5zxc0v5g6ylygdwyqzh280sccg3ykb-source/pkgs/stdenv/booter.nix:99:7:

           98|     thisStage =
           99|       if args.__raw or false
             |       ^
          100|       then args'

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: infinite recursion encountered

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

I really can't figure out what I'm doing wrong, I took this rust overlay as a model.

@Yappaholic
Copy link

Can't tell about infinite recursion problem, but shouldn't you use zig instead of zig-overlay in the outputs section?

@Lumesque
Copy link

Is the infinite recursion due to overlays being [(import zig-overlay)] instead of

overlays = [
  (final: prev: {
    zigpkgs = inputs.zig.packages.${prev.system};
  })
];

? That's what fixed it when I ran into a similar problem on my end but idk if it's diff

@DeusFerrariis
Copy link

Use in flakes works with

overlays = [
  zig-overlay.overlays.default
];

Naming the input zig or zig-overlay does not affect this but it does feel redundant imho.

Source #56.

@xsova
Copy link

xsova commented Nov 12, 2024

To import rust-overlay, I have outputs.darwinConfigurations.system.modules = [ inputs.rust-overlay.overlays.default ]; is that how this is supposed to be added?

i.e., outputs.darwinConfigurations.system.modules = [ inputs.zig-overlay.overlays.default ]; ? I tried this but it didn't seem to work.. But since my outputs = inputs: {}; I don't specify inputs that are included in outputs- so I'm a little confused about how to make sure it's added correctly. I ended up here because I am getting build failure on zig 0.12.1.

error: builder for '/nix/store/3rk0087834db989abrfi2rmkarr20132-zig-0.12.1.drv' failed with exit code 2;
       last 25 log lines:
       >     note: tried /nix/store/4s8z8il6zyq77ixy4b8kfzwsnz90vsrm-apple-sdk-11.3/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/system/libsystem_symptoms.dylib
       > error: unable to resolve dependency

so I was hoping this would fix it lol

@Yappaholic
Copy link

@xsova After doing an import do you call zig package by zigpkgs?

From the official README:

overlays.default is an overlay that adds zigpkgs to be the packages exposed by this flake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants