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

feat: add buildOverrides, and initial moveline-nvim build step #117

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

redxtech
Copy link
Contributor

i had to point it to a forked repo here, since the upstream doesn't have a cargo.lock file.

if you'd like me to handle that a different way, let me know

@redxtech
Copy link
Contributor Author

Ok, this looks like I'm going to have to do a bit of work before it builds.

I've set it up, but yeah, none of the plugin attributes that are being overridden in overrides.nix exist when the cleanup function is called.

When importing from the flake directly, you can consume the working package. But yeah, I think the way that you go about the plugin cleanup might need to be changed to account for the overrides file?

For what it's worth, the cleanup command (nix run .#update-vim-plugins -- cleanup) works fine and without errors. I think that it breaks when moving the vim-plugins.nix during the backup stage.

@jooooscha
Copy link
Member

Regarding the missing lock file:
I think we should generate the lock file during the compilation step. That would make updating the plugin much easier.
I got it running with this:

moveline-lib = rustPlatform.buildRustPackage {
  inherit (old) src;
  inherit (old) version;
  pname = "moveline-lib";
  cargoHash = "sha256-mA17kKigR5CaZoFY/Do7kJmQCxU8+JJY0uB6FvSM+7I=";
  buildInputs = [ final.pkgs.cargo ];
  prePatch = ''
    cargo generate-lockfile
  '';
};

I've set it up, but yeah, none of the plugin attributes that are being overridden in overrides.nix exist when the cleanup function is called.

I am not sure what you mean by this.
I added moveline to NixNeovim (branch: add-moveline), as this is the intended way of using NixNeovimPlugins. But it does not compile yet.
I am not sure yet why.

It seems like neovim does not find the plugin, and I am not sure where which files would have to be.
The config I tried now is this:

  buildOverrides = self: super: {
    moveline-nvim = super.moveline-nvim.overrideAttrs (old: {
      buildInputs = [ final.pkgs.cargo ];
      postInstall = let
        moveline-lib = rustPlatform.buildRustPackage {
          inherit (old) src;
          inherit (old) version;
          pname = "moveline-lib";
          cargoHash = "sha256-mA17kKigR5CaZoFY/Do7kJmQCxU8+JJY0uB6FvSM+7I=";
          buildInputs = [ final.pkgs.cargo ];
          prePatch = ''
            cargo generate-lockfile
          '';
          postInstall = old.postInstall + ''
            mkdir -p $out/deps
            mv target/x86_64-unknown-linux-gnu/release/deps $out/deps
          '';
        };
      in ''
        mkdir -p lua/moveline
        ln -s ${moveline-lib}/lib/libmoveline.so lua/moveline.so
        ln -s ${moveline-lib}/deps lua/deps
     ';
    });

    # which-key-nvim = super.which-key-nvim.overrideAttrs (old: {
    #   postInstall = ''
    #     ls $out
    #     echo ---
    #     ls $out/lua/which-key
    #     exit 1
    #   '';
    # });
  };

The which-key is only for comparison

@redxtech
Copy link
Contributor Author

If you look at the logs of the failed action workflow, it says that the plugins being overridden in the overrides.nix file don't exist. I believe this is due to the update plugins action moving the vim-plugins.nix file, and putting an empty nix function in its place.

When consuming the plugin normally (importing to my own neovim config), everything works as expected. It's just the update plugins workflow that has issues. I think we'd have to either change how the update workflow works somewhat, but I'm not sure where to start with that.

@jooooscha
Copy link
Member

The workflow not running is expected. I tried to compile it locally, with the NixNeovimPlugins repo being overwritten.

Did you use the config above, or did you just add the plugin package to your NixNeovim config?

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

Successfully merging this pull request may close these issues.

2 participants