fork/home-manager
git clone https://git.julia.blue/fork/home-manager
5f433eb1
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6cfg = config . targets . darwin ; 7searchEngines = { 8Bing = "com.bing.www" ; 9DuckDuckGo = "com.duckduckgo" ; 10Ecosia = "org.ecosia.www" ; 11= "com.google.www" ; 12Yahoo = "com.yahoo.www" ; 13}; 14searchId = getAttr cfg . search searchEngines ; 15in { 16options . targets . darwin . search = mkOption { 17type = with types ; nullOr ( enum ( attrNames searchEngines )); 18default = null ; 19description = "Default search engine." ; 20}; 21 22config = mkIf ( cfg . search != null ) { 23assertions = [ 24( hm . assertions . assertPlatform "targets.darwin.search" pkgs 25platforms . darwin ) 26]; 27 28targets . darwin . defaults = { 29NSGlobalDomain . NSPreferredWebServices = { 30NSWebServicesProviderWebSearch = { 31NSDefaultDisplayName = cfg . search ; 32NSProviderIdentifier = searchId ; 33}; 34}; 35"com.apple.Safari" . SearchProviderIdentifier = searchId ; 36}; 37}; 38}