diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 34ef35a..56072f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ nix.conf +.direnv diff --git a/flake.nix b/flake.nix index 94aabfd..09bdf62 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,17 @@ avatar = "/var/lib/AccountsService/icons/cianh"; }; in { + # A temporary devshell for running system management functions + devShells."x86_64-linux".default = let + pkgs = import nixpkgs {system = "x86_64-linux";}; + in + pkgs.mkShell { + packages = [ + pkgs.babashka + (pkgs.python3.withPackages (ps: with ps; [typer rich])) + ]; + }; + # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { diff --git a/justfile b/justfile index 995f00c..5a16531 100644 --- a/justfile +++ b/justfile @@ -99,12 +99,12 @@ cleanup days="": # Open the editor (nvim, yazi, or heh) for a target edit target: - @scripts/edit.py "{{target}}" + @direnv exec . scripts/edit.py "{{target}}" # Edit packages.nix for a specific system/user (run 'just packages help' for flags) packages *flags: - @scripts/packages.bb {{flags}} + @direnv exec . scripts/packages.bb {{flags}} # Bootstrap a fresh system from the repo bootstrap: - @scripts/bootstrap.py + @direnv exec . scripts/bootstrap.py diff --git a/scripts/boostrap.py b/scripts/boostrap.py index ca7602a..117f6c8 100755 --- a/scripts/boostrap.py +++ b/scripts/boostrap.py @@ -1,5 +1,4 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ typer rich ])" +#!/usr/bin/env python3 import os import sys import subprocess diff --git a/scripts/edit.py b/scripts/edit.py index 2f58c2f..d94f0c1 100755 --- a/scripts/edit.py +++ b/scripts/edit.py @@ -1,5 +1,4 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ typer rich ])" +#!/usr/bin/env python3 import typer import subprocess from pathlib import Path diff --git a/scripts/packages.bb b/scripts/packages.bb index 870b2cd..95fe3bb 100755 --- a/scripts/packages.bb +++ b/scripts/packages.bb @@ -1,5 +1,4 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bb -p babashka +#!/usr/bin/env bb (require '[babashka.cli :as cli] '[babashka.process :refer [shell]]