In cases like this where the derivation changes too much, it’s probably best to pin nixpkgs to a specific commit.
For example, if we want to pin hyprland and all its dependencies to a 0.39.1, we’d look for the last commit before it was updated to 0.40.0, which if we look at the commit history for hyprland is fbde1e7188f45e481368b69f57d805ef2c630cdc
.
Next, you need to fork the nixpkgs repo and clone that in your machine. We can then create a branch of this commit and push that to your fork.
$ git clone https://github.com/<your username>/nixpkgs
$ git branch hyprland-0.39.1 fbde1e7188f45e481368b69f57d805ef2c630cdc
$ git push --set-upstream origin hyprland-0.39.1
To use packages from this branch, we need to add it as a flake input:
# flake.nix
inputs = {
nixpkgs-hyprland.url = "github:<your username>/nixpkgs/hyprland-0.39.1";
};
To access this input from your configuration, you must add specialArgs to your nixosConfigurations
:
{
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
inputs.home-manager.url = github:nix-community/home-manager;
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations.fnord = nixpkgs.lib.nixosSystem {
+ specialArgs = { inherit inputs; };
modules = [ ./configuration.nix ];
};
};
}
Finally, we can inherit
all the packages that we need from this input using an overlay:
{ inputs, ... }:
{
nixpkgs.overlays = [
(
final: prev:
let
nixpkgs-hyprland = inputs.nixpkgs-hyprland.legacyPackages.${prev.system};
in
{
inherit (nixpkgs-hyprland) hyprland hyprpaper ... ;
}
)
];
}
You don’t have to pin hyprland to 0.39.1, by the way, as you can specify any nixpkgs commit. For example the one you had in your system before you updated or the hyprland update commit.
As such, you don’t really have to overlay the packages anymore (although you could if you want) as you can just modify the derivations from your nixpkgs fork (for example for the cursor fix).
This gives you more flexibility when customizing the packages as you can add changes to your system before they’re in nixpkgs without risking them breaking every time upstream is updated.
Hope this been helpful. If you have any more questions, don’t hesitate to ask 