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-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;
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, flake-parts, ... }@inputs:
|
|
|
|
let
|
2022-08-27 18:27:41 +00:00
|
|
|
themeEnabled = false;
|
2022-08-08 04:31:56 +00:00
|
|
|
theme = inputs.apollo;
|
|
|
|
themeName = ((builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name);
|
|
|
|
in
|
|
|
|
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-08-27 03:54:29 +00:00
|
|
|
inherit (pkgs) callPackage;
|
|
|
|
optimize-images = callPackage ./nix/optimize-images.nix { };
|
|
|
|
inherit (callPackage ./nix/fonts.nix { }) copyFonts linkFonts;
|
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";
|
|
|
|
version = "2022-08-21";
|
|
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = [ optimize-images zola ];
|
2022-08-27 18:27:41 +00:00
|
|
|
configurePhase = lib.optionalString themeEnabled ''
|
2022-08-25 07:32:34 +00:00
|
|
|
mkdir -p themes/${themeName}
|
|
|
|
cp -r ${theme}/* themes/${themeName}
|
|
|
|
'' + copyFonts;
|
|
|
|
buildPhase = ''
|
2022-08-21 21:46:49 +00:00
|
|
|
optimize-images
|
2022-08-25 07:32:34 +00:00
|
|
|
zola build
|
|
|
|
'';
|
2022-08-27 03:54:29 +00:00
|
|
|
installPhase = ''
|
|
|
|
cp -r public $out
|
|
|
|
cp Caddyfile $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:27:41 +00:00
|
|
|
shellHook = lib.optionalString themeEnabled ''
|
2022-08-25 07:32:34 +00:00
|
|
|
mkdir -p themes
|
2022-08-21 21:46:49 +00:00
|
|
|
ln -snf "${theme}" "themes/${themeName}"
|
2022-08-25 07:32:34 +00:00
|
|
|
'' + linkFonts;
|
|
|
|
};
|
2022-08-27 03:54:29 +00:00
|
|
|
packages.docker = callPackage ./nix/docker.nix { site = self'.packages.default; };
|
|
|
|
apps.deploy.program =
|
|
|
|
let deploy = callPackage ./nix/deploy.nix { dockerImg = self'.packages.docker; };
|
|
|
|
in "${deploy}/bin/deploy";
|
2022-08-08 04:31:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|