Skip to content

Commit e99a890

Browse files
committed
web releases wip
1 parent 29d9355 commit e99a890

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

ghcjs/delivery-calculator/flake.nix

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
label = def.label;
1010
pkgs = inputs.ghc-wasm-meta.inputs.nixpkgs.legacyPackages.${system};
1111
shell = import ./../../nix/shell.nix;
12+
safeCopy = "cp -RL --no-preserve=mode,ownership";
13+
forceCopy = "cp -RLf --no-preserve=mode,ownership";
1214
app-ghcid = pkgs.writeScriptBin "app-ghcid" ''
1315
${pkgs.ghcid}/bin/ghcid --test="Main.main" --command="${pkgs.cabal-install}/bin/cabal new-repl ${label} --disable-optimization --repl-options=-fobject-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j -fghcid"
1416
'';
@@ -48,7 +50,7 @@
4850
out="./dist/latest"
4951
rm -rf "$out"
5052
mkdir -p "$out/static"
51-
cp -RLf --no-preserve=mode,ownership ${../miso-functora/dist}/* $out/
53+
${forceCopy} ${../miso-functora/dist}/* $out/
5254
cp ./static/*.png $out/static/
5355
cp ./static/*.webmanifest $out/
5456
cp ./static/*.ico $out/
@@ -101,6 +103,23 @@
101103
nix-shell ./android.nix --command "app-release-aab"
102104
'';
103105
};
106+
app-release-web = pkgs.writeShellApplication rec {
107+
name = "app-release-web";
108+
text = ''
109+
(
110+
${app-release-latest}/bin/app-release-latest
111+
if [ -d "./../../apps/${label}/${vsn}" ]
112+
then
113+
echo "Version ${vsn} does already exist!"
114+
exit 1
115+
else
116+
mkdir -p ./../../apps/${label}/${vsn}
117+
fi
118+
${safeCopy} ./dist/latest/* ./../../apps/${label}/${vsn}
119+
echo '<!doctype html><html><head><meta http-equiv="Refresh" content="0; url=${vsn}/index.html"></head><body></body></html>' > ./../../apps/${label}/index.html
120+
)
121+
'';
122+
};
104123
in {
105124
devShells.default = pkgs.mkShell {
106125
packages =
@@ -119,6 +138,7 @@
119138
app-release-latest
120139
app-release-apk
121140
app-release-aab
141+
app-release-web
122142
]
123143
++ (import ../../nix/tools.nix);
124144
};

0 commit comments

Comments
 (0)