all repos — nixfiles @ f4d6f996e1b1fb45175fe56c628bc30bdeb69730

System and user configuration, managed by nix and home-manager

user/hosts/marvin.nix (view raw)

{ config, pkgs, ... }:
{
  imports = [
    ../settings/base.nix
    ../settings/development/base.nix
    ../settings/development/javascript.nix
    ../settings/development/python.nix
    ../settings/development/golang.nix
    ../settings/development/vlang.nix
    ../settings/development/web.nix
    ../settings/darwin.nix
    ../settings/emacs.nix
    ../settings/fish.nix
    ../settings/git.nix
    ../settings/nixpkgs.nix
    ../settings/ssh.nix
    ../settings/workstation.nix
    ../settings/user-interface.nix
    ../settings/nix.nix
    ../settings/zed.nix
    ../../private/ssh.nix
    ../../private/llm.nix
  ];

  home.username = "alan";
  home.homeDirectory = "/Users/alan";
  home.stateVersion = "22.11";
  home.packages = with pkgs; [
    picocom
    ollama
  ];

  programs.zed-editor.package = null;

  home.sessionPath = [
    "/Library/Developer/CommandLineTools/usr/bin"
  ];
  home.sessionVariables = {
    OLLAMA_API_BASE = "http://localhost:11434";
  };

  launchd.agents = {
    ollama = {
      enable = true;
      config = {
        ProgramArguments = [
          "${pkgs.ollama}/bin/ollama"
          "serve"
        ];
        RunAtLoad = true;
        KeepAlive = true;
        WorkingDirectory = "/Users/alan";
        StandardOutPath = "/Users/alan/Library/Logs/ollama.log";
        StandardErrorPath = "/Users/alan/Library/Logs/ollama.log";
        EnvironmentVariables = {
          OLLAMA_HOST = "[::]:11434";
          OLLAMA_KEEP_ALIVE = "43200"; # keep models in memory for half a day
          OLLAMA_FLASH_ATTENTION = "1"; # significantly reduce memory usage as the context size grows
          OLLAMA_CONTEXT_LENGTH = "131072";
        };
      };
    };
  };

  launchd.agents.colima = {
    enable = true;
    config = {
      ProgramArguments = [
        "/Users/alan/.local/state/nix/profile/bin/colima"
        "start"
      ];
      RunAtLoad = true;
      # It doesn't run in the foreground, yet...
      # KeepAlive = true;
      WorkingDirectory = "/Users/alan";
      StandardOutPath = "/Users/alan/Library/Logs/colima.log";
      StandardErrorPath = "/Users/alan/Library/Logs/colima.log";
      EnvironmentVariables = {
        HOME = "/Users/alan";
        XDG_CONFIG_HOME = config.xdg.configHome;
      };
    };
  };

  targets.darwin.defaults = {
    NSGlobalDomain = {
      AppleKeyboardUIMode = 2;
      ApplePressAndHoldEnabled = false;
      AppleShowScrollBars = "Always";
    };
    "com.apple.controlcenter" = {
      "NSStatusItem Visible Sound" = true;
      "NSStatusItem Visible FocusModes" = true;
    };
    "com.apple.dock" = {
      autohide = true;
      autohide-delay = 0.05;
      autohide-time-modifier = 0.12;
      expose-animation-duration = 0.5;
      launchanim = false;
      mineffect = "scale";
      minimize-to-application = true;
      scroll-to-open = true;
      show-process-indicators = false;
      static-only = true;
      static-apps = [ ];
      static-others = [
        {
          tile-data = {
            file-data = {
              _CFURLString = "file://${config.home.homeDirectory}/Downloads/";
              _CFURLStringType = 15;
            };
          };
          tile-type = "directory-tile";
        }
      ];
    };
    "com.apple.finder" = {
      _FXSortFoldersFirst = true;
      AppleShowAllExtensions = true;
      FXDefaultSearchScope = "SCcf"; # current folder
      FXEnableExtensionChangeWarning = false;
      FXPreferredViewStyle = "clmv"; # column view
      FXRemoveOldTrashItems = true;
      NewWindowTarget = "Home";
      NSDocumentSaveNewDocumentsToCloud = false;
    };
    "com.apple.menuextra.clock" =
      let
        values = {
          if-space = 0;
          always = 1;
          never = 2;
        };
      in
      {
        Show24Hour = true;
        ShowDate = values.never;
      };
    "com.apple.hitoolbox" = {
      AppleFnUsageType = "Do Nothing";
    };
    "com.apple.multitouchtouchpad" = {
      TrackpadThreeFingerTapGesture = 2; # Lookup
    };
    "com.apple.mouse" = {
      linear = true;
    };
    "com.apple.safari" = {
      ShowFullURLInSmartSearchField = true;
    };
    "com.apple.screensaver" = {
      askForPasswordDelay = 60;
    };
    "com.apple.siri" = {
      StatusMenuVisible = false;
    };
    "com.apple.textedit" = {
      RichText = false;
    };
    "com.apple.timemachine" = {
      DoNotOfferNewDisksForBackup = true;
    };
  };
}