2024-12-18 08:32:43 +03:00
|
|
|
options = --option eval-cache false --fallback --print-build-logs --verbose --extra-experimental-features pipe-operators
|
2024-09-08 04:13:43 +03:00
|
|
|
flake = .
|
|
|
|
hostname = $(shell hostname)
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-08-30 14:58:40 +03:00
|
|
|
help:
|
|
|
|
@printf "Please specify a target.\n"
|
|
|
|
|
2024-07-31 23:43:50 +03:00
|
|
|
android:
|
|
|
|
nix-on-droid switch --flake $(flake)
|
2024-08-20 18:41:55 +03:00
|
|
|
cp ~/.Wallpaper /sdcard/Download/Wallpaper.jpg
|
2024-09-19 22:53:08 +03:00
|
|
|
cp ~/.Wallpaper /sdcard/Download/Wallpaper.png
|
2024-07-31 23:43:50 +03:00
|
|
|
|
2024-12-14 00:32:18 +03:00
|
|
|
boot:
|
2024-04-03 14:27:56 +03:00
|
|
|
nixos-rebuild boot $(options) --flake $(flake)
|
|
|
|
|
2024-12-09 10:13:04 +03:00
|
|
|
cached:
|
|
|
|
$(eval options := $(subst eval-cache false,eval-cache true,$(options)))
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-07-31 23:43:50 +03:00
|
|
|
check:
|
2024-08-23 05:04:17 +03:00
|
|
|
nix flake check --show-trace
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-10-13 22:46:12 +03:00
|
|
|
# HACK: Fix ulimit switch issue. Test sometime in the future again.
|
2024-12-14 00:32:18 +03:00
|
|
|
# fix-ulimit:
|
|
|
|
# ulimit -n 999999999
|
2024-09-16 01:49:05 +03:00
|
|
|
|
2024-10-13 22:46:12 +03:00
|
|
|
# HACK: They broke switching in systemd service ffs.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/347315
|
2024-12-14 00:32:18 +03:00
|
|
|
# fix-unlock:
|
|
|
|
# pkill nixos-rebuild || true
|
2024-10-13 22:46:12 +03:00
|
|
|
|
2024-12-14 00:32:18 +03:00
|
|
|
nixconf:
|
|
|
|
mv /etc/nix/nix.conf_ /etc/nix/nix.conf || true
|
2024-12-09 10:13:04 +03:00
|
|
|
|
2024-09-16 04:38:01 +03:00
|
|
|
gc:
|
|
|
|
nix-collect-garbage -d
|
2024-12-13 11:30:43 +03:00
|
|
|
nix store gc
|
|
|
|
nix-store --gc
|
2024-09-16 04:38:01 +03:00
|
|
|
|
2024-09-16 01:49:05 +03:00
|
|
|
.PHONY: home
|
|
|
|
home:
|
|
|
|
home-manager switch -b old --flake $(flake)#$$USER
|
|
|
|
|
2024-09-30 11:56:30 +03:00
|
|
|
housekeep:
|
|
|
|
git gc --aggressive --no-cruft --prune=now
|
|
|
|
git fsck
|
|
|
|
|
2024-09-07 21:41:51 +03:00
|
|
|
# SOURCE: https://github.com/DeterminateSystems/nix-installer
|
2024-09-07 21:10:45 +03:00
|
|
|
install-system:
|
2024-09-07 21:41:51 +03:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
2024-09-07 21:10:45 +03:00
|
|
|
|
|
|
|
install-user:
|
|
|
|
curl -L https://nixos.org/nix/install | sh /dev/stdin --no-daemon
|
2024-09-07 18:19:41 +03:00
|
|
|
mkdir -p $$HOME/.config/nix
|
|
|
|
printf "experimental-features = nix-command flakes" > $$HOME/.config/nix/nix.conf
|
|
|
|
|
|
|
|
install-hm:
|
2024-07-31 23:43:50 +03:00
|
|
|
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
|
|
|
nix-channel --update
|
|
|
|
nix-shell '<home-manager>' -A install
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-08-16 06:10:58 +03:00
|
|
|
.PHONY: live
|
2024-05-24 19:28:16 +03:00
|
|
|
live:
|
2024-04-27 00:02:00 +03:00
|
|
|
nix build -o live $(options) $(flake)#nixosConfigurations.live.config.system.build.isoImage
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-12-09 10:13:04 +03:00
|
|
|
no-nixconf:
|
|
|
|
mv /etc/nix/nix.conf /etc/nix/nix.conf_ || true
|
|
|
|
|
2024-07-31 23:43:50 +03:00
|
|
|
reboot: boot
|
|
|
|
reboot
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-07-31 23:43:50 +03:00
|
|
|
show:
|
|
|
|
nix flake show
|
|
|
|
|
2024-12-14 00:32:18 +03:00
|
|
|
switch:
|
2024-07-31 23:43:50 +03:00
|
|
|
nixos-rebuild switch $(options) --flake $(flake)
|
2024-04-03 14:27:56 +03:00
|
|
|
|
2024-07-31 23:43:50 +03:00
|
|
|
update:
|
|
|
|
nix flake update
|
2024-04-28 23:29:50 +03:00
|
|
|
|
2024-09-30 11:56:30 +03:00
|
|
|
# NOTE: Run `housekeep` target to fix git fsck issues.
|
2024-04-28 23:29:50 +03:00
|
|
|
verify:
|
|
|
|
git verify-commit HEAD
|
2024-09-30 05:39:06 +03:00
|
|
|
git fsck
|
2024-08-17 14:55:03 +03:00
|
|
|
|
|
|
|
vm:
|
2024-09-08 04:13:43 +03:00
|
|
|
nix run $(options) $(flake)#nixosConfigurations.$(hostname).config.system.build.vm
|