build: use home.activation instead of just for fonts

This commit is contained in:
winston 2023-05-14 12:26:55 +02:00
parent 2c7dd2d84c
commit c6ff52199a
Signed by: winston
GPG key ID: 3786770EDBC2B481
2 changed files with 18 additions and 11 deletions

View file

@ -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

View file

@ -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 ."