pkgs/feeds: rework the update script so that it can be built ahead-of-time, as a package, instead of just-in-time
This commit is contained in:
parent
f6d3c102fa
commit
0c32f807e6
|
@ -1,5 +1,7 @@
|
||||||
{ lib
|
{ lib
|
||||||
, callPackage
|
, callPackage
|
||||||
|
, python3
|
||||||
|
, stdenv
|
||||||
, writeShellScript
|
, writeShellScript
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -17,8 +19,24 @@ let
|
||||||
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 rec { # TODO: make this a scope
|
||||||
inherit feed-pkgs;
|
inherit feed-pkgs;
|
||||||
|
update = stdenv.mkDerivation {
|
||||||
|
pname = "update";
|
||||||
|
version = "0.1.0";
|
||||||
|
src = ./.;
|
||||||
|
patchPhase =
|
||||||
|
let
|
||||||
|
pyEnv = python3.withPackages (ps: [ ps.feedsearch-crawler ]);
|
||||||
|
in ''
|
||||||
|
substituteInPlace ./update.py \
|
||||||
|
--replace "#!/usr/bin/env nix-shell" "#!${pyEnv.interpreter}"
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
mv update.py $out/bin/update.py
|
||||||
|
'';
|
||||||
|
};
|
||||||
passthru = {
|
passthru = {
|
||||||
updateScript = writeShellScript
|
updateScript = writeShellScript
|
||||||
"feeds-update"
|
"feeds-update"
|
||||||
|
@ -43,7 +61,7 @@ in {
|
||||||
# but in a way where the least could go wrong.
|
# but in a way where the least could go wrong.
|
||||||
pushd "$sources_dir"; mkdir -p "$name"; popd
|
pushd "$sources_dir"; mkdir -p "$name"; popd
|
||||||
|
|
||||||
${./update.py} "$name" "$json_path"
|
${update}/bin/update.py "$name" "$json_path"
|
||||||
cat "$json_path"
|
cat "$json_path"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user