mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-14 08:32:39 +02:00
refactor: Justfile
This commit is contained in:
@@ -9,26 +9,24 @@ set shell := ["nu", "-c"]
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
nixos-switch := "nixos-rebuild switch --use-remote-sudo --flake"
|
i3 mode="default":
|
||||||
debug-args := "--show-trace --verbose"
|
use utils.nu *; \
|
||||||
|
nixos-switch .#ai_i3 {{mode}}
|
||||||
|
|
||||||
i3:
|
hypr mode="default":
|
||||||
{{nixos-switch}} .#ai_i3
|
use utils.nu *; \
|
||||||
|
nixos-switch .#ai_hyprland {{mode}}
|
||||||
|
|
||||||
hypr:
|
|
||||||
{{nixos-switch}} .#ai_hyprland
|
|
||||||
|
|
||||||
s-i3:
|
s-i3 mode="default":
|
||||||
{{nixos-switch}} .#shoukei_i3
|
use utils.nu *; \
|
||||||
|
nixos-switch .#shoukei_i3 {{mode}}
|
||||||
|
|
||||||
s-hypr:
|
|
||||||
{{nixos-switch}} .#shoukei_hyprland
|
|
||||||
|
|
||||||
i3-debug:
|
s-hypr mode="default":
|
||||||
{{nixos-switch}} .#ai_i3 {{debug-args}}
|
use utils.nu *; \
|
||||||
|
nixos-switch .#shoukei_hyprland {{mode}}
|
||||||
|
|
||||||
hypr-debug:
|
|
||||||
{{nixos-switch}} .#ai_hyprland {{debug-args}}
|
|
||||||
|
|
||||||
up:
|
up:
|
||||||
nix flake update
|
nix flake update
|
||||||
@@ -58,31 +56,22 @@ gc:
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
darwin-prefix := "./result/sw/bin/darwin-rebuild"
|
|
||||||
darwin-switch := darwin-prefix + " switch --flake"
|
|
||||||
|
|
||||||
darwin-set-proxy:
|
darwin-set-proxy:
|
||||||
sudo python3 scripts/darwin_set_proxy.py
|
sudo python3 scripts/darwin_set_proxy.py
|
||||||
sleep 1sec
|
sleep 1sec
|
||||||
|
|
||||||
darwin-rollback:
|
darwin-rollback:
|
||||||
{{darwin-prefix}} rollback
|
rollback
|
||||||
|
|
||||||
ha: darwin-set-proxy
|
ha mode="default": darwin-set-proxy
|
||||||
nix build .#darwinConfigurations.harmonica.system
|
use utils.nu *; \
|
||||||
{{darwin-switch}} .#harmonica
|
darwin-build "harmonica" {{mode}}; \
|
||||||
|
darwin-switch "harmonica" {{mode}}
|
||||||
|
|
||||||
ha-debug: darwin-set-proxy
|
fe mode="default":
|
||||||
nom build .#darwinConfigurations.harmonica.system {{debug-args}}
|
use utils.nu *; \
|
||||||
{{darwin-switch}} .#harmonica {{debug-args}}
|
darwin-build "fern" {{mode}}; \
|
||||||
|
darwin-switch "fern" {{mode}}
|
||||||
fe: darwin-set-proxy
|
|
||||||
nix build .#darwinConfigurations.fern.system
|
|
||||||
{{darwin-switch}} .#fern
|
|
||||||
|
|
||||||
fe-debug: darwin-set-proxy
|
|
||||||
nom build .#darwinConfigurations.fern.system {{debug-args}}
|
|
||||||
{{darwin-switch}} .#fern {{debug-args}}
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ just i3 # deploy my pc with i3 window manager
|
|||||||
# just hypr # deploy my pc with hyprland compositor
|
# just hypr # deploy my pc with hyprland compositor
|
||||||
|
|
||||||
# or we can deploy with details
|
# or we can deploy with details
|
||||||
just i3-debug
|
just i3 debug
|
||||||
# just hypr-debug
|
# just hypr-debug
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -111,8 +111,8 @@ just ha
|
|||||||
just fe
|
just fe
|
||||||
|
|
||||||
# deploy with details
|
# deploy with details
|
||||||
just ha-debug
|
just ha debug
|
||||||
# just fe
|
# just fe debug
|
||||||
```
|
```
|
||||||
|
|
||||||
> [What y'all will need when Nix drives you to drink.](https://www.youtube.com/watch?v=Eni9PPPPBpg) (copy from hlissner's dotfiles, it really matches my feelings when I first started using NixOS...)
|
> [What y'all will need when Nix drives you to drink.](https://www.youtube.com/watch?v=Eni9PPPPBpg) (copy from hlissner's dotfiles, it really matches my feelings when I first started using NixOS...)
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# ================= NixOS related =========================
|
||||||
|
|
||||||
|
export def nixos-switch [
|
||||||
|
name: string
|
||||||
|
mode: string
|
||||||
|
] {
|
||||||
|
if "debug" == $mode {
|
||||||
|
nixos-rebuild switch --use-remote-sudo --flake $".#($name)" --show-trace --verbose
|
||||||
|
} else {
|
||||||
|
nixos-rebuild switch --use-remote-sudo --flake $".#($name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ================= macOS related =========================
|
||||||
|
|
||||||
|
const darwin_dir = './result/sw/bin'
|
||||||
|
|
||||||
|
export def darwin-build [
|
||||||
|
name: string
|
||||||
|
mode: string
|
||||||
|
] {
|
||||||
|
let target = $".#darwinConfigurations.($name).system"
|
||||||
|
with-env { PATH : ($env.PATH | prepend darwin_dir) } {
|
||||||
|
if "debug" == $mode {
|
||||||
|
nom build $target --show-trace --verbose
|
||||||
|
} else {
|
||||||
|
nix build $target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export def darwin-switch [
|
||||||
|
name: string
|
||||||
|
mode: string
|
||||||
|
] {
|
||||||
|
with-env { PATH : ($env.PATH | prepend darwin_dir) } {
|
||||||
|
if "debug" == $mode {
|
||||||
|
darwin-rebuild switch --flake $".#($name)" --show-trace --verbose
|
||||||
|
} else {
|
||||||
|
darwin-rebuild switch --flake $".#($name)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export def darwin-rollback [] {
|
||||||
|
with-env { PATH : ($env.PATH | prepend darwin_dir) } {
|
||||||
|
darwin-rebuild rollback
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user