outputs: add updater script

This commit is contained in:
Wroclaw 2025-03-18 18:14:12 +01:00
parent 59d6ba8f97
commit 72d18c49fe

View file

@ -1,5 +1,6 @@
{
inputs ? import ./inputs.nix {},
inputsPath ? ./inputs.nix,
inputs ? import inputsPath {},
selfPath ? ./.
}:
@ -16,7 +17,7 @@ systems = [
forEachSystem = lib.genAttrs systems;
self = {
inherit inputs lib self;
inherit inputs inputsPath lib self;
outPath = selfPath;
modifiedNixpkgs = import ./pkgs/top-level/impure.nix;
modifiedNixpkgsPure = import ./pkgs/top-level/default.nix;
@ -71,6 +72,30 @@ self = {
builtins.attrValues
builtins.listToAttrs
];
# FIXME: currently impure
# NOTE: to run, you need to evaluate outputs.nix instead of default.nix
# nix-shell outputs.nix -A update
update = let
updateScript = (self.packagesForSystem (builtins.currentSystem)).den-update-script;
in updateScript {
path = "";
packages = lib.pipe ./update-list.nix [
import
(x: x self)
lib.attrsToList
(lib.imap1 (i: {name, value}: {
name = builtins.toString i;
value = value // {
# hack to pass isDerivation check in nixpkgs maintainers/scripts/update.nix
# https://github.com/NixOS/nixpkgs/blob/a1185f4064c18a5db37c5c84e5638c78b46e3341/maintainers/scripts/update.nix#L85
type = "derivation";
name = name;
};
}))
builtins.listToAttrs
lib.recurseIntoAttrs
];
};
};
in self