2022-08-08 04:31:56 +00:00
|
|
|
{
|
|
|
|
description = "personal site";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
flake-parts.inputs.nixpkgs.follows = "nixpkgs";
|
2022-09-06 04:36:55 +00:00
|
|
|
gitignore.url = "github:hercules-ci/gitignore.nix";
|
|
|
|
gitignore.inputs.nixpkgs.follows = "nixpkgs";
|
2022-08-08 04:31:56 +00:00
|
|
|
|
2022-08-27 18:27:41 +00:00
|
|
|
# theme - inlined now, not used
|
2022-08-08 04:31:56 +00:00
|
|
|
apollo.url = "github:not-matthias/apollo";
|
|
|
|
apollo.flake = false;
|
|
|
|
};
|
|
|
|
|
2022-09-06 04:36:55 +00:00
|
|
|
outputs = { self, flake-parts, gitignore, ... }@inputs:
|
2022-08-08 04:31:56 +00:00
|
|
|
flake-parts.lib.mkFlake { inherit self; } {
|
|
|
|
imports = [ ];
|
|
|
|
systems = inputs.nixpkgs.lib.systems.flakeExposed;
|
2022-08-21 21:46:49 +00:00
|
|
|
perSystem = { config, self', inputs', pkgs, system, ... }:
|
|
|
|
let
|
2022-09-06 04:36:55 +00:00
|
|
|
inherit (gitignore.lib) gitignoreSource;
|
2022-08-28 18:28:27 +00:00
|
|
|
# TODO: move these to a flake-module
|
2022-08-28 01:58:45 +00:00
|
|
|
inherit (pkgs.callPackage ./nix { }) container deploy fonts optimize-images themes;
|
2022-08-27 19:08:42 +00:00
|
|
|
inherit (fonts) copyFonts linkFonts;
|
|
|
|
inherit (themes {
|
2022-08-27 18:42:04 +00:00
|
|
|
theme = inputs.apollo;
|
|
|
|
themeEnabled = false;
|
|
|
|
}) copyTheme linkTheme;
|
2022-08-21 21:46:49 +00:00
|
|
|
in
|
|
|
|
{
|
2022-08-25 07:32:34 +00:00
|
|
|
packages.default = with pkgs; stdenv.mkDerivation {
|
|
|
|
pname = "personal-site";
|
2022-09-06 04:36:55 +00:00
|
|
|
version = "2022-09-06";
|
|
|
|
src = gitignoreSource ./.;
|
2022-08-25 07:32:34 +00:00
|
|
|
nativeBuildInputs = [ optimize-images zola ];
|
2022-08-27 18:42:04 +00:00
|
|
|
configurePhase = copyTheme + copyFonts;
|
2022-08-25 07:32:34 +00:00
|
|
|
buildPhase = ''
|
2022-08-21 21:46:49 +00:00
|
|
|
optimize-images
|
2022-08-28 01:58:45 +00:00
|
|
|
zola build --drafts
|
2022-08-25 07:32:34 +00:00
|
|
|
'';
|
2022-08-27 03:54:29 +00:00
|
|
|
installPhase = ''
|
|
|
|
cp -r public $out
|
|
|
|
'';
|
2022-08-25 07:32:34 +00:00
|
|
|
};
|
2022-08-21 21:46:49 +00:00
|
|
|
devShells.default = with pkgs; mkShell {
|
2022-08-25 07:32:34 +00:00
|
|
|
packages = [ flyctl optimize-images zola ];
|
2022-08-27 18:42:04 +00:00
|
|
|
shellHook = linkTheme + linkFonts;
|
2022-08-25 07:32:34 +00:00
|
|
|
};
|
2022-08-28 01:58:45 +00:00
|
|
|
packages.container = container {
|
2022-09-06 04:36:55 +00:00
|
|
|
caddyfile = ./Caddyfile;
|
2022-08-28 01:58:45 +00:00
|
|
|
site = config.packages.default;
|
2022-08-27 19:08:42 +00:00
|
|
|
};
|
2022-08-27 03:54:29 +00:00
|
|
|
apps.deploy.program =
|
2022-09-06 04:36:55 +00:00
|
|
|
let deploy' = deploy { dockerImage = self.packages.x86_64-linux.container; };
|
2022-08-27 19:08:42 +00:00
|
|
|
in "${deploy'}/bin/deploy";
|
2022-08-08 04:31:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|