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 { sane = rec {
#### my own, non-upstreamable packages: #### my own, non-upstreamable packages:
sane-scripts = callPackage ../pkgs/sane-scripts { }; 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-pinephone = callPackage ../pkgs/tow-boot-pinephone { };
tow-boot-rpi4 = callPackage ../pkgs/tow-boot-rpi4 { }; tow-boot-rpi4 = callPackage ../pkgs/tow-boot-rpi4 { };
bootpart-uefi-x86_64 = callPackage ../pkgs/bootpart-uefi-x86_64 { }; bootpart-uefi-x86_64 = callPackage ../pkgs/bootpart-uefi-x86_64 { };

View File

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