From aa5f12a5a2365a35f17becc66cf7a67fa86a4440 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 8 Apr 2024 16:02:03 -0400 Subject: Reorganize and update nixpkgs upstreams This patch does a few things: 1. Switches from nixpkgs-unstable to nixos-unstable{,-small}, simply because nixpkgs-unstable is not in cache.nixos.org, but nixos-unstable is, and -small is the same but requires all tests to pass. So we should prefer nixos-unstable-small, whenever possible. 2. Reorganizes the nixpkgs import code such that Nixpkgs.nix returns an attrset of all the nixpkgs that I want to use, rather than putting other nixpkgs branches into the main one as an overlay. This is much simpler and explicit, but it meant I had to change a lot of usages throughtout the nix codebase. 3. As a consequence of 2, moves the overlays into separate files so they can be re-used across nixpkgs branches. --- Biz/Bild/Nixpkgs.nix | 80 +++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 42 deletions(-) (limited to 'Biz/Bild/Nixpkgs.nix') diff --git a/Biz/Bild/Nixpkgs.nix b/Biz/Bild/Nixpkgs.nix index 8cb3448..f0e8698 100644 --- a/Biz/Bild/Nixpkgs.nix +++ b/Biz/Bild/Nixpkgs.nix @@ -2,54 +2,50 @@ let sources = import ./Sources.nix { sourcesFile = ./Sources.json; }; config = { + allowAliases = true; allowBroken = true; allowUnfree = true; + checkMeta = true; cudaSupport = true; }; system = __currentSystem; -in import sources.nixos-23_05 { - inherit system config; - overlays = [ - (_: _: { inherit sources; }) - - # 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: - 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: - 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; - }) - - # 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 { }; }) - ]; +in { + nixos-23_05 = import sources.nixos-23_05 { + inherit system config; + overlays = [ + (_: _: { inherit sources; }) + + (import ./Functions.nix) + + # override pinned deps with our sources, this must come before other + # package overlays, because of the 'null' from 'overrideSource' + (_: pkgs: pkgs.overridePinnedDeps pkgs.overrideSource) + + (import ./Deps.nix) + (import ./Python.nix) + (import ./Haskell.nix) + ]; + }; + + nixos-23_11 = import sources.nixos-23_11 { + inherit system config; + overlays = [ + (_: _: { inherit sources; }) + (import ./Functions.nix) + (import ./Deps.nix) + ]; + }; + + nixos-unstable-small = import sources.nixos-unstable-small { + inherit system config; + overlays = [ + (_: _: { inherit sources; }) + (import ./Functions.nix) + (import ./Deps.nix) + ]; + }; + } -- cgit v1.2.3