1--- a/INSTALL 2025-08-14 08:46:43.845548078 +0000
2+++ b/INSTALL 2025-08-14 08:50:33.771706783 +0000
3@@ -1,28 +1,29 @@
4 #!/bin/sh
5
6-DESTDIR=${DESTDIR:="/"}
7+# Use Nix output directory instead of system paths
8+DESTDIR=${out}
9
10-BINDIR=$DESTDIR/usr/bin
11-DOCDIR=$DESTDIR/usr/share/doc/collectl
12-SHRDIR=$DESTDIR/usr/share/collectl
13-MANDIR=$DESTDIR/usr/share/man/man1
14-SYSDDIR=$DESTDIR/usr/lib/systemd/system
15-ETCDIR=$DESTDIR/etc
16-INITDIR=$ETCDIR/init.d
17+BINDIR=$out/bin
18+DOCDIR=$out/share/doc/collectl
19+SHRDIR=$out/share/collectl
20+MANDIR=$out/share/man/man1
21+SYSDDIR=$out/lib/systemd/system
22+ETCDIR=$out/etc
23+INITDIR=$out/etc/init.d
24
25 mkdir -p $BINDIR
26 mkdir -p $DOCDIR
27 mkdir -p $SHRDIR
28 mkdir -p $ETCDIR
29 mkdir -p $MANDIR
30-mkdir -p $INITDIR
31+# Skip init.d creation for Nix
32 mkdir -p $SHRDIR/util
33 mkdir -p $DESTDIR/var/log/collectl
34
35 cp collectl colmux $BINDIR
36 cp collectl.conf $ETCDIR
37 cp man1/* $MANDIR
38-cp initd/* $INITDIR
39+# Skip init scripts for Nix
40
41 cp docs/* $DOCDIR
42 cp GPL ARTISTIC COPYING $DOCDIR
43@@ -42,87 +43,12 @@
44 # Force in case redoing the install and files already zipped
45 gzip -f $MANDIR/collectl*
46
47-chmod 755 $INITDIR/collectl*
48+# Skip chmod on init scripts for Nix
49 chmod 444 $ETCDIR/collectl.conf
50 chmod 755 $BINDIR/collectl
51 chmod 444 $DOCDIR/ARTISTIC $DOCDIR/COPYING $DOCDIR/GPL
52 chmod 444 $SHRDIR/*ph
53 chmod 755 $SHRDIR/util/*
54
55-# remove any stale versions in case the names/numbers used have changed.
56-# on new ROCKS installion 'rm' isn't there yet! [thanks roy]
57-if [ -x /bin/rm ] ; then
58- /bin/rm -f $INITDIR/rc*.d/*collectl
59- /bin/rm -f $ETCDIR/rc.d/rc*.d/*collectl
60-fi
61-
62-# only if systemd is supported
63-if [ -d $SYSDDIR ]; then
64- cp service/collectl.service $SYSDDIR
65-fi
66-
67-# Try and decide which distro this is based on distro specific files.
68-distro=1
69-if [ -f /sbin/yast ]; then
70- distro=2
71- mv -f $INITDIR/collectl-suse $INITDIR/collectl
72- rm -f $INITDIR/collectl-debian
73- rm -f $INITDIR/collectl-generic
74-fi
75-
76-# debian
77-if [ -f /usr/sbin/update-rc.d ]; then
78- distro=3
79- mv -f $INITDIR/collectl-debian $INITDIR/collectl
80- rm -f $INITDIR/collectl-suse
81- rm -f $INITDIR/collectl-generic
82-
83- # only if we're installing under /
84- [ "$DESTDIR" = "/" ] && update-rc.d collectl defaults
85-fi
86-
87-# redhat
88-if [ -f /etc/redhat-release ]; then
89- distro=4
90- rm -f $INITDIR/collectl-suse
91- rm -f $INITDIR/collectl-debian
92- rm -f $INITDIR/collectl-generic
93- if [ -f /usr/sbin/chkconfig ]; then
94- [ "$DESTDIR" = "/" ] && chkconfig --add collectl
95- fi
96-# Not needed for RHEL8 and higher
97-fi
98-
99-# gentoo
100-if [ -f $ETCDIR/gentoo-release ]; then
101- distro=5
102- mv -f $INITDIR/collectl-generic $INITDIR/collectl
103- rm -f $INITDIR/collectl-suse
104- rm -f $INITDIR/collectl-debian
105- [ "$DESTDIR" = "/" ] && rc-update -a collectl default
106-fi
107-
108-# Generic Distros
109-# If /etc/init.d doesn't exist and/or there's no way to use chkconfig or
110-# rc-update you're going to have to add some custom code below...
111-if [ ${distro} = 1 ]; then
112-
113- mv -f $INITDIR/collectl-generic $INITDIR/collectl
114- rm -f $INITDIR/collectl-suse
115- rm -f $INITDIR/collectl-debian
116-
117- # If in not installing under / there's nothing extra do
118- [ $DESTDIR != "/" ] && exit 0
119-
120- # figure out how to handle reboots
121- if [ -f /sbin/chkconfig ]; then
122- chkconfig --add collectl
123- elif [ -f /sbin/rc-update ]; then
124- rc-update -a collectl default
125-# RHEL9 has no chkconfig
126- elif [ -f /usr/bin/systemctl ]; then
127- systemctl enable collectl
128- else
129- echo "could not figure out how to enable restarting across reboots"
130- fi
131-fi
132+# Skip all distro-specific service installation for Nix
133+# Nix manages services differently through NixOS modules