Misc optimizations

This commit is contained in:
2025-12-29 01:49:59 -07:00
parent b6d9e944d0
commit a4e61d4446
6 changed files with 77 additions and 37 deletions

View File

@@ -22,43 +22,7 @@ help:
@echo " make edit - edit settings.nix"
init:
@if [ -f "$(SETTINGS)" ]; then \
echo "$(YELLOW)settings.nix exists. overwrite? [y/N]$(NC)"; \
read -r confirm; \
if [ "$$confirm" != "y" ] && [ "$$confirm" != "Y" ]; then \
echo "keeping existing settings"; \
exit 0; \
fi; \
fi
@username=$$(whoami); \
userdesc=$$(getent passwd $$username | cut -d: -f5 | cut -d, -f1); \
userdesc=$${userdesc:-$$username}; \
echo "user: $$username ($$userdesc)"; \
echo ""; \
echo "hostname:"; \
read -r hostname; \
echo "timezone [America/Edmonton]:"; \
read -r tz; \
tz=$${tz:-America/Edmonton}; \
echo "locale [en_CA.UTF-8]:"; \
read -r locale; \
locale=$${locale:-en_CA.UTF-8}; \
echo ""; \
echo "{" > $(SETTINGS); \
echo " hostname = \"$$hostname\";" >> $(SETTINGS); \
echo " username = \"$$username\";" >> $(SETTINGS); \
echo " userDescription = \"$$userdesc\";" >> $(SETTINGS); \
echo " timezone = \"$$tz\";" >> $(SETTINGS); \
echo " locale = \"$$locale\";" >> $(SETTINGS); \
echo " userGroups = [ \"networkmanager\" \"wheel\" \"docker\" \"plugdev\" ];" >> $(SETTINGS); \
echo "}" >> $(SETTINGS); \
echo "wrote settings.nix"
@if [ -f "/etc/nixos/hardware-configuration.nix" ]; then \
cp /etc/nixos/hardware-configuration.nix $(REPO_DIR)/hardware-configuration.nix; \
echo "copied hardware-configuration.nix"; \
else \
echo "$(YELLOW)no hardware-configuration.nix found - run nixos-generate-config first$(NC)"; \
fi
@./scripts/init.sh
@$(MAKE) --no-print-directory link
@echo ""
@echo "done. run 'make rebuild' when ready"