This repository has been archived on 2022-09-16. You can view files and clone it, but cannot push or open issues or pull requests.
tlaternet-templates/flake.nix

58 lines
1.6 KiB
Nix
Raw Normal View History

2021-04-06 22:17:57 +01:00
{
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
];
};
};
};
};
}