diff --git a/Makefile b/Makefile deleted file mode 100644 index 2db8702..0000000 --- a/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -SHELL := bash -.SHELLFLAGS := -eu -o pipefail -c -.DELETE_ON_ERROR: -MAKEFLAGS += --warn-undefined-variables -MAKEFLAGS += --no-builtin-rules - -HOSTNAME ?= $(shell hostname) -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Linux) - SWITCH_CMD := nixos-rebuild --use-remote-sudo -I nixos-config="machines/$(HOSTNAME)/configuration.nix" switch --flake '.\#' -endif -ifeq ($(UNAME_S),Darwin) - SWITCH_CMD := exec darwin-rebuild switch --flake . -endif - -switch: - $(SWITCH_CMD) - -rollback: - nixos-rebuild --use-remote-sudo switch --rollback -I nixos-config="machines/$(HOSTNAME)/configuration.nix" - -update: - @./nix-flake-update.sh - -fmt: - nixpkgs-fmt . diff --git a/README.md b/README.md index 092f33d..404e4f7 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,18 @@ The configuration is very specific to my own machines and setup, but it may be a > on macOS: install the latest unstable nix from https://github.com/numtide/nix-unstable-installer (for nix flakes), > and nix-darwin: https://github.com/LnL7/nix-darwin -To run a rebuild: +Recipes are stored in a justfile. [just](https://github.com/casey/just) is required. + +To run a nixos rebuild: ```sh -make +just build-linux +``` + +To Run a darwin rebuild: + +```sh +just build-mac ``` ## Update @@ -20,7 +28,7 @@ make To update nixpkgs defined in [flake.nix](./flake.nix), run: ```sh -make update +just update ``` If there are updates, they should be reflected in [flake.lock](./flake.lock). @@ -30,7 +38,7 @@ If there are updates, they should be reflected in [flake.lock](./flake.lock). To rollback to the previous generation: ```sh -make rollback +just rollback ``` ## Pre-commit hooks diff --git a/flake.lock b/flake.lock index 488f36d..2687613 100644 --- a/flake.lock +++ b/flake.lock @@ -30,11 +30,11 @@ ] }, "locked": { - "lastModified": 1710255615, - "narHash": "sha256-DFooGP2D6cNfOj35qkptUgG0r+VxuI38QgNAoYxmVE0=", + "lastModified": 1710281379, + "narHash": "sha256-uFo9hxt982L3nFJeweW4Gip2esiGrIQlbvEGrNTh4AY=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "c7ae5dc969b93f3221f5c228f0ec3de3e2b8084e", + "rev": "d9ea313bc4851670dc99c5cc979cb79750e7d670", "type": "github" }, "original": { @@ -155,11 +155,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1710162809, - "narHash": "sha256-i2R2bcnQp+85de67yjgZVvJhd6rRnJbSYNpGmB6Leb8=", + "lastModified": 1710283656, + "narHash": "sha256-nI+AOy4uK6jLGBi9nsbHjL1EdSIzoo8oa+9oeVhbyFc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ddcd7598b2184008c97e6c9c6a21c5f37590b8d2", + "rev": "51063ed4f2343a59fdeebb279bb81d87d453942b", "type": "github" }, "original": { @@ -187,11 +187,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1710252211, - "narHash": "sha256-hQChQpB4LDBaSrNlD6DPLhU9T+R6oyxMCg2V+S7Y1jg=", + "lastModified": 1710313540, + "narHash": "sha256-HtTTpGe0azsEJVaT9RvbGFGB4idUneraLiUTxFb3ABM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7eeacecff44e05a9fd61b9e03836b66ecde8a525", + "rev": "4008381882569ab4773f2ba0d7b7bbde8f665672", "type": "github" }, "original": { diff --git a/justfile b/justfile new file mode 100644 index 0000000..6965e72 --- /dev/null +++ b/justfile @@ -0,0 +1,18 @@ +set export + +host := `hostname` + +build-linux: + nixos-rebuild --use-remote-sudo -I nixos-config=machines/$host/configuration.nix switch --flake . + +build-mac: + darwin-rebuild switch --flake . + +rollback: + nixos-rebuild --use-remote-sudo switch --rollback -I nixos-config="machines/$host/configuration.nix" + +update: + @./nix-flake-update.sh + +fmt: + nixpkgs-fmt . diff --git a/nix-flake-update.sh b/nix-flake-update.sh index 0542e15..0ce481f 100755 --- a/nix-flake-update.sh +++ b/nix-flake-update.sh @@ -2,9 +2,18 @@ set -euo pipefail +arch=$(uname -s) + git pull update_msg=$(nix flake update 2>&1 | grep -v 'warning:') -make +if [[ $arch == "Linux" ]]; then + just build-linux +elif [[ $arch == "Darwin" ]]; then + just build-darwin +else + echo "Unsupported OS: $arch" + exit 1 +fi git add . git commit -S -m "nix flake update: $(TZ=UTC date '+%Y-%m-%d %H:%M:%S %Z') diff --git a/packages.nix b/packages.nix index 4ce60a7..c6380c7 100644 --- a/packages.nix +++ b/packages.nix @@ -25,6 +25,7 @@ in eza fd hadolint + just nodePackages.eslint oha pre-commit