summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-05 15:22:39 -0700
committerFuwn <[email protected]>2024-10-05 15:22:39 -0700
commitdf4e166a5ec9d227cabc03a0b548576cf855be1a (patch)
tree733aa0e5dd237c5ea73877564d24cfbcc0ae014f
parentsuzuri: use tsutsumi path (diff)
downloadnixos-config-df4e166a5ec9d227cabc03a0b548576cf855be1a.tar.xz
nixos-config-df4e166a5ec9d227cabc03a0b548576cf855be1a.zip
just: move justfile to just-flake in flake.nix
-rw-r--r--.gitignore1
-rw-r--r--flake.lock16
-rw-r--r--flake.nix53
-rw-r--r--justfile42
4 files changed, 74 insertions, 38 deletions
diff --git a/.gitignore b/.gitignore
index 0189cdc..6027fc4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ result*
.direnv
.DS_Store
.pre-commit-config.yaml
+just-flake.just
diff --git a/flake.lock b/flake.lock
index 708e321..148859f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -731,6 +731,21 @@
"type": "github"
}
},
+ "just-flake": {
+ "locked": {
+ "lastModified": 1713316411,
+ "narHash": "sha256-NkJfU6H+6vgHkPtZ2ESbZ/h2wnsDQrZvB4vbdUIBx8Q=",
+ "owner": "juspay",
+ "repo": "just-flake",
+ "rev": "0e33952a4bcd16cd54ee3aba8111606c237d4526",
+ "type": "github"
+ },
+ "original": {
+ "owner": "juspay",
+ "repo": "just-flake",
+ "type": "github"
+ }
+ },
"maple": {
"inputs": {
"flake-compat": [
@@ -1294,6 +1309,7 @@
"hyprfocus": "hyprfocus",
"hyprland": "hyprland",
"hyprland-plugins": "hyprland-plugins",
+ "just-flake": "just-flake",
"nix-alien": "nix-alien",
"nix-filter": "nix-filter",
"nix-gaming": "nix-gaming",
diff --git a/flake.nix b/flake.nix
index f13a435..fa4d1ce 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,6 +4,7 @@
flake-root,
flake-parts,
home-manager,
+ just-flake,
nixpkgs,
pre-commit-hooks,
self,
@@ -29,6 +30,7 @@
imports = [
flake-root.flakeModule
+ just-flake.flakeModule
(import ./home {
inherit
@@ -64,6 +66,50 @@
packages.default = home-manager.defaultPackage."${system}";
formatter = pkgs.nixfmt-rfc-style;
+ just-flake.features = {
+ default = {
+ enable = true;
+
+ justfile = ''
+ action target action:
+ git add . && nix develop --command 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 develop --command nix flake check
+
+ push message:
+ git add . && git commit -m "{{message}}" && git push origin main
+
+ commit message:
+ git add . && git commit -m "{{message}}"
+
+ restore:
+ git restore --staged . && git restore .
+
+ deploy hostname user='root':
+ git add . && nixos-rebuild \
+ --flake .#{{hostname}} \
+ --target-host {{user}}@{{hostname}} \
+ --use-remote-sudo \
+ switch
+
+ provision ip hostname:
+ doas nix run github:nix-community/nixos-anywhere \
+ -- \
+ --flake .#{{hostname}} root@{{ip}}
+ '';
+ };
+ };
+
checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
@@ -79,7 +125,11 @@
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
- inputsFrom = [ config.flake-root.devShell ];
+
+ inputsFrom = [
+ config.flake-root.devShell
+ config.just-flake.outputs.devShell
+ ];
};
};
};
@@ -87,6 +137,7 @@
inputs = {
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
flake-root.url = "github:srid/flake-root";
+ just-flake.url = "github:juspay/just-flake";
nur.url = "github:nix-community/NUR";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/24.05";
diff --git a/justfile b/justfile
index ad19269..80c4fae 100644
--- a/justfile
+++ b/justfile
@@ -1,38 +1,6 @@
-default:
- @just --list
-
-action target action:
- git add . && nix develop --command 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 develop --command nix flake check
+# See flake.nix (just-flake)
+import 'just-flake.just'
-push message:
- git add . && git commit -m "{{message}}" && git push origin main
-
-commit message:
- git add . && git commit -m "{{message}}"
-
-restore:
- git restore --staged . && git restore .
-
-deploy hostname user='root':
- git add . && nixos-rebuild \
- --flake .#{{hostname}} \
- --target-host {{user}}@{{hostname}} \
- --use-remote-sudo \
- switch
-
-provision ip hostname:
- doas nix run github:nix-community/nixos-anywhere \
- -- \
- --flake .#{{hostname}} root@{{ip}}
+# Display the list of recipes
+default:
+ @just --list