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