summaryrefslogtreecommitdiff
path: root/parts
diff options
context:
space:
mode:
Diffstat (limited to 'parts')
-rw-r--r--parts/checks.nix13
-rw-r--r--parts/dev-shells.nix19
-rw-r--r--parts/just.nix43
3 files changed, 75 insertions, 0 deletions
diff --git a/parts/checks.nix b/parts/checks.nix
new file mode 100644
index 0000000..7f95733
--- /dev/null
+++ b/parts/checks.nix
@@ -0,0 +1,13 @@
+{ pre-commit-hooks, system, ... }:
+{
+ checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
+ src = ./.;
+
+ hooks = {
+ deadnix.enable = true;
+ flake-checker.enable = true;
+ nixfmt-rfc-style.enable = true;
+ statix.enable = true;
+ };
+ };
+}
diff --git a/parts/dev-shells.nix b/parts/dev-shells.nix
new file mode 100644
index 0000000..09bb2fb
--- /dev/null
+++ b/parts/dev-shells.nix
@@ -0,0 +1,19 @@
+{
+ config,
+ pkgs,
+ self,
+ system,
+ ...
+}:
+{
+ devShells.default = pkgs.mkShell {
+ inherit (self.checks.${system}.pre-commit-check) shellHook;
+
+ buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
+
+ inputsFrom = [
+ config.flake-root.devShell
+ config.just-flake.outputs.devShell
+ ];
+ };
+}
diff --git a/parts/just.nix b/parts/just.nix
new file mode 100644
index 0000000..2062262
--- /dev/null
+++ b/parts/just.nix
@@ -0,0 +1,43 @@
+{
+ 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}}
+ '';
+ };
+}