mirror of
https://github.com/smg1024/nix-darwin.git
synced 2026-05-22 20:32:59 +09:00
81 lines
2.1 KiB
Makefile
81 lines
2.1 KiB
Makefile
# just is a command runner, Justfile is very similar to Makefile, but simpler.
|
|
|
|
# FIXME update hostname here!
|
|
hostname := "fenrir"
|
|
|
|
# List all the just commands
|
|
default:
|
|
@just --list
|
|
|
|
############################################################################
|
|
#
|
|
# Darwin related commands
|
|
#
|
|
############################################################################
|
|
|
|
[group('desktop')]
|
|
darwin:
|
|
nix build .#darwinConfigurations.{{hostname}}.system \
|
|
--extra-experimental-features 'nix-command flakes'
|
|
|
|
sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}}
|
|
|
|
[group('desktop')]
|
|
darwin-debug:
|
|
nix build .#darwinConfigurations.{{hostname}}.system --show-trace --verbose \
|
|
--extra-experimental-features 'nix-command flakes'
|
|
|
|
sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} --show-trace --verbose
|
|
|
|
############################################################################
|
|
#
|
|
# nix related commands
|
|
#
|
|
############################################################################
|
|
|
|
# Update all the flake inputs
|
|
[group('nix')]
|
|
up:
|
|
nix flake update
|
|
|
|
# Update specific input
|
|
# Usage: just upp nixpkgs
|
|
[group('nix')]
|
|
upp input:
|
|
nix flake update {{input}}
|
|
|
|
# List all generations of the system profile
|
|
[group('nix')]
|
|
history:
|
|
nix profile history --profile /nix/var/nix/profiles/system
|
|
|
|
# Open a nix shell with the flake
|
|
[group('nix')]
|
|
repl:
|
|
nix repl -f flake:nixpkgs
|
|
|
|
# remove all generations older than 7 days
|
|
# on darwin, you may need to switch to root user to run this command
|
|
[group('nix')]
|
|
clean:
|
|
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
|
|
|
# Garbage collect all unused nix store entries
|
|
[group('nix')]
|
|
gc:
|
|
# garbage collect all unused nix store entries(system-wide)
|
|
sudo nix-collect-garbage --delete-older-than 7d
|
|
# garbage collect all unused nix store entries(for the user - home-manager)
|
|
# https://github.com/NixOS/nix/issues/8508
|
|
nix-collect-garbage --delete-older-than 7d
|
|
|
|
[group('nix')]
|
|
fmt:
|
|
# format the nix files in this repo
|
|
nix fmt
|
|
|
|
# Show all the auto gc roots in the nix store
|
|
[group('nix')]
|
|
gcroot:
|
|
ls -al /nix/var/nix/gcroots/auto/
|
|
|