-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
79 lines (68 loc) · 2.14 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
description = "Flake for building different-name.dev";
inputs = {
anemone = {
url = "github:Speyll/anemone";
flake = false;
};
catppuccin-bat = {
url = "github:catppuccin/bat";
flake = false;
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
perSystem = {
self',
pkgs,
...
}: let
inherit (inputs) anemone catppuccin-bat;
themeName = (builtins.fromTOML (builtins.readFile "${anemone}/theme.toml")).name;
tmThemeName = "Catppuccin Mocha.tmTheme";
in {
packages = {
different-name-blog = pkgs.stdenv.mkDerivation {
pname = "different-name-blog";
version = "2024-09-10";
src = ./.;
nativeBuildInputs = with pkgs; [zola];
configurePhase = ''
mkdir -p "themes/${themeName}"
cp -r ${anemone}/. "themes/${themeName}"
mkdir -p "highlight_themes"
cp "${catppuccin-bat}/themes/${tmThemeName}" "highlight_themes"
'';
buildPhase = "zola build";
installPhase = "cp -r public $out";
};
default = self'.packages.different-name-blog;
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [zola];
shellHook = let
themePath = "themes/${themeName}";
tmThemePath = "highlight_themes/${tmThemeName}";
in ''
mkdir -p themes
if [ -L "${themePath}" ]; then
rm "${themePath}"
fi
ln -sn "${anemone}" "${themePath}"
mkdir -p highlight_themes
if [ -L "${tmThemePath}" ]; then
rm "${tmThemePath}"
fi
ln -sn "${catppuccin-bat}/themes/${tmThemeName}" "${tmThemePath}"
'';
};
};
};
}