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

Improve nix flake #1557

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Improve nix flake #1557

wants to merge 1 commit into from

Conversation

lluchs
Copy link

@lluchs lluchs commented Dec 6, 2024

This fixes the nix flake (it didn't work with current nixpkgs since the old libdwarf was removed and some Python trouble) and implements some improvements:

  • The plugin configuration can be overwritten by flake consumers and the flake can reduce the dependencies accordingly.
  • PyPANDA is built separately (mostly to avoid rebuilding all of PANDA with every change while figuring out Python packaging)
  • I also updated Wireshark to the newest version supported by the network plugin

cc @be32826 who built the flake originally

flake.nix Outdated
libosi-src = {
url = "github:panda-re/libosi";
flake = false;
};
# Override this input to change which plugins are built.
panda-config = {
url = "path:./panda/plugins/config.panda";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only work when running nix build in the cloned repo, but it won't work when used as a dependency. I get this error with nix build github:lluchs/panda/flake:

error: cannot fetch input 'path:./panda/plugins/config.panda' because it uses a relative path

Maybe plugin customization can be done at a different level from the flake inputs, such as with .override?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, annoying. Thanks for catching that. .override unfortunately doesn't easily work without making the whole thing a nixpkgs overlay.

I've seen people suggest an input "path:/dev/null" for optional external configuration. I will try that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.override unfortunately doesn't easily work without making the whole thing a nixpkgs overlay.

I think you might be able to just change the panda package definition from

panda = pkgs.stdenv.mkDerivation {
  ...
}

to something like

panda = pkgs.callPackage
  ({ plugins ? builtins.readFile ./panda/plugins/config.panda }:
    pkgs.stdenv.mkDerivation {
      ...
    }) {}

- Builds with current nixpkgs
- Separate pypanda package built with nixpkgs Python functions
- Configurable plugin list
@lluchs
Copy link
Author

lluchs commented Dec 12, 2024

I implemented file:/dev/null as input now since it was simpler from what I already had. nix build github:lluchs/panda/flake works now, as well as local builds from the repository and overriding the configuration from another 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

Successfully merging this pull request may close these issues.

2 participants