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

Overhaul nix flake #279

Merged
merged 2 commits into from
Apr 10, 2024
Merged

Overhaul nix flake #279

merged 2 commits into from
Apr 10, 2024

Conversation

ozwaldorf
Copy link
Contributor

@ozwaldorf ozwaldorf commented Apr 5, 2024

Flake overhaul

I'm still new to nix, so if I made any incorrect assumptions just let me know!

  • Updated flake.lock
  • Allow using both the override and insert overlay strategies, keep the previous default (override)
  • Cleanup extra devshell packages (duplicates already included by inputsFrom)
  • Remove flake-compat input (hasnt been fully setup afaik)
  • Revert libinput patch filter
  • Define a nix fmt utility for the flake, I went with the newly released nixpkgs-rfc-style

Explanation

Trying to use the current flake overlay with a nixos flake on a recent unstable revision wreaks some havoc, due to the newer nixpkgs.sway-unwrapped using wlroots 0.17. The way the overlay is currently implemented, the package can break due to it just being an override of whatever parent nixpkgs is passed in. An alternative way would be to define the package output directly using the locked nixpkgs, and the overlay can just insert the locked working version into the users nixpkgs. We can offer both strategies, for whichever users need more. This pattern also seems to be provided by the popular flake-parts nix library, under their "overlay for free", so I assume it's a popular flow.

Flake-compat input should be removed since the repository doesn't have a default.nix to expose it, and nobody could use this repo as a non flake anyway (AFAIK)

Updated nixpkgs no longer uses the libinput patch, so it should be safe to remove.

Example usage of the new insert overlay

Use the overlay to insert to any parent nixpkgs version:

pkgs = import nixpkgs { 
  inherit system;
  overlays = [ inputs.swayfx.overlays.insert ];
};

Enable swayfx, using the sway module (unstable):

programs.swayfx = {
  enable = true;
  package = pkgs.swayfx;
};

Or, as a workaround for the current stable nixpkgs:

programs.swayfx = {
  enable = true;
  package = pkgs.sway.override { 
    sway-unwrapped = pkgs.swayfx-unwrapped;
  };
};

Testing

Passes garnix ci on my fork: https://github.com/ozwaldorf/swayfx/runs/23469316022. On a side note, it might be worth considering enabling on this project

@ozwaldorf
Copy link
Contributor Author

Side comment, #257 might break being able to use swayfx directly in the sway nix/hm module in the future

@WillPower3309
Copy link
Owner

Side comment, #257 might break being able to use swayfx directly in the sway nix/hm module in the future

good callout here, I am not sure how to proceed with that PR. In the least we need a sort of RFC

Copy link
Owner

@WillPower3309 WillPower3309 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the work here :)

@WillPower3309 WillPower3309 merged commit 8afe66a into WillPower3309:master Apr 10, 2024
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