2018-01-13 17:57:10 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ <user-darwin-config> ];
|
|
|
|
|
2018-01-14 19:18:10 +03:00
|
|
|
users.nix.configureBuildUsers = true;
|
|
|
|
users.knownGroups = [ "nixbld" ];
|
|
|
|
|
2018-01-13 17:57:10 +03:00
|
|
|
system.activationScripts.preUserActivation.text = mkBefore ''
|
2018-09-14 22:52:12 +03:00
|
|
|
PATH=/nix/var/nix/profiles/default/bin:$PATH
|
|
|
|
|
2020-03-28 18:03:48 +03:00
|
|
|
i=y
|
2020-12-18 15:00:03 +03:00
|
|
|
if ! test -L /etc/bashrc && ! tail -n1 /etc/bashrc | grep -q /etc/static/bashrc; then
|
2018-01-13 17:57:10 +03:00
|
|
|
if test -t 1; then
|
|
|
|
read -p "Would you like to load darwin configuration in /etc/bashrc? [y/n] " i
|
|
|
|
fi
|
|
|
|
case "$i" in
|
|
|
|
y|Y)
|
2020-12-18 15:00:03 +03:00
|
|
|
sudo ${pkgs.gnused}/bin/sed -i '\,/etc/static/bashrc,d' /etc/bashrc
|
2018-01-13 17:57:10 +03:00
|
|
|
echo 'if test -e /etc/static/bashrc; then . /etc/static/bashrc; fi' | sudo tee -a /etc/bashrc
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2020-12-18 15:00:03 +03:00
|
|
|
if ! test -L /etc/zshrc && ! tail -n1 /etc/zshrc | grep -q /etc/static/zshrc; then
|
2020-06-17 20:00:55 +03:00
|
|
|
if test -t 1; then
|
|
|
|
read -p "Would you like to load darwin configuration in /etc/zshrc? [y/n] " i
|
|
|
|
fi
|
|
|
|
case "$i" in
|
|
|
|
y|Y)
|
2020-12-18 15:00:03 +03:00
|
|
|
sudo ${pkgs.gnused}/bin/sed -i '\,/etc/static/zshrc,d' /etc/zshrc
|
2020-06-17 20:00:55 +03:00
|
|
|
echo 'if test -e /etc/static/zshrc; then . /etc/static/zshrc; fi' | sudo tee -a /etc/zshrc
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2018-01-14 00:32:47 +03:00
|
|
|
if ! test -L /run; then
|
2018-01-14 14:44:50 +03:00
|
|
|
if test -t 1; then
|
|
|
|
read -p "Would you like to create /run? [y/n] " i
|
|
|
|
fi
|
|
|
|
case "$i" in
|
|
|
|
y|Y)
|
2020-03-28 18:03:48 +03:00
|
|
|
if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then
|
|
|
|
echo "setting up /etc/synthetic.conf..."
|
|
|
|
echo -e "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf >/dev/null
|
2020-12-22 12:10:08 +03:00
|
|
|
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B &>/dev/null \
|
|
|
|
|| /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t &>/dev/null \
|
|
|
|
|| echo "warning: failed to execute apfs.util"
|
2020-03-28 18:03:48 +03:00
|
|
|
fi
|
|
|
|
if ! test -L /run; then
|
|
|
|
echo "setting up /run..."
|
|
|
|
sudo ln -sfn private/var/run /run
|
|
|
|
fi
|
2018-01-14 14:44:50 +03:00
|
|
|
;;
|
|
|
|
esac
|
2018-01-14 00:32:47 +03:00
|
|
|
fi
|
|
|
|
'';
|
2018-01-13 17:57:10 +03:00
|
|
|
}
|