From 93d9761e036d396011820b769fbaf8ae6b804e18 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Wed, 11 Jan 2023 21:53:21 -0500 Subject: [PATCH] justfiles --- Makefile | 28 +++------------------------- justfile | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 justfile diff --git a/Makefile b/Makefile index d1e5c5d..8732187 100644 --- a/Makefile +++ b/Makefile @@ -2,28 +2,6 @@ .PHONY: rebuild-macos ## Management - -git-add: - git add . - -update: update-neovim - -update-os: - sudo nixos-rebuild switch - -update-neovim: - nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' - -sync: - sudo nix-channel --update - nix-channel --update - -clean: - sudo nix-collect-garbage --delete-older-than 7d - home-manager expire-generations "-7 days" - -rebuild-macos: git-add - ./rebuild-macos.sh - -rebuild-ubuntu: git-add - ./rebuild-ubuntu.sh +install-just: + curl --proto '=https' --tlsv1.3 -sSf https://just.systems/install.sh | bash -s -- --to ~/ + sudo cp ~/just /usr/local/bin diff --git a/justfile b/justfile new file mode 100644 index 0000000..b186eac --- /dev/null +++ b/justfile @@ -0,0 +1,35 @@ +#!/usr/bin/env -S just --justfile + +# Naive check if /Users or /home for home. +OS := if "${HOME}" =~ '/U.*' { "macos" } else { "ubuntu" } +HOSTNAME := `hostname| sed 's/.local//'` + +git-add: + git add . + +update: update-neovim + +update-os: + sudo nixos-rebuild switch + +update-neovim: + nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' + +sync: + sudo nix-channel --update + nix-channel --update + +clean: + sudo nix-collect-garbage --delete-older-than 7d + home-manager expire-generations "-7 days" + +rebuild: git-add clean + just rebuild-{{OS}} + +rebuild-macos: + ./result/sw/bin/darwin-rebuild switch --flake ./hosts/{{HOSTNAME}} + +rebuild-ubuntu: + NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/tyrel/channels/nixpkgs:/nix/var/nix/profiles/per-user/tyrel/channels + nix run ./hosts/{{HOSTNAME}} switch -vv + home-manager switch --flake ./hosts/{{HOSTNAME}}