mirror of
https://github.com/davegallant/nix-config
synced 2025-08-05 23:03:40 +00:00
Move from make to just
This commit is contained in:
27
Makefile
27
Makefile
@@ -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 .
|
|
16
README.md
16
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),
|
> 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
|
> 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
|
```sh
|
||||||
make
|
just build-linux
|
||||||
|
```
|
||||||
|
|
||||||
|
To Run a darwin rebuild:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
just build-mac
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update
|
## Update
|
||||||
@@ -20,7 +28,7 @@ make
|
|||||||
To update nixpkgs defined in [flake.nix](./flake.nix), run:
|
To update nixpkgs defined in [flake.nix](./flake.nix), run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make update
|
just update
|
||||||
```
|
```
|
||||||
|
|
||||||
If there are updates, they should be reflected in [flake.lock](./flake.lock).
|
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:
|
To rollback to the previous generation:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make rollback
|
just rollback
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pre-commit hooks
|
## Pre-commit hooks
|
||||||
|
18
flake.lock
generated
18
flake.lock
generated
@@ -30,11 +30,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710255615,
|
"lastModified": 1710281379,
|
||||||
"narHash": "sha256-DFooGP2D6cNfOj35qkptUgG0r+VxuI38QgNAoYxmVE0=",
|
"narHash": "sha256-uFo9hxt982L3nFJeweW4Gip2esiGrIQlbvEGrNTh4AY=",
|
||||||
"owner": "lnl7",
|
"owner": "lnl7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "c7ae5dc969b93f3221f5c228f0ec3de3e2b8084e",
|
"rev": "d9ea313bc4851670dc99c5cc979cb79750e7d670",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -155,11 +155,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710162809,
|
"lastModified": 1710283656,
|
||||||
"narHash": "sha256-i2R2bcnQp+85de67yjgZVvJhd6rRnJbSYNpGmB6Leb8=",
|
"narHash": "sha256-nI+AOy4uK6jLGBi9nsbHjL1EdSIzoo8oa+9oeVhbyFc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ddcd7598b2184008c97e6c9c6a21c5f37590b8d2",
|
"rev": "51063ed4f2343a59fdeebb279bb81d87d453942b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -187,11 +187,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710252211,
|
"lastModified": 1710313540,
|
||||||
"narHash": "sha256-hQChQpB4LDBaSrNlD6DPLhU9T+R6oyxMCg2V+S7Y1jg=",
|
"narHash": "sha256-HtTTpGe0azsEJVaT9RvbGFGB4idUneraLiUTxFb3ABM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7eeacecff44e05a9fd61b9e03836b66ecde8a525",
|
"rev": "4008381882569ab4773f2ba0d7b7bbde8f665672",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
18
justfile
Normal file
18
justfile
Normal file
@@ -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 .
|
@@ -2,9 +2,18 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
arch=$(uname -s)
|
||||||
|
|
||||||
git pull
|
git pull
|
||||||
update_msg=$(nix flake update 2>&1 | grep -v 'warning:')
|
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 add .
|
||||||
git commit -S -m "nix flake update: $(TZ=UTC date '+%Y-%m-%d %H:%M:%S %Z')
|
git commit -S -m "nix flake update: $(TZ=UTC date '+%Y-%m-%d %H:%M:%S %Z')
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ in
|
|||||||
eza
|
eza
|
||||||
fd
|
fd
|
||||||
hadolint
|
hadolint
|
||||||
|
just
|
||||||
nodePackages.eslint
|
nodePackages.eslint
|
||||||
oha
|
oha
|
||||||
pre-commit
|
pre-commit
|
||||||
|
Reference in New Issue
Block a user