pkgs/feeds: rework to use recurseIntoAttrs

this is closer to what upstream seems to prefer, but i'm still a little
unsure.
This commit is contained in:
Colin 2023-03-11 09:59:53 +00:00
parent dc1cd7a9a5
commit 4fe6f2aab3
2 changed files with 45 additions and 44 deletions

View File

@ -4,7 +4,7 @@
sane = rec {
#### my own, non-upstreamable packages:
sane-scripts = callPackage ../pkgs/sane-scripts { };
feeds = callPackage ../pkgs/feeds { };
feeds = recurseIntoAttrs (callPackage ../pkgs/feeds { });
tow-boot-pinephone = callPackage ../pkgs/tow-boot-pinephone { };
tow-boot-rpi4 = callPackage ../pkgs/tow-boot-rpi4 { };
bootpart-uefi-x86_64 = callPackage ../pkgs/bootpart-uefi-x86_64 { };

View File

@ -1,12 +1,12 @@
{ lib
, pkgs
, callPackage
, writeShellScript
}:
(lib.makeScope pkgs.newScope (self:
let
# TODO: dependency-inject this.
sane-data = import ../../modules/data { inherit lib; };
template = self.callPackage ./template.nix;
template = callPackage ./template.nix;
feed-pkgs = lib.mapAttrs
(name: feed-details: template {
feedName = name;
@ -17,13 +17,14 @@
update-scripts = lib.mapAttrsToList
(name: feed: builtins.concatStringsSep " " feed.passthru.updateScript)
feed-pkgs;
in
feed-pkgs // {
passthru.updateScript = pkgs.writeShellScript
in {
inherit feed-pkgs;
passthru = {
updateScript = writeShellScript
"feeds-update"
(builtins.concatStringsSep "\n" update-scripts);
passthru.initFeedScript = pkgs.writeShellScript
initFeedScript = writeShellScript
"init-feed"
''
# this is the `nix run '.#init-feed' <url>` script`
@ -45,5 +46,5 @@
${./update.py} "$name" "$json_path"
cat "$json_path"
'';
};
}
))