2021-04-07 21:41:11 +01:00
|
|
|
{
|
|
|
|
description = "tlater.net web server contents";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
|
2021-04-11 05:30:59 +01:00
|
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
2021-04-07 21:41:11 +01:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
2021-04-11 05:30:59 +01:00
|
|
|
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils }@inputs:
|
2021-04-07 21:41:11 +01:00
|
|
|
flake-utils.lib.simpleFlake {
|
2021-04-11 05:30:59 +01:00
|
|
|
inherit self;
|
|
|
|
nixpkgs = nixpkgs-unstable;
|
2021-04-07 21:41:11 +01:00
|
|
|
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 {
|
|
|
|
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
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|