nix: start darwin configuration
preparation for macOS
This commit is contained in:
parent
b6f830297b
commit
3d70922a85
7 changed files with 213 additions and 1 deletions
34
modules/darwin/nix.nix
Normal file
34
modules/darwin/nix.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
# nix auto garbage collection
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
interval = { Weekday = 0; Hour = 0; Minute = 0; };
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# make nix applications use alias instead of symlinks for compatability
|
||||
system.activationScripts.applications.text = let
|
||||
env = pkgs.buildEnv {
|
||||
name = "system-applications";
|
||||
paths = config.environment.systemPackages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in
|
||||
pkgs.lib.mkForce ''
|
||||
# Set up applications.
|
||||
echo "setting up /Applications..." >&2
|
||||
rm -rf /Applications/Nix\ Apps
|
||||
mkdir -p /Applications/Nix\ Apps
|
||||
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
|
||||
while read -r src; do
|
||||
app_name=$(basename "$src")
|
||||
echo "copying $src" >&2
|
||||
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
|
||||
done
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue