58 lines
1.6 KiB
Nix
58 lines
1.6 KiB
Nix
|
{
|
||
|
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, file-rename, ... }:
|
||
|
let nodeDeps = nodeEnv.shell.nodeDependencies;
|
||
|
in stdenv.mkDerivation {
|
||
|
name = "tlaternet-templates";
|
||
|
src = ./.;
|
||
|
|
||
|
buildInputs = [ nodejs file-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 '.html' '.html.hbs' $out/browser/*.html
|
||
|
'';
|
||
|
}) { };
|
||
|
};
|
||
|
defaultPackage = packages.templates;
|
||
|
|
||
|
devShell = prev.mkShell {
|
||
|
buildInputs = with prev;
|
||
|
with nodePackages; [
|
||
|
nodejs
|
||
|
node2nix
|
||
|
prettier
|
||
|
|
||
|
typescript
|
||
|
typescript-language-server
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|