From c6ff52199adb41b9db57bb0898e5795e91e04b3e Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 14 May 2023 12:26:55 +0200 Subject: [PATCH] build: use `home.activation` instead of just for fonts --- home/apps/fonts.nix | 19 ++++++++++++++++++- justfile | 10 ---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/home/apps/fonts.nix b/home/apps/fonts.nix index 9944384..4175b00 100644 --- a/home/apps/fonts.nix +++ b/home/apps/fonts.nix @@ -1,4 +1,21 @@ -{pkgs, ...}: { +{ + config, + flakePath, + lib, + pkgs, + ... +}: { + home.activation = { + installCustomFonts = let + fontDirectory = + if pkgs.stdenv.isDarwin + then "${config.home.homeDirectory}/Library/Fonts" + else "${config.xdg.dataHome}/fonts"; + in + lib.hm.dag.entryAfter ["writeBoundary"] '' + install -Dm644 ${flakePath}/home/secrets/fonts/* "${fontDirectory}" + ''; + }; home.packages = with pkgs; [ (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) victor-mono diff --git a/justfile b/justfile index 0d02c30..3df8f8c 100644 --- a/justfile +++ b/justfile @@ -33,15 +33,5 @@ check *args: switch *args: @just rebuild switch {{args}} -# these will fail, should variables not be set -fontdir := if os() == "macos" { - env_var('HOME') + "/Library/Fonts" -} else { - env_var_or_default('XDG_DATA_HOME', env_var('HOME') + "/.local/share") + "/fonts" -} -# TODO: move these to the home.activation hook -install-fonts: - install -Dm644 {{justfile_directory()}}/home/secrets/fonts/* "{{fontdir}}" - fetch: @nix shell nixpkgs\#onefetch nixpkgs\#scc -c sh -c "onefetch --true-color never --no-bots -d lines-of-code && scc --no-cocomo ."