diff --git a/nix/darwin-configuration.nix b/nix/darwin-configuration.nix new file mode 100644 index 0000000..5bfb602 --- /dev/null +++ b/nix/darwin-configuration.nix @@ -0,0 +1,65 @@ +{ config, pkgs, ... }: let + # Mach-nix is a toolkit for constructing custom Python environments + mach-nix = import (builtins.fetchGit { + url = "https://github.com/DavHau/mach-nix/"; + ref = "refs/tags/3.3.0"; + }) { + pkgs = pkgs; + }; + + xonsh_pyenv = mach-nix.mkPython { + requirements = '' + xontrib-fzf-widgets + xonsh-direnv + ''; + }; + + xonsh_with_plugins = pkgs.xonsh.overrideAttrs (old: { + propagatedBuildInputs = old.propagatedBuildInputs ++ xonsh_pyenv.python.pkgs.selectPkgs xonsh_pyenv.python.pkgs; + }); +in +{ + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; + [ + xonsh_with_plugins + zoxide + fd + fzf + ncdu + ripgrep + kitty + git + lorri + direnv + ]; + + # Lorri user agent + # from https://github.com/target/lorri/issues/96#issuecomment-579931485 + launchd.user.agents = { + "lorri" = { + serviceConfig = { + WorkingDirectory = (builtins.getEnv "HOME"); + EnvironmentVariables = { }; + KeepAlive = true; + RunAtLoad = true; + StandardOutPath = "/var/tmp/lorri.log"; + StandardErrorPath = "/var/tmp/lorri.log"; + }; + script = '' + source ${config.system.build.setEnvironment} + exec ${pkgs.lorri}/bin/lorri daemon + ''; + }; + }; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + nix.package = pkgs.nix; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; +}