erambler/flake.nix

47 lines
1.2 KiB
Nix

{
description = "A very basic flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
(flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
defaultPackage = pkgs.stdenv.mkDerivation {
name = "erambler-html";
src = ./.;
nativeBuildInputs = [ pkgs.hugo ];
buildPhase = "hugo";
installPhase = ''
mkdir $out
cp -R public/* $out
'';
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
(python38.withPackages
(py: with py; [ python invoke rich requests ruamel_yaml sh ]))
yarn
hugo
];
};
})) // {
nixosModule = { config, pkgs, ... }: {
services.nginx = {
enable = true;
virtualHosts."erambler.co.uk" = {
enableACME = true;
forceSSL = true;
root = self.defaultPackage.${pkgs.system};
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
};
};
}