summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix1
-rw-r--r--justfile57
-rw-r--r--parts/just.nix49
3 files changed, 54 insertions, 53 deletions
diff --git a/flake.nix b/flake.nix
index 595c2a5..931e014 100644
--- a/flake.nix
+++ b/flake.nix
@@ -36,7 +36,6 @@
in {
imports = let parts = "${self}/parts";
in [
- "${parts}/just.nix"
(import "${parts}/checks.nix" { inherit pre-commit-hooks system; })
(import "${parts}/devenv.nix" { inherit config lib pkgs; })
];
diff --git a/justfile b/justfile
index 4f2f3c3..31874cc 100644
--- a/justfile
+++ b/justfile
@@ -1,4 +1,55 @@
-import 'just-flake.just'
-
default:
- @just --list
+ @just --list
+
+action target action:
+ git add . && rui --allow-unfree --allow-insecure {{target}} {{action}} -- --impure
+
+build target:
+ @uname | \
+ grep -q Darwin \
+ && just darwin_action {{target}} build \
+ || just action {{target}} build
+
+darwin_action target action:
+ nix run nix-darwin -- {{action}} --flake .#{{target}}
+
+switch target:
+ @uname | \
+ grep -q Darwin \
+ && just darwin_action {{target}} switch \
+ || just action {{target}} switch
+
+news user='ebisu':
+ rui home news --user {{user}} -- --impure
+
+check:
+ nix flake check
+
+fmt:
+ treefmt
+
+push message:
+ git add . && git commit -m "{{message}}" && git push origin main
+
+commit message:
+ git add . && git commit -m "{{message}}"
+
+restore path='.':
+ git restore --staged {{path}} && git restore {{path}}
+
+deploy hostname user='root' ip=hostname:
+ git add . && nixos-rebuild \
+ --flake .#{{hostname}} \
+ --target-host {{user}}@{{ip}} \
+ --use-remote-sudo \
+ switch
+
+provision ip hostname:
+ doas nix run github:nix-community/nixos-anywhere \
+ -- \
+ --flake .#{{hostname}} root@{{ip}}
+
+update:
+ nix flake metadata --json | \
+ jq -r '.locks.nodes | keys[] | select(. != "nixpkgs")' | \
+ xargs -I{} nix flake update {}
diff --git a/parts/just.nix b/parts/just.nix
deleted file mode 100644
index c7a78a7..0000000
--- a/parts/just.nix
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- just-flake.features.default = {
- enable = true;
-
- justfile = ''
- action target action:
- git add . && rui --allow-unfree --allow-insecure {{target}} {{action}} -- --impure
-
- build target:
- just action {{target}} build
-
- switch target:
- just action {{target}} switch
-
- news user='ebisu':
- rui home news --user {{user}} -- --impure
-
- check:
- nix flake check
-
- fmt:
- treefmt
-
- push message:
- git add . && git commit -m "{{message}}" && git push origin main
-
- commit message:
- git add . && git commit -m "{{message}}"
-
- restore path='.':
- git restore --staged {{path}} && git restore {{path}}
-
- deploy hostname user='root' ip=hostname:
- git add . && nixos-rebuild \
- --flake .#{{hostname}} \
- --target-host {{user}}@{{ip}} \
- --use-remote-sudo \
- switch
-
- provision ip hostname:
- doas nix run github:nix-community/nixos-anywhere \
- -- \
- --flake .#{{hostname}} root@{{ip}}
-
- update:
- nix flake metadata --json | jq -r '.locks.nodes | keys[] | select(. != "nixpkgs")' | xargs -I{} nix flake update {}
- '';
- };
-}