From f0a50305b8e3d8de7cb5417953c27d5d079eea8e Mon Sep 17 00:00:00 2001 From: greg-compass Date: Thu, 10 Nov 2022 11:15:49 -0600 Subject: [PATCH] Update ffmac and HMS Externalize the hms shell script for easier editing Update ffmac to latest release Add copying of Mac apps to the expected folder --- flake.lock | 6 +++--- overlays/hms.nix | 29 +---------------------------- overlays/hms.sh | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 overlays/hms.sh diff --git a/flake.lock b/flake.lock index 3bf446f..2721350 100644 --- a/flake.lock +++ b/flake.lock @@ -44,11 +44,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1667351381, - "narHash": "sha256-7bnKheuYsY2zyNluA22vHQu9R3YB0ArxTUFd57oWAo4=", + "lastModified": 1667610227, + "narHash": "sha256-2olA2HYnz07rjDq3lMqCmDRlSegp1WL4OqR3KSy3Hy4=", "owner": "bandithedoge", "repo": "nixpkgs-firefox-darwin", - "rev": "e777625df67530c7f67649d28a9bbc676d5e2d44", + "rev": "78d9f25b7816f5711f80093721cf6618cda3e1c0", "type": "github" }, "original": { diff --git a/overlays/hms.nix b/overlays/hms.nix index f0dc2fd..385661f 100644 --- a/overlays/hms.nix +++ b/overlays/hms.nix @@ -1,30 +1,3 @@ { pkgs, ... }: -pkgs.writeShellScriptBin "hms" '' -set -eo pipefail -# Build different targets with GUI or not - -arch="$(uname -m)" -if [ "$(uname -s)" == "Darwin" ]; then - # On macOS - src="$HOME/.config/nix/" - target="''${arch}-darwin" -else - # On Linux/WSL2 systems - if [ -z "$DISPLAY" ]; then - target="''${arch}-nogui" - else - target="''${arch}-gui" - fi - src=/etc/nixos -fi - -# Build and switch -echo "Building $target" -dest=$(mktemp -d) -pushd "$dest" > /dev/null -nix build --impure "$src#homeConfigurations.$target.activationPackage" -./result/activate -popd > /dev/null -rm -r "$dest" -'' +pkgs.writeShellScriptBin "hms" (builtins.readFile ./hms.sh) diff --git a/overlays/hms.sh b/overlays/hms.sh new file mode 100644 index 0000000..af3f656 --- /dev/null +++ b/overlays/hms.sh @@ -0,0 +1,34 @@ +# vim: set ft=bash: +set -eo pipefail +# Build different targets with GUI or not + +arch="$(uname -m)" +if [ "$(uname -s)" == "Darwin" ]; then + # On macOS + src="${HOME}/.config/nix/" + target="${arch}-darwin" +else + # On Linux/WSL2 systems + if [ -z "${DISPLAY}" ]; then + target="${arch}-nogui" + else + target="${arch}-gui" + fi + src=/etc/nixos +fi + +# Build and switch +echo "Building ${target}" +dest=$(mktemp -d) +pushd "${dest}" > /dev/null +nix build --impure "${src}#homeConfigurations.${target}.activationPackage" +./result/activate +popd > /dev/null +rm -r "${dest}" + +if [ "$(uname -s)" == "Darwin" ]; then + for app in ~/.nix-profile/Applications/*.app; do + echo "Copying '${app}' to Applications" + cp -r "${app}" "${HOME}/Applications" + done +fi