tweag / opam-nix

Turn opam-based OCaml projects into Nix derivations
MIT License
111 stars 33 forks source link

Naive failure from flake init templates? #36

Closed AlexMouton closed 1 year ago

AlexMouton commented 1 year ago

Describe the bug Hi Folks. Hoping its just me, but running the flake init command, changing the package string, I next get:

error: attribute '<package-name>' missing

       at /nix/store/b39yb2zy2ikm70yicc9i029xknhh6wjj-source/flake.nix:31:24:

           30|           # You can add overrides here
           31|           ${package} = prev.${package}.overrideAttrs (_: {

To Reproduce nix flake init -t github:tweag/opam-nix#executable

nix develop **Environment** - OS name + version: nixos-unstable w nix 2.11.1 - Version of the code: unsure.
balsoft commented 1 year ago

What did you change the package name to?

It seems to work on my end.

AlexMouton commented 1 year ago

let package = "aaa";

balsoft commented 1 year ago

Is there a corresponding aaa.opam file? (or an opam file with name: "aaa")

AlexMouton commented 1 year ago

ah nope. i was trying to start from zero. Thats likely my problem. thanks!

balsoft commented 1 year ago

Yeah, the templates are for packaging an already existing opam package. I think that fact should be mentioned somewhere :)

AlexMouton commented 1 year ago

The group of people that have heard of ocaml and nix but used neither may be your largest audience in the short term =)

Thanks for your time

balsoft commented 1 year ago

I have added a note about this in the README: https://github.com/tweag/opam-nix/commit/4bb1a4c372f639f44fc6745f13c86f4397e82d34