diff options
author | Ben Sima <ben@bsima.me> | 2024-04-01 22:48:06 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2024-04-02 00:09:18 -0400 |
commit | 19a4c1be33762d81ca4262a6d9ea6e704b201ee1 (patch) | |
tree | a26c1e589976218788ef7f93144b06b2062e182e /Biz/Bild/Nixpkgs.nix | |
parent | 5deafaf3de069d2795e8884aa3bcb6aa904eb48b (diff) |
Add nixos-23_{05,11} deps
Using the same methodology as in d56f05863d789423ff785cec654155d8495373a9, where
I add additional nixpkgs via an overlay, I added access to nixos-23.11. I also
renamed the nixpkgs-stable dep to be more appropriate, given that it comes from
the nixos-23.05 git branch. I'm nost totally sure about the naming of the attr
in the overlay, maybe it should be 'stable-23_11'? But I feel like for
discoverability purposes it should be the same as the name in deps, so I'll just
stick with that.
Diffstat (limited to 'Biz/Bild/Nixpkgs.nix')
-rw-r--r-- | Biz/Bild/Nixpkgs.nix | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/Biz/Bild/Nixpkgs.nix b/Biz/Bild/Nixpkgs.nix index ecf50b9..8cb3448 100644 --- a/Biz/Bild/Nixpkgs.nix +++ b/Biz/Bild/Nixpkgs.nix @@ -9,36 +9,45 @@ let system = __currentSystem; -in import sources.nixpkgs-stable { +in import sources.nixos-23_05 { inherit system config; overlays = [ (_: _: { inherit sources; }) - (_: _: { - unstable = import sources.nixpkgs-unstable { inherit system config; }; - }) - (_: pkgs: { + + # add some functions + (_: old: { # Given a generic `builder`, will generate an attrset for all the packages # pinned by `deps` with `builder` applied to the package. This attrset can # then be merged with the rest of the packages in the set as part of an # overlay or overrides. overridePinnedDeps = builder: - pkgs.lib.genAttrs (builtins.attrNames pkgs.sources) builder; - }) - (_: pkgs: { + old.lib.genAttrs (builtins.attrNames sources) builder; + # Modifies a derivation with our source and version, keeping old build # rules. This will fail if build steps have changed, or if no build # rules are available upstream. overrideSource = depName: - pkgs.${depName}.overrideAttrs (old: - old // rec { - version = - pkgs.sources.${depName}.version or pkgs.sources.${depName}.rev; - src = pkgs.sources.${depName}; - }); + if old ? "${depName}" && old.${depName} ? overrideAttrs then + old.${depName}.overrideAttrs (attrs: + attrs // rec { + version = sources.${depName}.version or sources.${depName}.rev; + src = sources.${depName}; + }) + else + null; }) - (_: pkgs: - # override pinned deps with our sources - pkgs.overridePinnedDeps pkgs.overrideSource) + + # override pinned deps with our sources, this must come before other + # package overlays, because of the 'null' above + (_: pkgs: pkgs.overridePinnedDeps pkgs.overrideSource) + + # add other nixpkgs distributions + (_: _: { + unstable = import sources.nixpkgs-unstable { inherit system config; }; + nixos-23_11 = import sources.nixos-23_11 { inherit system config; }; + }) + + # add our hand-written derivations (import ./Deps.nix) (_: pkgs: { niv = import pkgs.sources.niv { }; }) ]; |