{
description = "tlater.net web server contents";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }@inputs:
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "tlaternet-templates";
overlay = final: prev: {
tlaternet-templates = rec {
packages = rec {
nodeEnv = prev.callPackage ./nix/override.nix { };
templates = prev.callPackage ({ stdenv, nodejs, rename, ... }:
let nodeDeps = nodeEnv.shell.nodeDependencies;
in stdenv.mkDerivation {
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;
with nodePackages;
[
nodejs
node2nix
# Handy dev tools
prettier
typescript
typescript-language-server
] ++ packages.nodeEnv.shell.buildInputs;
}