System/modules/darwin/default.nix

124 lines
3.8 KiB
Nix

{ config, lib, pkgs, ... }:
let
inherit (import ../lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in {
imports = [
../options.nix
../common/programs/utils.nix
./user.nix
./fonts.nix
./settings.nix
./media.nix
];
options = with lib;
with nLib; {
nathan = {
config = {
# Install fonts
# On by default if the system is a desktop
fonts = mkDefaultOption "fonts" config.nathan.config.isDesktop;
# Macos settings
settings = mkDefaultOption "settings" config.nathan.config.isDesktop;
};
programs = {
# Firefox, enabled by default on linux desktop
firefox = mkDefaultOption "Firefox" config.nathan.config.isDesktop;
syncthing =
mkDefaultOption "syncthing" config.nathan.config.isDesktop;
# Communications applications
communications = {
# Enable by default if we are on a linux desktop
enable = mkDefaultOption "Communication applications"
config.nathan.config.isDesktop;
};
media = {
# Enable by default if we are on a linux desktop
enable = mkDefaultOption "Media applications"
config.nathan.config.isDesktop;
};
# Virtualization
virtualization =
mkDefaultOption "Virtualization" config.nathan.config.isDesktop;
# development tools
devel = {
python =
mkDefaultOption "Virtualization" config.nathan.config.isDesktop;
};
};
};
};
config = {
# Link applications in spotlight/launchpad
system.activationScripts.applications.text = pkgs.lib.mkForce (''
echo "setting up ~/Applications..." >&2
rm -rf ~/Applications/Nix\ Apps
mkdir -p ~/Applications/Nix\ Apps
for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do
src="$(/usr/bin/stat -f%Y "$app")"
cp -r "$src" ~/Applications/Nix\ Apps
done
'');
# Set system state version
system.stateVersion = 4;
# Enable flakes
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
services.nix-daemon.enable = true;
# Replace some macos packages
environment.systemPackages = with pkgs; [ coreutils-full openssh ];
programs.zsh.enable = true;
programs.fish.enable = true;
# Make nix managed fonts work
fonts.fontDir.enable = true;
# Configure nix to be a lil smarter with the store
nix.settings.auto-optimise-store = true;
# Make nix assume control of homebrew
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
upgrade = true;
cleanup = "zap";
};
taps = [ "homebrew/cask-versions" ];
casks = lib.mkMerge [
(lib.mkIf config.nathan.programs.firefox [{ name = "firefox"; }])
(lib.mkIf config.nathan.programs.virtualization [{ name = "utm"; }])
(lib.mkIf config.nathan.programs.devel.python [{ name = "miniconda"; }])
(lib.mkIf config.nathan.programs.communications.enable [
{ name = "discord"; }
{ name = "betterdiscord-installer"; }
{ name = "signal"; }
{ name = "orangedrangon-android-messages"; }
{ name = "messenger"; }
])
# Unconditionally install core utilites
[
{ name = "keepingyouawake"; }
{ name = "flux"; }
{ name = "iterm2"; }
{ name = "gpg-suite"; }
{ name = "amethyst"; }
{ name = "docker"; }
]
];
brews = lib.mkMerge [
(lib.mkIf config.nathan.programs.syncthing [{
name = "syncthing";
restart_service = true;
start_service = true;
}])
];
};
};
}