about summary refs log tree commit diff stats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/build.sh (renamed from build.sh)24
-rwxr-xr-xscripts/why-depends23
2 files changed, 43 insertions, 4 deletions
diff --git a/build.sh b/scripts/build.sh
index 3c3d387c..f3661978 100755
--- a/build.sh
+++ b/scripts/build.sh
@@ -1,6 +1,18 @@
 #!/usr/bin/env sh
 
-host="${1-tiamat}"
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+host="${1-$(hostname)}"
+[ "$#" -gt 0 ] && shift 1
+
 root="$(git rev-parse --show-toplevel)"
 
 SYSTEM_OUT="$root/result-system"
@@ -11,7 +23,9 @@ check() {
     if [ -s "$file" ]; then
         rm "$file"
     elif ! [ -e "$file" ]; then
-        : "Ignore not existing files"
+        rm "$file" || {
+            : "Ignore not existing files"
+        }
     else
         echo "ERROR: '$file' is not a symlink. Not removing it." 1>&2
         exit 1
@@ -19,7 +33,7 @@ check() {
 }
 
 build_system() {
-    _val="$(nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link)"
+    _val="$(nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --no-link --option max-jobs 1 "$@")"
     exit_val="$?"
 
     if [ "$exit_val" -ne 0 ]; then
@@ -30,7 +44,7 @@ build_system() {
     fi
 }
 
-system="$(build_system)"
+system="$(build_system "$@")"
 [ "$system" = "1" ] && exit 1
 
 check "$SYSTEM_OUT"
@@ -40,4 +54,6 @@ home="$(grep ExecStart= "$SYSTEM_OUT/etc/systemd/system/home-manager-soispha.ser
 check "$HOME_OUT"
 ln --symbolic "$home" "$HOME_OUT"
 
+nvd diff /run/current-system "$SYSTEM_OUT"
+
 # vim: ft=sh
diff --git a/scripts/why-depends b/scripts/why-depends
new file mode 100755
index 00000000..1afe9150
--- /dev/null
+++ b/scripts/why-depends
@@ -0,0 +1,23 @@
+#! /usr/bin/env sh
+
+search_string="$1-"
+shift 1
+
+if [ "$1" != "" ]; then
+    # Add the version
+    search_string="${search_string}${1}$"
+    shift 1
+fi
+
+if [ "$1" = "--running" ]; then
+    shift 1
+    base="/run/current-system"
+else
+    host="$(hostname)"
+    base=".#nixosConfigurations.$host.config.system.build.toplevel"
+fi
+
+
+fd "$search_string" /nix/store --type directory --threads 1 --exec nix why-depends "$@" "$base"
+
+# vim: ft=sh