nix-config/hosts/poppy/default.nix
mikl 0fe7665072 poppy: add weekly nix GC launchd agent (delete-older-than 14d)
nix.gc.automatic requires nix.enable=true, but poppy uses the
Determinate nix installer (nix.enable=false). Define a launchd
user agent directly that runs nix-collect-garbage --delete-older-than 14d
weekly at Sun 03:00.
2026-07-16 13:16:50 +03:00

64 lines
2.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ pkgs, ... }: {
imports = [ ./apps.nix ./system.nix ];
networking.hostName = "poppy";
# Локальное короткое имя pi -> 127.0.0.1 для pi-web.
# Запуск: npm exec @agegr/pi-web@latest --hostname 0.0.0.0 --port 30141
# Ссылка: http://pi:30141
# (networking.hosts в nix-darwin отсутствует; /etc/hosts правится
# идемпотентно через extraActivation — один из хуков, реально
# вызываемых в activate-скрипте.)
system.activationScripts.extraActivation.text = ''
if ! grep -qE '^[0-9.]+[[:space:]]+pi($|[[:space:]])' /etc/hosts; then
printf '127.0.0.1\tpi # pi-web local alias\n' >> /etc/hosts
fi
'';
system.primaryUser = "mikl";
system.stateVersion = 7;
nixpkgs.config.allowUnfree = true;
nix.enable = false;
# Автоматический сбор мусора: удалять пути старше 14 дней, по ночам в 3:00.
# nix.gc не работает с nix.enable=false, поэтому launchd-агент напрямую.
launchd.user.agents.nix-gc = {
serviceConfig = {
Label = "local.nix.gc";
ProgramArguments = [
"/nix/var/nix/profiles/default/bin/nix-collect-garbage"
"--delete-older-than"
"14d"
];
StartCalendarInterval = {
Weekday = 0;
Hour = 3;
};
StandardOutPath = "/tmp/nix-gc.log";
StandardErrorPath = "/tmp/nix-gc.log";
};
};
users.users.mikl = {
home = "/Users/mikl";
shell = pkgs.zsh;
};
environment.systemPackages = [ pkgs.vim ];
# Apply default apps via duti on activation
system.activationScripts.defaultApps.text = ''
if [ -f "/Users/mikl/.config/duti/config" ]; then
${pkgs.duti}/bin/duti -d /Users/mikl/.config/duti/config || true
fi
'';
home-manager.users.mikl = {
imports = [ ../../home/kitty.nix ../../home/duti.nix ];
programs.zsh.shellAliases = {
switch = "darwin-rebuild switch --flake .#poppy";
update = "nix flake update && darwin-rebuild switch --flake .#poppy";
cleanup = "nix-collect-garbage -d";
};
};
}