summaryrefslogtreecommitdiff
path: root/home-modules/lmu-hausschrift/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-modules/lmu-hausschrift/default.nix')
-rw-r--r--home-modules/lmu-hausschrift/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/home-modules/lmu-hausschrift/default.nix b/home-modules/lmu-hausschrift/default.nix
new file mode 100644
index 00000000..c3344947
--- /dev/null
+++ b/home-modules/lmu-hausschrift/default.nix
@@ -0,0 +1,49 @@
1{ config, pkgs, lib, ... }:
2
3with lib;
4
5{
6 options = {
7 fonts.lmu-hausschrift.enable = mkEnableOption "LMU Hausschrift";
8 };
9
10 config = mkIf config.fonts.lmu-hausschrift.enable {
11 sops.secrets."lmu-hausschrift.tar.zstd" = {
12 format = "binary";
13 sopsFile = ./lmu-hausschrift.tar.zstd;
14 };
15
16 xdg.configFile = {
17 "fontconfig/conf.d/20-lmu-hausschrift.conf".text = ''
18 <?xml version='1.0'?>
19
20 <!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
21 <fontconfig>
22 <dir>${config.home.homeDirectory}/.local/share/lmu-hausschrift</dir>
23 </fontconfig>
24 '';
25 };
26
27 systemd.user.services.sops-nix = {
28 Service = {
29 ExecStartPost = pkgs.writeShellScript "unpack-lmu-hausschrift.sh" ''
30 set -xe
31
32 out=''${XDG_RUNTIME_DIR:-/tmp}/lmu-hausschrift
33 src="${config.sops.secrets."lmu-hausschrift.tar.zstd".path}"
34 src=''${src#"%r/"}
35 src=''${XDG_RUNTIME_DIR:-/tmp}/"''${src}"
36
37 umask 07077
38
39 if [[ ! -d "''${out}" ]]; then
40 ${pkgs.coreutils}/bin/mkdir -p "''${out}"
41 ${pkgs.gnutar}/bin/tar -xaf "''${src}" -C "''${out}"
42
43 ${pkgs.coreutils}/bin/ln -sfT "''${out}" "${config.home.homeDirectory}/.local/share/lmu-hausschrift"
44 fi
45 '';
46 };
47 };
48 };
49}