Flake lock file updates: • Updated input 'flake-compat': 'github:edolstra/flake-compat/ff81ac966bb2cae68946d5ed5fc4994f96d0ffec' (2024-12-04) → 'github:edolstra/flake-compat/9100a0f413b0c601e0533d1d94ffd501ce2e7885' (2025-05-12) • Updated input 'home-manager': 'github:nix-community/home-manager/de496c9ccb705ed76c1f23c2cad13e8970c37f0b' (2025-05-11) → 'github:nix-community/home-manager/ae755329092c87369b9e9a1510a8cf1ce2b1c708' (2025-05-16) • Updated input 'nix-darwin': 'github:LnL7/nix-darwin/6cb36e8327421c61e5a3bbd08ed63491b616364a' (2025-05-08) → 'github:LnL7/nix-darwin/8e251e45346e9d58e0eece2512e40c183f967e8f' (2025-05-17) • Updated input 'nix-index-database': 'github:nix-community/nix-index-database/e9b21b01e4307176b9718a29ac514838e7f6f4ff' (2025-05-11) → 'github:nix-community/nix-index-database/c1f63a0c3bf1b2fe05124ccb099333163e2184a7' (2025-05-17) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/b3582c75c7f21ce0b429898980eddbbf05c68e55' (2025-05-07) → 'github:nixos/nixpkgs/12a55407652e04dcf2309436eb06fef0d3713ef3' (2025-05-16) • Updated input 'nixpkgs-stable': 'github:nixos/nixpkgs/97f265593a4888d1f4df1d924cf82dceb9fe561a' (2025-05-08) → 'github:nixos/nixpkgs/6b051131813a84c88cf5651c5ecb8c54f03ab6d6' (2025-05-17)
66 lines
1.9 KiB
Makefile
66 lines
1.9 KiB
Makefile
in_nix_shell := env_var_or_default("IN_NIX_SHELL", "false")
|
|
root_dir := justfile_directory()
|
|
hostname := `scutil --get LocalHostName`
|
|
|
|
# choose a just command to run
|
|
default:
|
|
@just --choose
|
|
|
|
# show available just commands
|
|
help:
|
|
@just --list --unsorted --list-heading $'Available commands:\n'
|
|
|
|
forecast:
|
|
nix-forecast -s -c {{ root_dir }}#darwinConfigurations.{{ hostname }} | \
|
|
tee -p /tmp/nix-forecast.txt | head -4
|
|
@echo "Packages to be built:"
|
|
@cat /tmp/nix-forecast.txt | grep "/nix/store/" | \
|
|
grep -Pv "\-completions$|\.zip$|\.patch$|\.lock$|\.fish$|\.sh$|\.json$|\.conf$|\.keep$|\.md$" | \
|
|
cut -c 45- | sort | nl
|
|
|
|
_run cmd:
|
|
#!/usr/bin/env -S sh -eu
|
|
if [ "{{ in_nix_shell }}" = "false" ]; then
|
|
nix-shell "{{ root_dir }}/shell.nix" --run "just \"{{ root_dir }}/{{ cmd }}\""
|
|
else
|
|
just "{{ root_dir }}/{{ cmd }}"
|
|
fi
|
|
|
|
_build:
|
|
nom build --show-trace {{ root_dir }}#darwinConfigurations.{{ hostname }}.system
|
|
|
|
# build nix-darwin system
|
|
build: (_run "_build")
|
|
|
|
_switch: _build
|
|
sudo ./result/sw/bin/darwin-rebuild -v switch --flake "{{ root_dir }}"
|
|
|
|
# build nix-darwin system and switch to it
|
|
switch: (_run "_switch") && _report-changes
|
|
|
|
_update: && _switch _brew-update _report-changes
|
|
nix flake update --commit-lock-file --flake {{ root_dir }}
|
|
|
|
_brew-update:
|
|
brew update
|
|
brew upgrade
|
|
mas upgrade
|
|
|
|
_report-changes:
|
|
#!/bin/bash
|
|
if [ $(ls -d1v /nix/var/nix/profiles/system-*-link 2>/dev/null | wc -l) -lt 2 ]; then
|
|
echo "Skipping changes report..."
|
|
else
|
|
nvd diff $(/bin/ls -d1v /nix/var/nix/profiles/system-*-link | tail -2)
|
|
fi
|
|
|
|
# update packages and switch
|
|
update: (_run "_update")
|
|
|
|
# clean up garbage
|
|
clean days="7":
|
|
home-manager expire-generations "-{{days}} days"
|
|
nix profile wipe-history --older-than "{{days}}d"
|
|
sudo nix-collect-garbage -d --delete-older-than {{days}}d
|
|
brew cleanup --prune {{days}}
|