mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-01 04:31:57 -07:00
Nix: corrections for overlays, overrideable systems (#2929)
* nix: overlays: move waybar-hyprland to own overlay * flake: use legacyPackages for formatter Run `nix fmt` for all files. * flake: move default overlay to nix/overlays.nix * nix: lib: remove lib * nix: overlays: extras: explicitly include xdph overlays * nix: use interpolation for versions * nix: overlays: include deps with hyprland-packages * flake: make systems overrideable * flake: packages: inherit from overlaid pkgsFor
This commit is contained in:
107
nix/overlays.nix
107
nix/overlays.nix
@@ -10,70 +10,75 @@
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
|
||||
mkJoinedOverlays = overlays: final: prev:
|
||||
lib.foldl' (attrs: overlay: attrs // (overlay final prev)) {} overlays;
|
||||
in {
|
||||
# Packages for variations of Hyprland, and its dependencies.
|
||||
hyprland-packages = final: prev: {
|
||||
hyprland = final.callPackage ./default.nix {
|
||||
version =
|
||||
props.version
|
||||
+ "+date="
|
||||
+ (mkDate (self.lastModifiedDate or "19700101"))
|
||||
+ "_"
|
||||
+ (self.shortRev or "dirty");
|
||||
wlroots = final.wlroots-hyprland;
|
||||
commit = self.rev or "";
|
||||
inherit (final) udis86 hyprland-protocols;
|
||||
};
|
||||
# Contains what a user is most likely to care about:
|
||||
# Hyprland itself, XDPH, the Share Picker, and patched Waybar.
|
||||
default = mkJoinedOverlays (with self.overlays; [
|
||||
hyprland-packages
|
||||
hyprland-extras
|
||||
]);
|
||||
|
||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||
hyprland-debug = final.hyprland.override {debug = true;};
|
||||
hyprland-hidpi = final.hyprland.override {hidpiXWayland = true;};
|
||||
hyprland-nvidia = final.hyprland.override {nvidiaPatches = true;};
|
||||
hyprland-no-hidpi =
|
||||
builtins.trace
|
||||
"hyprland-no-hidpi was removed. Please use the default package."
|
||||
final.hyprland;
|
||||
# Packages for variations of Hyprland, dependencies included.
|
||||
hyprland-packages = mkJoinedOverlays [
|
||||
# Dependencies
|
||||
inputs.hyprland-protocols.overlays.default
|
||||
self.overlays.wlroots-hyprland
|
||||
self.overlays.udis86
|
||||
# Hyprland packages themselves
|
||||
(final: prev: {
|
||||
hyprland = final.callPackage ./default.nix {
|
||||
version = "${props.version}+date=${mkDate (self.lastModifiedDate or "19700101")}_${self.shortRev or "dirty"}";
|
||||
wlroots = final.wlroots-hyprland;
|
||||
commit = self.rev or "";
|
||||
inherit (final) udis86 hyprland-protocols;
|
||||
};
|
||||
|
||||
udis86 = final.callPackage ./udis86.nix {};
|
||||
};
|
||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||
hyprland-debug = final.hyprland.override {debug = true;};
|
||||
hyprland-hidpi = final.hyprland.override {hidpiXWayland = true;};
|
||||
hyprland-nvidia = final.hyprland.override {nvidiaPatches = true;};
|
||||
hyprland-no-hidpi =
|
||||
builtins.trace
|
||||
"hyprland-no-hidpi was removed. Please use the default package."
|
||||
final.hyprland;
|
||||
})
|
||||
];
|
||||
|
||||
# Packages for extra software recommended for usage with Hyprland,
|
||||
# including forked or patched packages for compatibility.
|
||||
hyprland-extras = lib.mkJoinedOverlays [
|
||||
# Include any inputs' specific overlays whose attributes should
|
||||
# be re-exported by the Hyprland flake.
|
||||
#
|
||||
inputs.xdph.overlays.default
|
||||
# Provides:
|
||||
# - xdg-desktop-portal-hyprland
|
||||
# - hyprland-share-picker
|
||||
#
|
||||
# Attributes for `hyprland-extras` defined by this flake can
|
||||
# go in the oberlay below.
|
||||
(final: prev: {
|
||||
waybar-hyprland = prev.waybar.overrideAttrs (old: {
|
||||
postPatch = ''
|
||||
# use hyprctl to switch workspaces
|
||||
sed -i 's/zext_workspace_handle_v1_activate(workspace_handle_);/const std::string command = "hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());/g' src/modules/wlr/workspace_manager.cpp
|
||||
'';
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/waybar \
|
||||
--suffix PATH : ${lib.makeBinPath [final.hyprland]}
|
||||
'';
|
||||
mesonFlags = old.mesonFlags ++ ["-Dexperimental=true"];
|
||||
});
|
||||
})
|
||||
hyprland-extras = mkJoinedOverlays [
|
||||
inputs.xdph.overlays.xdg-desktop-portal-hyprland
|
||||
inputs.xdph.overlays.hyprland-share-picker
|
||||
self.overlays.waybar-hyprland
|
||||
];
|
||||
|
||||
waybar-hyprland = final: prev: {
|
||||
waybar-hyprland = prev.waybar.overrideAttrs (old: {
|
||||
postPatch = ''
|
||||
# use hyprctl to switch workspaces
|
||||
sed -i 's/zext_workspace_handle_v1_activate(workspace_handle_);/const std::string command = "hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());/g' src/modules/wlr/workspace_manager.cpp
|
||||
'';
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/waybar \
|
||||
--suffix PATH : ${lib.makeBinPath [final.hyprland]}
|
||||
'';
|
||||
mesonFlags = old.mesonFlags ++ ["-Dexperimental=true"];
|
||||
});
|
||||
};
|
||||
|
||||
udis86 = final: prev: {
|
||||
udis86 = final.callPackage ./udis86.nix {};
|
||||
};
|
||||
|
||||
# Patched version of wlroots for Hyprland.
|
||||
# It is under a new package name so as to not conflict with
|
||||
# the standard version in nixpkgs.
|
||||
wlroots-hyprland = final: prev: {
|
||||
wlroots-hyprland = final.callPackage ./wlroots.nix {
|
||||
version =
|
||||
mkDate (inputs.wlroots.lastModifiedDate or "19700101")
|
||||
+ "_"
|
||||
+ (inputs.wlroots.shortRev or "dirty");
|
||||
version = "${mkDate (inputs.wlroots.lastModifiedDate or "19700101")}_${inputs.wlroots.shortRev or "dirty"}";
|
||||
src = inputs.wlroots;
|
||||
libdisplay-info = prev.libdisplay-info.overrideAttrs (old: {
|
||||
version = "0.1.1+date=2023-03-02";
|
||||
|
Reference in New Issue
Block a user