My goal is to be able to define a specific version of pkgs.unifi
, as I’m dealing with a weird issue on my UniFi controller, not being able to migrate its DB (We do not support upgrading from 5.6.42
), so I need to further debug things by testing a few things using specific versions.
According to pkgs/top-level/all-packages.nix
, pkgs.unifi
is an alias to pkgs.unifiStable
:
inherit (callPackages ../servers/unifi { })
unifiLTS
unifiStable
unifiTesting;
unifi = unifiStable;
So I have this in my configuration.nix
…
- for enabling
unifi
:nixpkgs.config.allowUnfree = true; services.unifi.enable = true; services.unifi.openPorts = true;
- for pulling in the overlay:
nixpkgs.overlays = [ (import /etc/nixos/overlays/unifi.nix) ];
And in the overlay (/etc/nixos/overlays/unifi.nix
):
self: super:
{
unifiStable = super.unifiStable.overrideAttrs(oldAttrs: rec {
version = "5.7.23";
sha256 = "e7b60814c27d85c13e54fc3041da721cc38ad21bb0a932bdfe810c2ad3855392"
});
}
While any change to this expression (e.g. inserting a random char in the value of sha256
triggers the build of a new derivation, the original version of pkgs.unifiStable
is still being used (even using invalid values doesn’t cause the expected failures on nixos-rebuild build
):
nixos-rebuild dry-build
building the system configuration...
these derivations will be built:
/nix/store/vbbpn9lk9f3qsnx98rzpyknvwmd2jq33-unifi-controller-5.10.23.drv
/nix/store/2pi4394vl72m3lnpzxdpk86s52smjaqk-unit-script-unifi-pre-start.drv
/nix/store/9fhnrirplkjb0s3qnqmzwzf37f9q20vv-unit-var-lib-unifi-lib.mount.drv
/nix/store/ppab6sj3drskk3ipb2fgj7bli6p8ndh1-unit-unifi.service.drv
/nix/store/yppnjdzica1c4nsy4x09hyk01c99a7mn-unit-var-lib-unifi-dl.mount.drv
/nix/store/sg46ls76nphl1928qqrcjm36vy4bbkj2-system-units.drv
/nix/store/wadjbw4v318rlmkh61v1xgscpw2sc8g0-etc.drv
/nix/store/gq9hxynxv706pch6lkxrzjypkyrxpcmw-nixos-system-cwg-sdn-unifi-a52f-19.03.172852.5121b483edc.drv
Things I’ve tried:
- Setting
unifi = self.unifiStable
in my overlay - Using
unifi = super.unifi…
(or any other combination likeunifi = super.unifiStable…
) instead ofunifiStable = super.unifiStable…
in my overlay - Explicitly defining
services.unifi.unifiPackage = pkgs.unifiStable
in myconfiguration.nix
I’m running out of ideas and I have no idea at this point, how to dig into this, as all the evaluation happening when running nixos-rebuild
feels very opaque to me and I fail to get some insight what is how and when evaluated to get a better understanding of what I’m doing (wrong).