Auto update layman

This commit is contained in:
Nathan McCarty 2023-05-14 19:12:18 -04:00
parent ef6b72db81
commit 90a1cfd860
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
3 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{ pkgs, lib, pythonPkgs ? pkgs.python311Packages }: { pkgs, lib, pythonPkgs ? pkgs.python311Packages }:
let let
vals = builtins.fromJSON (builtins.readFile ../../sources/layman.json);
inherit pythonPkgs; inherit pythonPkgs;
f = { buildPythonPackage, i3ipc, setproctitle, tomli, setuptools }: f = { buildPythonPackage, i3ipc, setproctitle, tomli, setuptools }:
buildPythonPackage rec { buildPythonPackage rec {
@ -9,8 +10,8 @@ let
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "frap129"; owner = "frap129";
repo = "layman"; repo = "layman";
rev = "c827811d71461d9190c3f5d0d00d339d74ff3407"; rev = vals.rev;
hash = "sha256-Z8gliSEZgFtOtCZf51J79SqMTHOEd2zwtv0tFiXWn8k="; hash = vals.hash;
}; };
nativeBuildInputs = [ setuptools ]; nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [ i3ipc setproctitle tomli ]; propagatedBuildInputs = [ i3ipc setproctitle tomli ];

4
sources/layman.json Normal file
View File

@ -0,0 +1,4 @@
{
"rev": "c827811d71461d9190c3f5d0d00d339d74ff3407",
"hash": "sha256-Z8gliSEZgFtOtCZf51J79SqMTHOEd2zwtv0tFiXWn8k="
}

View File

@ -14,3 +14,15 @@ jq --null-input \
--arg hash "$SWAYIMG_HASH" \ --arg hash "$SWAYIMG_HASH" \
'{"version": $version, "url": $url, "hash": $hash}' \ '{"version": $version, "url": $url, "hash": $hash}' \
> $DIRECTORY/swayimg.json > $DIRECTORY/swayimg.json
echo "swayimg now at $SWAYIMG_VERSION"
# Update layman
LAYMAN_BRANCH=$(curl https://api.github.com/repos/frap129/layman | jq -r '.default_branch')
LAYMAN_REV=$(curl https://api.github.com/repos/frap129/layman/git/refs/heads/$LAYMAN_BRANCH | \
jq -r '.object.sha')
LAYMAN_HASH=$(nix-prefetch fetchFromGitHub --owner frap129 --repo layman --rev $LAYMAN_REV)
jq --null-input \
--arg rev "$LAYMAN_REV" \
--arg hash "$LAYMAN_HASH" \
'{"rev": $rev, "hash": $hash}' \
> $DIRECTORY/layman.json