Move theme config to separate file

pull/1/head
mat ess 2022-08-27 14:42:04 -04:00
parent c8dd5a2df4
commit e8a2567cef
2 changed files with 20 additions and 13 deletions

View File

@ -12,11 +12,6 @@
};
outputs = { self, flake-parts, ... }@inputs:
let
themeEnabled = false;
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;
@ -25,6 +20,10 @@
inherit (pkgs) callPackage;
optimize-images = callPackage ./nix/optimize-images.nix { };
inherit (callPackage ./nix/fonts.nix { }) copyFonts linkFonts;
inherit (callPackage ./nix/theme.nix {
theme = inputs.apollo;
themeEnabled = false;
}) copyTheme linkTheme;
in
{
packages.default = with pkgs; stdenv.mkDerivation {
@ -32,10 +31,7 @@
version = "2022-08-21";
src = ./.;
nativeBuildInputs = [ optimize-images zola ];
configurePhase = lib.optionalString themeEnabled ''
mkdir -p themes/${themeName}
cp -r ${theme}/* themes/${themeName}
'' + copyFonts;
configurePhase = copyTheme + copyFonts;
buildPhase = ''
optimize-images
zola build
@ -47,10 +43,7 @@
};
devShells.default = with pkgs; mkShell {
packages = [ flyctl optimize-images zola ];
shellHook = lib.optionalString themeEnabled ''
mkdir -p themes
ln -snf "${theme}" "themes/${themeName}"
'' + linkFonts;
shellHook = linkTheme + linkFonts;
};
packages.docker = callPackage ./nix/docker.nix { site = self'.packages.default; };
apps.deploy.program =

14
nix/theme.nix Normal file
View File

@ -0,0 +1,14 @@
{ lib, theme, themeEnabled }:
let
themeName = ((builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name);
in
{
copyTheme = lib.optionalString themeEnabled ''
mkdir -p themes/${themeName}
cp -r ${theme}/* themes/${themeName}
'';
linkTheme = lib.optionalString themeEnabled ''
mkdir -p themes
ln -snf "${theme}" "themes/${themeName}"
'';
}