blob: ceaf725287eb607f9770c392649496487601b5fe (
plain)
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
|
{ config, pkgs, lib, ... }:
with lib;
{
options = {
fonts.lmu-hausschrift.enable = mkEnableOption "LMU Hausschrift";
};
config = mkIf config.fonts.lmu-hausschrift.enable {
sops.secrets."lmu-hausschrift.tar.zstd" = {
format = "binary";
sopsFile = ./lmu-hausschrift.tar.zstd;
};
xdg.configFile = {
"fontconfig/conf.d/20-lmu-hausschrift.conf".text = ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
<dir>${config.home.homeDirectory}/.local/share/lmu-hausschrift</dir>
</fontconfig>
'';
};
systemd.user.services.unpack-lmu-hausschrift = {
Unit = {
ConditionPathExists = [
"!%h/.local/share/lmu-hausschrift"
"!%t/lmu-hausschrift"
];
};
Unit = {
After = ["sops-nix.service"];
};
Install = {
WantedBy = ["sops-nix.service"];
};
Service = {
UMask = "07077";
Environment = [
"PATH=${lib.makeBinPath (with pkgs; [gnutar coreutils])}"
];
ExecStart = pkgs.writeShellScript "unpack-lmu-hausschrift.sh" ''
set -xe
out=''${XDG_RUNTIME_DIR:-/tmp}/lmu-hausschrift
src="${config.sops.secrets."lmu-hausschrift.tar.zstd".path}"
if [[ "$src" =~ ^%r ]]; then
src=''${src#"%r/"}
src=''${XDG_RUNTIME_DIR:-/tmp}/"''${src}"
fi
mkdir -p "''${out}"
tar -xaf "''${src}" -C "''${out}"
ln -sfT "''${out}" "${config.home.homeDirectory}/.local/share/lmu-hausschrift"
'';
};
};
};
}
|