aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-12-09 00:15:58 -0500
committerXe Iaso <me@christine.website>2022-12-09 00:15:58 -0500
commite8d057aae475e4b2d1f078db0bf3d9f3b135f222 (patch)
treed9e20f3f019da984e643fb65399bec0b950df085 /flake.nix
parent3f0754ab6a7ae0810db3f0f0201a99c194cc5d06 (diff)
downloadxesite-e8d057aae475e4b2d1f078db0bf3d9f3b135f222.tar.xz
xesite-e8d057aae475e4b2d1f078db0bf3d9f3b135f222.zip
use deno2nix to build the frontend, prepare wasi executor shitpost
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix40
1 files changed, 22 insertions, 18 deletions
diff --git a/flake.nix b/flake.nix
index 4bfd22a..533d245 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,12 +12,21 @@
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
+
+ deno2nix = {
+ url = "github:Xe/deno2nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.flake-utils.follows = "flake-utils";
+ };
};
- outputs = { self, nixpkgs, flake-utils, naersk, ... }:
+ outputs = { self, nixpkgs, flake-utils, naersk, deno2nix, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
- pkgs = import nixpkgs { inherit system; };
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [ deno2nix.overlays.default ];
+ };
naersk-lib = naersk.lib."${system}";
src = ./.;
@@ -78,23 +87,18 @@
'';
};
- frontend = pkgs.stdenv.mkDerivation {
- pname = "xesite-frontend";
- inherit (bin) version;
- src = ./src/frontend;
- buildInputs = with pkgs; [ deno nodePackages.uglify-js ];
-
- phases = "installPhase";
-
- installPhase = ''
- mkdir -p $out/static/js
- mkdir -p .deno
- export HOME=./.deno
+ frontend.share-button = pkgs.deno2nix.mkBundled {
+ pname = "xesite-frontend-mastodon-share-button";
+ inherit (bin) version;
- deno bundle --config $src/deno.json $src/mastodon_share_button.tsx ./mastodon_share_button.js
+ src = ./src/frontend;
+ lockfile = ./src/frontend/lock.json;
- uglifyjs ./mastodon_share_button.js -c -m > $out/static/js/mastodon_share_button.js
- '';
+ output = "mastodon_share_button.js";
+ outPath = "static/js";
+ entrypoint = "./mastodon_share_button.tsx";
+ importMap = "./import_map.json";
+ minify = true;
};
static = pkgs.stdenv.mkDerivation {
@@ -129,7 +133,7 @@
default = pkgs.symlinkJoin {
name = "xesite-${bin.version}";
- paths = [ config posts static bin frontend resumePDF ];
+ paths = [ config posts static bin frontend.share-button resumePDF ];
};
docker = pkgs.dockerTools.buildLayeredImage {