Skip to content

Commit 468a3fd

Browse files
committed
feat: add nvfetcher
1 parent 48c0087 commit 468a3fd

8 files changed

Lines changed: 125 additions & 33 deletions

File tree

.github/workflows/evergreen.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: evergreen
2+
permissions:
3+
contents: write
4+
on:
5+
schedule:
6+
- cron: "0 0 * * 0"
7+
workflow_dispatch:
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
jobs:
10+
evergreen:
11+
if: ${{ github.ref == 'refs/heads/main' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 1
17+
persist-credentials: true
18+
19+
- uses: cachix/install-nix-action@v31
20+
21+
- name: Run nvfetcher
22+
run: nix run nixpkgs#nvfetcher
23+
24+
- name: Update nix flake
25+
run: nix flake update >> $GITHUB_STEP_SUMMARY
26+
27+
- name: Push changes
28+
run: |
29+
if [[ `git status _sources flake.lock --porcelain` ]]; then
30+
git config user.name github-actions[bot]
31+
git config user.email github-actions[bot]@users.noreply.github.com
32+
git add _sources flake.lock
33+
git commit -m "bot: evergreen"
34+
git push
35+
else
36+
echo "No changes to commit"
37+
fi

_sources/generated.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"lucide-static": {
3+
"cargoLocks": null,
4+
"date": null,
5+
"extract": null,
6+
"name": "lucide-static",
7+
"passthru": null,
8+
"pinned": false,
9+
"src": {
10+
"name": null,
11+
"sha256": "sha256-HllQo6cErmXKSz1um4JOH59G1GT87NCxbmHVypgtamw=",
12+
"type": "url",
13+
"url": "https://registry.npmjs.org/lucide-static/-/lucide-static-0.577.0.tgz"
14+
},
15+
"version": "0.577.0"
16+
},
17+
"reveal-js": {
18+
"cargoLocks": null,
19+
"date": null,
20+
"extract": null,
21+
"name": "reveal-js",
22+
"passthru": null,
23+
"pinned": false,
24+
"src": {
25+
"name": null,
26+
"sha256": "sha256-dGg/zZCis+XAxriRBB4Ig09sSM+nkYLATmVo6j7AvZY=",
27+
"type": "url",
28+
"url": "https://registry.npmjs.org/reveal.js/-/reveal.js-6.0.0.tgz"
29+
},
30+
"version": "6.0.0"
31+
}
32+
}

_sources/generated.nix

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file was generated by nvfetcher, please do not modify it manually.
2+
{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }:
3+
{
4+
lucide-static = {
5+
pname = "lucide-static";
6+
version = "0.577.0";
7+
src = fetchurl {
8+
url = "https://registry.npmjs.org/lucide-static/-/lucide-static-0.577.0.tgz";
9+
sha256 = "sha256-HllQo6cErmXKSz1um4JOH59G1GT87NCxbmHVypgtamw=";
10+
};
11+
};
12+
reveal-js = {
13+
pname = "reveal-js";
14+
version = "6.0.0";
15+
src = fetchurl {
16+
url = "https://registry.npmjs.org/reveal.js/-/reveal.js-6.0.0.tgz";
17+
sha256 = "sha256-dGg/zZCis+XAxriRBB4Ig09sSM+nkYLATmVo6j7AvZY=";
18+
};
19+
};
20+
}

flake.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
lib = pkgs.lib;
2323
hPkgs = pkgs.haskellPackages;
2424

25+
# nvfetcher-generated sources
26+
sources = pkgs.callPackage ./_sources/generated.nix { };
27+
2528
# Local packages (manually packaged dependencies)
26-
localPkgs = import ./packages { inherit pkgs; };
29+
localPkgs = import ./packages { inherit pkgs sources; };
2730

2831
# Source files for the site builder
2932
builderSrc = lib.fileset.toSource {
@@ -124,8 +127,7 @@
124127
125128
# Copy reveal.js for slides
126129
mkdir -p static/vendor/reveal.js
127-
cp -r ${revealJs}/dist static/vendor/reveal.js/
128-
cp -r ${revealJs}/plugin static/vendor/reveal.js/
130+
cp -r ${revealJs}/dist/* static/vendor/reveal.js/
129131
130132
site build
131133
runHook postBuild
@@ -168,6 +170,7 @@
168170
hPkgs.hlint
169171
pkgs.pkg-config
170172
pkgs.zlib
173+
pkgs.nvfetcher
171174
]
172175
++ buildTools;
173176

@@ -176,7 +179,7 @@
176179
mkdir -p static/vendor
177180
ln -sfn ${katexDist} static/vendor/katex
178181
ln -sfn ${lucideFont} static/vendor/lucide
179-
ln -sfn ${revealJs} static/vendor/reveal.js
182+
ln -sfn ${revealJs}/dist static/vendor/reveal.js
180183
export KATEX_VERSION="${katexVersion}"
181184
export MERMAID_VERSION="${mermaidVersion}"
182185
export PUPPETEER_EXECUTABLE_PATH="${browserPath}"
@@ -213,7 +216,7 @@
213216
mkdir -p static/vendor
214217
ln -sfn ${katexDist} static/vendor/katex
215218
ln -sfn ${lucideFont} static/vendor/lucide
216-
ln -sfn ${revealJs} static/vendor/reveal.js
219+
ln -sfn ${revealJs}/dist static/vendor/reveal.js
217220
'';
218221
};
219222

nvfetcher.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# nvfetcher configuration for auto-updating package sources
2+
# Run: nvfetcher
3+
4+
[lucide-static]
5+
src.cmd = "curl -s https://registry.npmjs.org/lucide-static/latest | jq -r .version"
6+
fetch.url = "https://registry.npmjs.org/lucide-static/-/lucide-static-$ver.tgz"
7+
8+
[reveal-js]
9+
src.cmd = "curl -s https://registry.npmjs.org/reveal.js/latest | jq -r .version"
10+
fetch.url = "https://registry.npmjs.org/reveal.js/-/reveal.js-$ver.tgz"

packages/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{ pkgs, ... }:
1+
{ pkgs, sources, ... }:
22

33
with pkgs.lib;
44

55
let
6-
callPackage = callPackageWith (pkgs // mypkgs);
6+
callPackage = callPackageWith (pkgs // mypkgs // { inherit sources; });
77
mypkgs = pipe (builtins.readDir ./.) [
88
(filterAttrs (_: type: type == "directory"))
99
(mapAttrs (name: _: callPackage ./${name} { }))

packages/lucide-static/default.nix

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
{
22
lib,
3-
fetchzip,
3+
runCommand,
4+
sources,
45
}:
56

6-
let
7-
version = "0.544.0";
8-
in
9-
fetchzip {
10-
pname = "lucide-static";
11-
inherit version;
12-
13-
url = "https://registry.npmjs.org/lucide-static/-/lucide-static-${version}.tgz";
14-
hash = "sha256-8+MABl6ToG4e3SM7VEzoDoHsCY52gtlMVW9EuOk5fd0=";
15-
stripRoot = true;
16-
7+
runCommand "lucide-static-${sources.lucide-static.version}" {
8+
inherit (sources.lucide-static) src;
179
meta = {
1810
description = "Lucide icon library - static assets (icon font and SVGs)";
1911
homepage = "https://lucide.dev/";
2012
license = lib.licenses.isc;
2113
maintainers = with lib.maintainers; [ codgician ];
2214
};
23-
}
15+
} ''
16+
mkdir -p $out
17+
tar -xzf $src --strip-components=1 -C $out
18+
''

packages/reveal-js/default.nix

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
{
22
lib,
3-
fetchzip,
3+
runCommand,
4+
sources,
45
}:
56

6-
let
7-
version = "5.2.1";
8-
in
9-
fetchzip {
10-
pname = "reveal-js";
11-
inherit version;
12-
13-
url = "https://registry.npmjs.org/reveal.js/-/reveal.js-${version}.tgz";
14-
hash = "sha256-zvqQZqO7wyitV5fTVnzwgQbtZaXUgY2UypMmVTdb96M=";
15-
stripRoot = true;
16-
7+
runCommand "reveal-js-${sources.reveal-js.version}" {
8+
inherit (sources.reveal-js) src;
179
meta = {
1810
description = "The HTML Presentation Framework";
1911
homepage = "https://revealjs.com/";
2012
license = lib.licenses.mit;
2113
maintainers = with lib.maintainers; [ codgician ];
2214
};
23-
}
15+
} ''
16+
mkdir -p $out
17+
tar -xzf $src --strip-components=1 -C $out
18+
''

0 commit comments

Comments
 (0)