From c214a560f0500e4be077086e557c3e6d336c7c27 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 7 Jul 2025 16:03:51 -0700 Subject: move scripts managed by nix out of the flake In order to keep the flake readable, the various scripts managed by nix are now moved to their own files under `nix/scripts`. --- nix/scripts/darwin.nix | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 nix/scripts/darwin.nix (limited to 'nix/scripts/darwin.nix') diff --git a/nix/scripts/darwin.nix b/nix/scripts/darwin.nix new file mode 100644 index 0000000..c1bbbde --- /dev/null +++ b/nix/scripts/darwin.nix @@ -0,0 +1,38 @@ +{ + pkgs, + system, + inputs, +}: +[ + (pkgs.writeScriptBin "nbuild" '' + set -e + echo "> Running darwin-rebuild build..." + ${inputs.darwin.packages.${system}.darwin-rebuild}/bin/darwin-rebuild build --flake . + echo "> darwin-rebuild build was successful ✅" + echo "> macOS config was successfully applied 🚀" + '') + + (pkgs.writeScriptBin "nswitch" '' + set -e + echo "> Running darwin-rebuild switch..." + ${inputs.darwin.packages.${system}.darwin-rebuild}/bin/darwin-rebuild switch --flake . + echo "> darwin-rebuild build was successful ✅" + echo "> macOS config was successfully applied 🚀" + '') + + (pkgs.writeScriptBin "switch-vm-synology" '' + set -e + echo "> Running nixos-rebuild switch ..." + ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --keep-going --flake .#vm-synology --target-host vm-synology --build-host vm-synology --fast --use-remote-sudo --use-substitutes + echo "> nixos-rebuild switch was successful ✅" + '') + + (pkgs.writeScriptBin "sync-agenix-key" '' + set -e + echo "> Copying agenix SSH key from 1password ..." + mkdir -p ~/.ssh + ${pkgs._1password-cli}/bin/op --account my.1password.com read "op://Private/agenix/private key?ssh-format=openssh" > ~/.ssh/agenix + ${pkgs._1password-cli}/bin/op --account my.1password.com read "op://Private/agenix/public key" > ~/.ssh/agenix.pub + echo "> agenix SSH key copied successfully 🔐" + '') +] -- cgit v1.2.3