nix: make dist tarball in nix
This is more sound than having to rely on host nix shell. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -3,7 +3,7 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@@ -15,8 +15,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Process static files
|
- name: Process static files
|
||||||
run: >-
|
run: >-
|
||||||
nix build --print-out-paths --print-build-logs .#hakurei-static &&
|
nix build
|
||||||
nix shell nixpkgs#gnutar nixpkgs#zstd --command tar -C result --zstd -cf hakurei.app-${{ github.ref_name }}.tar.zst .
|
--print-out-paths
|
||||||
|
--print-build-logs
|
||||||
|
--out-link hakurei.app-${{ github.ref_name }}.tar.zst
|
||||||
|
.#dist
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: https://gitea.com/actions/release-action@main
|
uses: https://gitea.com/actions/release-action@main
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
run: >-
|
run: >-
|
||||||
export HAKUREI_REV="$(git rev-parse --short HEAD)" &&
|
export HAKUREI_REV="$(git rev-parse --short HEAD)" &&
|
||||||
sed -i.old 's/version = /version = "0.0.0-'$HAKUREI_REV'"; # version = /' package.nix &&
|
sed -i.old 's/version = /version = "0.0.0-'$HAKUREI_REV'"; # version = /' package.nix &&
|
||||||
nix build --print-out-paths --print-build-logs .#hakurei-static &&
|
nix build --print-out-paths --print-build-logs .#static &&
|
||||||
mv package.nix.old package.nix &&
|
mv package.nix.old package.nix &&
|
||||||
echo "rev=$HAKUREI_REV" >> $GITHUB_OUTPUT
|
echo "rev=$HAKUREI_REV" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|||||||
18
flake.nix
18
flake.nix
@@ -67,17 +67,25 @@
|
|||||||
packages = forAllSystems (
|
packages = forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
inherit (self.packages.${system}) hakurei-static caddy-hakurei-static;
|
inherit (self.packages.${system}) static caddy;
|
||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = caddy-hakurei-static;
|
default = caddy;
|
||||||
hakurei-static = pkgs.callPackage ./package.nix { };
|
static = pkgs.callPackage ./package.nix { };
|
||||||
caddy-hakurei-static = pkgs.writeShellScriptBin "caddy-hakurei-static" ''
|
dist = pkgs.runCommand "hakurei-static-${static.version}.tar.zst" { } ''
|
||||||
|
PATH="${pkgs.zstd}/bin:$PATH" \
|
||||||
|
${pkgs.gnutar}/bin/tar \
|
||||||
|
-C '${static}' \
|
||||||
|
--zstd \
|
||||||
|
-cf \
|
||||||
|
"$out" .
|
||||||
|
'';
|
||||||
|
caddy = pkgs.writeShellScriptBin "caddy-hakurei-static" ''
|
||||||
exec ${pkgs.caddy}/bin/caddy \
|
exec ${pkgs.caddy}/bin/caddy \
|
||||||
file-server \
|
file-server \
|
||||||
-a -l ":49151" \
|
-a -l ":49151" \
|
||||||
-r ${hakurei-static}
|
-r ${static}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
stdenvNoCC,
|
stdenv,
|
||||||
runCommandNoCC,
|
runCommand,
|
||||||
util-linux,
|
util-linux,
|
||||||
moreutils,
|
moreutils,
|
||||||
parallel,
|
parallel,
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
python3,
|
python3,
|
||||||
buildNpmPackage,
|
buildNpmPackage,
|
||||||
}:
|
}:
|
||||||
stdenvNoCC.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "hakurei.app";
|
pname = "hakurei.app";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ stdenvNoCC.mkDerivation rec {
|
|||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
util-linux
|
util-linux
|
||||||
(runCommandNoCC "sponge" { } "mkdir -p $out/bin && ln -s ${moreutils}/bin/sponge $out/bin")
|
(runCommand "sponge" { } "mkdir -p $out/bin && ln -s ${moreutils}/bin/sponge $out/bin")
|
||||||
parallel
|
parallel
|
||||||
openssl
|
openssl
|
||||||
libxml2
|
libxml2
|
||||||
|
|||||||
Reference in New Issue
Block a user