about summary refs log tree commit diff
path: root/src/nix-addroot
blob: 3ab9e8a252f86f1e1a3deeb79abcfef5ad8bb636 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /bin/sh

ROOTLIST=~/.nixroots

if ! test -f $ROOTLIST; then
    touch $ROOTLIST
fi

for i in $*; do
    if nix ensure $i > /dev/null; then
	if grep -q $i $ROOTLIST; then
	    echo $i already is a root
        else
            echo adding root $i
	    echo $i >> $ROOTLIST
	fi
    fi
done