| 1 |
# https://raw.githubusercontent.com/input-output-hk/iohk-ops/develop/nix-darwin/darwin-configuration.nix |
| 2 |
{ config, pkgs, ... }: |
| 3 |
|
| 4 |
let |
| 5 |
opsLib = import <iohk-ops/lib.nix>; |
| 6 |
|
| 7 |
in { |
| 8 |
imports = [ ]; |
| 9 |
|
| 10 |
# List packages installed in system profile. To search by name, run: |
| 11 |
# $ nix-env -qaP | grep wget |
| 12 |
environment.systemPackages = with pkgs; [ |
| 13 |
nix-repl |
| 14 |
nix |
| 15 |
tmux |
| 16 |
ncdu |
| 17 |
git |
| 18 |
] ++ (if pkgs.stdenv.isDarwin then [ |
| 19 |
darwin.cctools |
| 20 |
] else []); |
| 21 |
|
| 22 |
# Create /etc/bashrc that loads the nix-darwin environment. |
| 23 |
programs.bash.enable = true; |
| 24 |
# programs.zsh.enable = true; |
| 25 |
# programs.fish.enable = true; |
| 26 |
|
| 27 |
# Used for backwards compatibility, please read the changelog before changing. |
| 28 |
# $ darwin-rebuild changelog |
| 29 |
system.stateVersion = 2; |
| 30 |
|
| 31 |
# You should generally set this to the total number of logical cores in your system. |
| 32 |
# $ sysctl -n hw.ncpu |
| 33 |
nix.maxJobs = 4; |
| 34 |
nix.buildCores = 0; |
| 35 |
nix.useSandbox = false; # this seems to break things when enabled |
| 36 |
nix.extraOptions = '' |
| 37 |
gc-keep-derivations = true |
| 38 |
gc-keep-outputs = true |
| 39 |
''; |
| 40 |
|
| 41 |
nix.binaryCachePublicKeys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; |
| 42 |
nix.binaryCaches = [ "https://hydra.iohk.io" ]; |
| 43 |
nix.trustedUsers = [ "@admin" ]; |
| 44 |
|
| 45 |
nix.nixPath = [ |
| 46 |
"nixpkgs=UNSET" |
| 47 |
"darwin=UNSET" |
| 48 |
"darwin-config=UNSET" |
| 49 |
"iohk-ops=UNSET" |
| 50 |
]; |
| 51 |
|
| 52 |
######################################################################## |
| 53 |
|
| 54 |
# try to ensure 25G of free space |
| 55 |
nix.gc.automatic = true; |
| 56 |
nix.gc.options = "--max-freed $((25 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))"; |
| 57 |
|
| 58 |
######################################################################## |
| 59 |
|
| 60 |
services.nix-daemon.enable = true; |
| 61 |
|
| 62 |
# Recreate /run/current-system symlink after boot. |
| 63 |
services.activate-system.enable = true; |
| 64 |
|
| 65 |
system.activationScripts.postActivation.text = '' |
| 66 |
printf "disabling spotlight indexing... " |
| 67 |
mdutil -i off -d / &> /dev/null |
| 68 |
mdutil -E / &> /dev/null |
| 69 |
echo "ok" |
| 70 |
''; |
| 71 |
|
| 72 |
######################################################################## |
| 73 |
} |