diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-22 11:13:39 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-23 12:24:36 +0200 |
commit | ff56bdafacdca8c77fea52b4ca6b2da8d6027c6a (patch) | |
tree | ac96f7fd6bccfcebe33f2a32fff111d2b33abdad | |
parent | fix(modules/atuin): Swap cursor modes (diff) | |
download | nixos-config-ff56bdafacdca8c77fea52b4ca6b2da8d6027c6a.tar.gz nixos-config-ff56bdafacdca8c77fea52b4ca6b2da8d6027c6a.zip |
build(build): Introduce a convenient build script
-rw-r--r-- | .gitignore | 2 | ||||
-rwxr-xr-x | build.sh | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 28ba539c..e75b469a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .direnv .ccls-cache + /result +/result-* diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..357acf58 --- /dev/null +++ b/build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +host="${1-tiamat}" +root="$(git rev-parse --show-toplevel)" + +SYSTEM_OUT="$root/result-system" +HOME_OUT="$root/result-home-soispha" + +check() { + file="$1" + if [ -s "$file" ]; then + rm "$file" + elif ! [ -e "$file" ]; then + : "Ignore not existing files" + else + echo "ERROR: '$file' is not a symlink. Not removing it." 1>&2 + exit 1 + fi +} + +system="$(nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link)" +check "$SYSTEM_OUT" +ln --symbolic "$system" "$SYSTEM_OUT" + +home="$(grep ExecStart= "$SYSTEM_OUT/etc/systemd/system/home-manager-soispha.service" | awk '{print $2}')" +check "$HOME_OUT" +ln --symbolic "$home" "$HOME_OUT" + +# vim: ft=sh |