diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-23 23:36:43 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-23 23:36:43 +0200 |
commit | 618e4580240c71a7ac866649e01439e75ef4d6a6 (patch) | |
tree | 52de219537f8e2ca4c24527eb8a5321f77277fc7 /home-modules/lmu-hausschrift | |
parent | f7c6f796fa348c2b3edfd9bc44d3e8533501681e (diff) | |
download | nixos-618e4580240c71a7ac866649e01439e75ef4d6a6.tar nixos-618e4580240c71a7ac866649e01439e75ef4d6a6.tar.gz nixos-618e4580240c71a7ac866649e01439e75ef4d6a6.tar.bz2 nixos-618e4580240c71a7ac866649e01439e75ef4d6a6.tar.xz nixos-618e4580240c71a7ac866649e01439e75ef4d6a6.zip |
...
Diffstat (limited to 'home-modules/lmu-hausschrift')
-rw-r--r-- | home-modules/lmu-hausschrift/default.nix | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/home-modules/lmu-hausschrift/default.nix b/home-modules/lmu-hausschrift/default.nix index c3344947..ceaf7252 100644 --- a/home-modules/lmu-hausschrift/default.nix +++ b/home-modules/lmu-hausschrift/default.nix | |||
@@ -24,24 +24,37 @@ with lib; | |||
24 | ''; | 24 | ''; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | systemd.user.services.sops-nix = { | 27 | systemd.user.services.unpack-lmu-hausschrift = { |
28 | Unit = { | ||
29 | ConditionPathExists = [ | ||
30 | "!%h/.local/share/lmu-hausschrift" | ||
31 | "!%t/lmu-hausschrift" | ||
32 | ]; | ||
33 | }; | ||
34 | Unit = { | ||
35 | After = ["sops-nix.service"]; | ||
36 | }; | ||
37 | Install = { | ||
38 | WantedBy = ["sops-nix.service"]; | ||
39 | }; | ||
28 | Service = { | 40 | Service = { |
29 | ExecStartPost = pkgs.writeShellScript "unpack-lmu-hausschrift.sh" '' | 41 | UMask = "07077"; |
42 | Environment = [ | ||
43 | "PATH=${lib.makeBinPath (with pkgs; [gnutar coreutils])}" | ||
44 | ]; | ||
45 | ExecStart = pkgs.writeShellScript "unpack-lmu-hausschrift.sh" '' | ||
30 | set -xe | 46 | set -xe |
31 | 47 | ||
32 | out=''${XDG_RUNTIME_DIR:-/tmp}/lmu-hausschrift | 48 | out=''${XDG_RUNTIME_DIR:-/tmp}/lmu-hausschrift |
33 | src="${config.sops.secrets."lmu-hausschrift.tar.zstd".path}" | 49 | src="${config.sops.secrets."lmu-hausschrift.tar.zstd".path}" |
34 | src=''${src#"%r/"} | 50 | if [[ "$src" =~ ^%r ]]; then |
35 | src=''${XDG_RUNTIME_DIR:-/tmp}/"''${src}" | 51 | src=''${src#"%r/"} |
36 | 52 | src=''${XDG_RUNTIME_DIR:-/tmp}/"''${src}" | |
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 | 53 | fi |
54 | |||
55 | mkdir -p "''${out}" | ||
56 | tar -xaf "''${src}" -C "''${out}" | ||
57 | ln -sfT "''${out}" "${config.home.homeDirectory}/.local/share/lmu-hausschrift" | ||
45 | ''; | 58 | ''; |
46 | }; | 59 | }; |
47 | }; | 60 | }; |