2021-04-07 21:41:11 +01:00
|
|
|
{
|
|
|
|
description = "tlater.net web server contents";
|
|
|
|
|
|
|
|
inputs = {
|
2022-06-15 14:55:26 +01:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
2021-04-07 21:41:11 +01:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
2021-10-05 12:16:14 +01:00
|
|
|
outputs = { self, nixpkgs, flake-utils }@inputs:
|
2021-04-07 21:41:11 +01:00
|
|
|
flake-utils.lib.simpleFlake {
|
2021-10-05 12:16:14 +01:00
|
|
|
inherit self nixpkgs;
|
2021-04-07 21:41:11 +01:00
|
|
|
name = "tlaternet-templates";
|
|
|
|
|
|
|
|
overlay = final: prev: {
|
|
|
|
tlaternet-templates = rec {
|
|
|
|
packages = rec {
|
2022-06-15 14:55:26 +01:00
|
|
|
nodeEnv = prev.callPackage ./nix/override.nix { pkgs = prev; };
|
2021-04-07 21:41:11 +01:00
|
|
|
templates = prev.callPackage ({ stdenv, nodejs, rename, ... }:
|
|
|
|
let nodeDeps = nodeEnv.shell.nodeDependencies;
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "tlaternet-templates";
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
buildInputs = [ nodejs rename ];
|
|
|
|
buildPhase = ''
|
|
|
|
ln -s ${nodeDeps}/lib/node_modules ./node_modules
|
|
|
|
export PATH="${nodeDeps}/bin:$PATH"
|
|
|
|
|
|
|
|
npm run build
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cp -r dist $out/
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
rename 's/.html$/.html.hbs/' $out/browser/*.html
|
|
|
|
'';
|
|
|
|
}) { };
|
|
|
|
};
|
|
|
|
defaultPackage = packages.templates;
|
|
|
|
|
|
|
|
devShell = prev.mkShell {
|
|
|
|
buildInputs = with prev;
|
2021-04-11 03:13:26 +01:00
|
|
|
with nodePackages;
|
|
|
|
[
|
2021-04-07 21:41:11 +01:00
|
|
|
nodejs
|
|
|
|
node2nix
|
|
|
|
|
2021-04-11 03:12:55 +01:00
|
|
|
# Handy dev tools
|
|
|
|
prettier
|
2021-04-07 21:41:11 +01:00
|
|
|
typescript
|
|
|
|
typescript-language-server
|
2021-04-11 03:13:26 +01:00
|
|
|
] ++ packages.nodeEnv.shell.buildInputs;
|
2021-04-07 21:41:11 +01:00
|
|
|
};
|
2021-04-11 03:13:48 +01:00
|
|
|
|
|
|
|
# TODO: This would be the ideal. Sadly, parcel isn't smart
|
|
|
|
# enough to pull its plugins from $NODE_PATH.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# devShell = packages.nodeEnv.shell.override {
|
|
|
|
# buildInputs = with prev; with nodePackages; [
|
|
|
|
# node2nix
|
|
|
|
|
|
|
|
# prettier
|
|
|
|
# typescript-language-server
|
|
|
|
# ];
|
|
|
|
# };
|
2021-04-07 21:41:11 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|