diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/darwin/aerospace.nix b/darwin/aerospace.nix new file mode 100644 index 0000000..dcd7555 --- /dev/null +++ b/darwin/aerospace.nix @@ -0,0 +1,130 @@ +{ pkgs, lib, config, ... }: + +{ + options.custom = with lib; { + aerospace = { + enable = mkEnableOption "Enable aerospace"; + }; + }; + + config = lib.mkIf config.custom.aerospace.enable { + services.aerospace = { + enable = config.custom.aerospace.enable; + settings = { + enable-normalization-flatten-containers = true; + enable-normalization-opposite-orientation-for-nested-containers = true; + accordion-padding = 0; + on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ]; + default-root-container-layout = "tiles"; + default-root-container-orientation = "auto"; + + gaps = { + inner = { + horizontal = 0; + vertical = 0; + }; + outer = { + left = 0; + bottom = 0; + top = 0; + right = 0; + }; + }; + + mode = { + main = { + binding = { + alt-enter = + let + script = pkgs.writeText "ghostty.applescript" '' + do shell script "open -n -a Ghostty" + ''; + in "exec-and-forget osascript ${script}"; + + alt-shift-f = "fullscreen"; + alt-p = "layout floating tiling"; + alt-e = "layout tiles horizontal vertical"; + alt-t = "layout accordion horizontal vertical"; + alt-h = "focus left"; + alt-l = "focus right"; + alt-shift-h = "move left"; + alt-shift-l = "move right"; + + alt-1 = "workspace 1"; + alt-2 = "workspace 2"; + alt-3 = "workspace 3"; + alt-4 = "workspace 4"; + alt-5 = "workspace 5"; + alt-6 = "workspace 6"; + alt-7 = "workspace 7"; + alt-8 = "workspace 8"; + alt-9 = "workspace 9"; + alt-0 = "workspace 10"; + + alt-shift-1 = [ + "move-node-to-workspace 1" + "workspace 1" + ]; + alt-shift-2 = [ + "move-node-to-workspace 2" + "workspace 2" + ]; + alt-shift-3 = [ + "move-node-to-workspace 3" + "workspace 3" + ]; + alt-shift-4 = [ + "move-node-to-workspace 4" + "workspace 4" + ]; + alt-shift-5 = [ + "move-node-to-workspace 5" + "workspace 5" + ]; + alt-shift-6 = [ + "move-node-to-workspace 6" + "workspace 6" + ]; + alt-shift-7 = [ + "move-node-to-workspace 7" + "workspace 7" + ]; + alt-shift-8 = [ + "move-node-to-workspace 8" + "workspace 8" + ]; + alt-shift-9 = [ + "move-node-to-workspace 9" + "workspace 9" + ]; + alt-shift-0 = [ + "move-node-to-workspace 10" + "workspace 10" + ]; + + alt-r = "mode resize"; + }; + }; + + resize = { + binding = { + h = "resize width -50"; + j = "resize height +50"; + k = "resize height -50"; + l = "resize width +50"; + enter = "mode main"; + esc = "mode main"; + }; + }; + }; + + on-window-detected = [ + { + "if".app-id="com.mitchellh.ghostty"; + run= [ "layout tiling" ]; + } + ]; + }; + }; + }; +} diff --git a/darwin/default.nix b/darwin/default.nix new file mode 100644 index 0000000..4185fdb --- /dev/null +++ b/darwin/default.nix @@ -0,0 +1,63 @@ +{ + inputs, + lib, + config, + pkgs, + system, + host, + ... +}: { + imports = [ + ./aerospace.nix + ./homebrew.nix + ./keyboard.nix + ]; + + options.custom = with lib; { + shell = { + packages = mkOption { + type = + with types; + attrsOf (oneOf [ + str + attrs + package + ]); + apply = custom.mkShellPackages; + default = { }; + description = '' + Attrset of shell packages to install and add to pkgs.custom overlay (for compatibility across multiple shells). + Both string and attr values will be passed as arguments to writeShellApplicationCompletions + ''; + example = '' + shell.packages = { + myPackage1 = "echo 'Hello, World!'"; + myPackage2 = { + runtimeInputs = [ pkgs.hello ]; + text = "hello --greeting 'Hi'"; + }; + } + ''; + }; + }; + symlinks = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Symlinks to create in the format { dest = src;}"; + }; + }; + + config = { + # networking + # networking.hostName = host; + # networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName); + # networking.networkmanager.enable = true; + + environment.systemPackages = with pkgs; [ + vim + htop + ] ++ (lib.attrValues config.custom.shell.packages); + + system.stateVersion = 6; + }; +} diff --git a/darwin/homebrew.nix b/darwin/homebrew.nix new file mode 100644 index 0000000..ea9c138 --- /dev/null +++ b/darwin/homebrew.nix @@ -0,0 +1,34 @@ +{ pkgs, user, inputs, ... }: + +{ + nix-homebrew = { + inherit user; + enable = true; + enableRosetta = true; + taps = { + "homebrew/homebrew-core" = inputs.homebrew-core; + "homebrew/homebrew-cask" = inputs.homebrew-cask; + "homebrew/homebrew-createzap" = inputs.homebrew-createzap; + }; + mutableTaps = false; + }; + + homebrew = { + enable = true; + onActivation = { + # autoUpdate = true; + # cleanup = "zap"; + }; + global = { + brewfile = true; + }; + casks = [ + "zen-browser" + "webex" + "slack" + "zoom" + "spotify" + "ghostty" + ]; + }; +} diff --git a/darwin/keyboard.nix b/darwin/keyboard.nix new file mode 100644 index 0000000..d37203d --- /dev/null +++ b/darwin/keyboard.nix @@ -0,0 +1,7 @@ +{ config, ... }: +{ + system.keyboard = { + enableKeyMapping = true; + remapCapsLockToControl = true; + }; +} diff --git a/flake.lock b/flake.lock index 642bddf..6d182f2 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,37 @@ { "nodes": { + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1742457334, + "narHash": "sha256-Gn7ruyb3NDFr+SsHBfA2NsJI8YkkWdECqLRj/xcjt+E=", + "owner": "Homebrew", + "repo": "brew", + "rev": "f3bd91d3afe086824d24708230e1f0c7f943135a", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "4.4.25", + "repo": "brew", + "type": "github" + } + }, + "cl-nix-lite": { + "locked": { + "lastModified": 1728174978, + "narHash": "sha256-Grqqg+xuicANB85j0gNEXxi9SBKY7bzGeTuyi95eGcY=", + "owner": "hraban", + "repo": "cl-nix-lite", + "rev": "31cfe6275c341eb3120a99f4b1c8516c49a29d87", + "type": "github" + }, + "original": { + "owner": "hraban", + "repo": "cl-nix-lite", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -7,11 +39,11 @@ ] }, "locked": { - "lastModified": 1741786315, - "narHash": "sha256-VT65AE2syHVj6v/DGB496bqBnu1PXrrzwlw07/Zpllc=", + "lastModified": 1743598667, + "narHash": "sha256-ViE7NoFWytYO2uJONTAX35eGsvTYXNHjWALeHAg8OQY=", "owner": "nix-community", "repo": "disko", - "rev": "0d8c6ad4a43906d14abd5c60e0ffe7b587b213de", + "rev": "329d3d7e8bc63dd30c39e14e6076db590a6eabe6", "type": "github" }, "original": { @@ -52,6 +84,23 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1730663653, + "narHash": "sha256-kFCUWettiFHDIqxCWWQ9qY8pVh+Lj+XL0Giyy/kdomg=", + "owner": "hraban", + "repo": "flake-compat", + "rev": "e5b16676185cb7548581c852f51ce7f3a49bba5e", + "type": "github" + }, + "original": { + "owner": "hraban", + "ref": "fixed-output", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -70,6 +119,26 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": [ + "mac-app-util", + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, "ghostty": { "inputs": { "flake-compat": "flake-compat", @@ -80,11 +149,11 @@ "zon2nix": "zon2nix" }, "locked": { - "lastModified": 1742589311, - "narHash": "sha256-YCAEmOPDSHVKygFov2zOg3Fkb060SRgjiGi4P7y9+kc=", + "lastModified": 1743809482, + "narHash": "sha256-zzR3VX9+7fz+twG+84XKyyTzJhyjgQgZIkzSwr5W8HI=", "owner": "ghostty-org", "repo": "ghostty", - "rev": "747c43ffa0047aa2ef550aa361ba63f4060a85ba", + "rev": "c0eaa4b158c418499b9963e84c9ce2787a09d473", "type": "github" }, "original": { @@ -143,11 +212,11 @@ ] }, "locked": { - "lastModified": 1742670145, - "narHash": "sha256-xQ2F9f+ICAGBp/nNv3ddD2U4ZvzuLOci0u/5lyMXPvk=", + "lastModified": 1743788974, + "narHash": "sha256-2LeVyQZI2wTkSzMLvnN/kJjXVWp4HCVUoq17Bv8TNTk=", "owner": "nix-community", "repo": "home-manager", - "rev": "63e77d09a133ac641a0c204e7cfb0c97e133706d", + "rev": "0f5908daf890c3d7e7052bef1d6deb0f2710aaa1", "type": "github" }, "original": { @@ -156,6 +225,156 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "zen-browser", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1743604125, + "narHash": "sha256-ZD61DNbsBt1mQbinAaaEqKaJk2RFo9R/j+eYWeGMx7A=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "180fd43eea296e62ae68e079fcf56aba268b9a1a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "homebrew-cask": { + "flake": false, + "locked": { + "lastModified": 1743826030, + "narHash": "sha256-UsALr6GdYIzQQJKVEa0dxfsl2lvTKkvbI4xt89Fe3HA=", + "owner": "homebrew", + "repo": "homebrew-cask", + "rev": "280a26f1d237f1794d265143069db808d32a7469", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-cask", + "type": "github" + } + }, + "homebrew-core": { + "flake": false, + "locked": { + "lastModified": 1743825975, + "narHash": "sha256-7n/XMkwZk/EwbK2+W6MHv6MgR54vP+kZ8z1QxIEVA4Q=", + "owner": "homebrew", + "repo": "homebrew-core", + "rev": "7d6f347c4533509284d72ae6d6b7253c6248418b", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-core", + "type": "github" + } + }, + "homebrew-createzap": { + "flake": false, + "locked": { + "lastModified": 1715123866, + "narHash": "sha256-3Mf21xheYYoiTtbakmRhnhXXx21iKlCnG2oQGcq3pZw=", + "owner": "nrlquaker", + "repo": "homebrew-createzap", + "rev": "08249a9211606dbde1c18b891b595ffead5f15a0", + "type": "github" + }, + "original": { + "owner": "nrlquaker", + "repo": "homebrew-createzap", + "type": "github" + } + }, + "mac-app-util": { + "inputs": { + "cl-nix-lite": "cl-nix-lite", + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1742156590, + "narHash": "sha256-aTM/2CrNN5utdVEQGsOA+kl4UozgH7VPLBQL5OXtBrg=", + "owner": "hraban", + "repo": "mac-app-util", + "rev": "341ede93f290df7957047682482c298e47291b4d", + "type": "github" + }, + "original": { + "owner": "hraban", + "repo": "mac-app-util", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1743496612, + "narHash": "sha256-emPWa5lmKbnyuj8c1mSJUkzJNT+iJoU9GMcXwjp2oVM=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "73d59580d01e9b9f957ba749f336a272869c42dd", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-darwin_2": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1716329735, + "narHash": "sha256-ap51w+VqG21vuzyQ04WrhI2YbWHd3UGz0e7dc/QQmoA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "eac4f25028c1975a939c8f8fba95c12f8a25e01c", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src", + "nix-darwin": "nix-darwin_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1742619394, + "narHash": "sha256-8uwIBjbKxeJ7u0VACSNs634HwtgRLxP6/+cIkUXmuyI=", + "owner": "zhaofengli", + "repo": "nix-homebrew", + "rev": "04b0536479d2d2e8d71dc8c8ee97c2b61f0c9987", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "nix-homebrew", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -163,11 +382,11 @@ ] }, "locked": { - "lastModified": 1742174123, - "narHash": "sha256-pDNzMoR6m1ZSJToZQ6XDTLVSdzIzmFl1b8Pc3f7iV6Y=", + "lastModified": 1743306489, + "narHash": "sha256-LROaIjSLo347cwcHRfSpqzEOa2FoLSeJwU4dOrGm55E=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "2cfb4e1ca32f59dd2811d7a6dd5d4d1225f0955c", + "rev": "b3696bfb6c24aa61428839a99e8b40c53ac3a82d", "type": "github" }, "original": { @@ -178,11 +397,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1742631601, - "narHash": "sha256-yJ3OOAmsGAxSl0bTmKUp3+cEYtSS+V6hUPK2rYhIPr8=", + "lastModified": 1743420942, + "narHash": "sha256-b/exDDQSLmENZZgbAEI3qi9yHkuXAXCPbormD8CSJXo=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "380ed15bcd6440606c6856db44a99140d422b46f", + "rev": "de6fc5551121c59c01e2a3d45b277a6d05077bc4", "type": "github" }, "original": { @@ -194,17 +413,35 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742422364, - "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", - "owner": "nixos", + "lastModified": 1732617236, + "narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", + "rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", + "owner": "NixOS", "repo": "nixpkgs", + "rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e", + "type": "github" + } + }, + "nixpkgs-firefox-darwin": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1743814796, + "narHash": "sha256-NzvnPhm1qAnKRVapGIdyyiu79AHqYtEOa5c0doxLnWs=", + "owner": "bandithedoge", + "repo": "nixpkgs-firefox-darwin", + "rev": "767b994a4171d8fefd4f4b46a8f2ce2f0e639e0d", + "type": "github" + }, + "original": { + "owner": "bandithedoge", + "repo": "nixpkgs-firefox-darwin", "type": "github" } }, @@ -240,15 +477,83 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1687274257, + "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=", + "path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source", + "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716330097, + "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1743583204, + "narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1639237670, + "narHash": "sha256-RTdL4rEQcgaZGpvtDgkp3oK/V+1LM3I53n0ACPSroAQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "edfb969386ebe6c3cf8f878775a7975cd88f926d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "disko": "disko", "ghostty": "ghostty", "git-hooks": "git-hooks", "home-manager": "home-manager", + "homebrew-cask": "homebrew-cask", + "homebrew-core": "homebrew-core", + "homebrew-createzap": "homebrew-createzap", + "mac-app-util": "mac-app-util", + "nix-darwin": "nix-darwin", + "nix-homebrew": "nix-homebrew", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_4", + "nixpkgs-firefox-darwin": "nixpkgs-firefox-darwin", "sops-nix": "sops-nix", "treefmt-nix": "treefmt-nix", "zen-browser": "zen-browser" @@ -261,11 +566,11 @@ ] }, "locked": { - "lastModified": 1742595978, - "narHash": "sha256-05onsoMrLyXE4XleDCeLC3bXnC4nyUbKWInGwM7v6hU=", + "lastModified": 1743756170, + "narHash": "sha256-2b11EYa08oqDmF3zEBLkG1AoNn9rB1k39ew/T/mSvbU=", "owner": "Mic92", "repo": "sops-nix", - "rev": "b7756921b002de60fb66782effad3ce8bdb5b25d", + "rev": "cff8437c5fe8c68fc3a840a21bf1f4dc801da40d", "type": "github" }, "original": { @@ -289,6 +594,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1689347925, + "narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=", + "owner": "nix-systems", + "repo": "default-darwin", + "rev": "2235d7e6cc29ae99878133c95e9fe5e157661ffb", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-darwin", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -296,11 +616,11 @@ ] }, "locked": { - "lastModified": 1742370146, - "narHash": "sha256-XRE8hL4vKIQyVMDXykFh4ceo3KSpuJF3ts8GKwh5bIU=", + "lastModified": 1743748085, + "narHash": "sha256-uhjnlaVTWo5iD3LXics1rp9gaKgDRQj6660+gbUU3cE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "adc195eef5da3606891cedf80c0d9ce2d3190808", + "rev": "815e4121d6a5d504c0f96e5be2dd7f871e4fd99d", "type": "github" }, "original": { @@ -311,16 +631,17 @@ }, "zen-browser": { "inputs": { + "home-manager": "home-manager_2", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1742614294, - "narHash": "sha256-bZbYlP/xqGyW2aVle742dFbc0npFnwJBzcEnXNywJgY=", + "lastModified": 1743798013, + "narHash": "sha256-tu1oPYFWY8dPtalV7On0DVrrNqrn4g2pYyR5yBt44NU=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "7fa9ec4e14d89e568ebaac302049980df7cf0cc9", + "rev": "48684cc5214f41f1e3fd64e41660fc064cf01815", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index bea401e..d3a7424 100644 --- a/flake.nix +++ b/flake.nix @@ -3,13 +3,8 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - nixos-hardware.url = "github:NixOS/nixos-hardware/master"; - disko.url = "github:nix-community/disko"; - disko.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - zen-browser.url = "github:0xc000022070/zen-browser-flake"; - zen-browser.inputs.nixpkgs.follows = "nixpkgs"; ghostty.url = "github:ghostty-org/ghostty"; nix-index-database.url = "github:nix-community/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; @@ -19,6 +14,26 @@ git-hooks.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + + # linux-only + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + zen-browser.url = "github:0xc000022070/zen-browser-flake"; + zen-browser.inputs.nixpkgs.follows = "nixpkgs"; + + # darwin-only + nix-darwin.url = "github:nix-darwin/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + mac-app-util.url = "github:hraban/mac-app-util"; + nixpkgs-firefox-darwin.url = "github:bandithedoge/nixpkgs-firefox-darwin"; + nix-homebrew.url = "github:zhaofengli/nix-homebrew"; + homebrew-core.url = "github:homebrew/homebrew-core"; + homebrew-core.flake = false; + homebrew-cask.url = "github:homebrew/homebrew-cask"; + homebrew-cask.flake = false; + homebrew-createzap.url = "github:nrlquaker/homebrew-createzap"; + homebrew-createzap.flake = false; }; outputs = { @@ -29,33 +44,19 @@ ... } @ inputs: let inherit (self) outputs; - system = "x86_64-linux"; - dots = "/home/rayandrew/dotfiles"; user = "rayandrew"; - pkgs = import inputs.nixpkgs { - inherit system; - config.allowUnfree = true; - }; - lib = import ./lib.nix { - inherit (nixpkgs) lib; - inherit pkgs; - inherit (inputs) home-manager; - }; - createCommonArgs = system: { + lib = nixpkgs.lib; + commonArgs = { inherit self inputs nixpkgs lib - pkgs - system - dots ; specialArgs = { inherit self inputs; }; }; - commonArgs = createCommonArgs system; # call with forAllSystems (commonArgs: function body) forAllSystems = @@ -65,7 +66,10 @@ "aarch64-linux" "x86_64-darwin" "aarch64-darwin" - ] (system: fn (createCommonArgs system)); + ] (system: fn (commonArgs // { inherit system; pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }; })); treefmtEval = forAllSystems ( { pkgs, ... }: treefmt-nix.lib.evalModule pkgs { diff --git a/home/default.nix b/home/default.nix index 7023deb..33217a6 100644 --- a/home/default.nix +++ b/home/default.nix @@ -27,7 +27,7 @@ sd ugrep unzip - gpclient + # gpclient openconnect fd ripgrep @@ -36,7 +36,9 @@ gnumake texinfo devenv + fontconfig ] + ++ lib.optionals pkgs.stdenv.isDarwin [ coreutils ] ++ (lib.attrValues config.custom.shell.packages); services = { @@ -51,6 +53,7 @@ programs = { nh = { enable = true; + package = pkgs.custom.nh; clean.enable = true; clean.extraArgs = "--keep-since 4d --keep 3"; flake = dots; @@ -62,6 +65,10 @@ enable = true; enableVteIntegration = true; }; + zsh = { + enable = true; + enableVteIntegration = true; + }; gpg = { enable = true; }; @@ -95,6 +102,7 @@ }; }; + systemd.user.sessionVariables = config.home.sessionVariables; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion home.stateVersion = "25.05"; }; diff --git a/home/emacs/config/post-init.el b/home/emacs/config/post-init.el index 73cb9ab..ee792bc 100644 --- a/home/emacs/config/post-init.el +++ b/home/emacs/config/post-init.el @@ -283,7 +283,7 @@ (dired-deletion-confirmer #'y-or-n-p) (dired-dwim-target t) ;; (dired-listing-switches "-Alh") - (dired-listing-switches "-AlhcF --group-directories-first") + (dired-listing-switches "-AlhcF") (dired-auto-revert-buffer t)) (use-package dired-x diff --git a/home/emacs/config/pre-early-init.el b/home/emacs/config/pre-early-init.el index a21a7b6..301146c 100644 --- a/home/emacs/config/pre-early-init.el +++ b/home/emacs/config/pre-early-init.el @@ -22,5 +22,5 @@ ;; (ns-appearance . dark) ;; (ns-transparent-titlebar . t))) (setq default-frame-alist '((background-color . "#072626") - (ns-appearance . dark) - (ns-transparent-titlebar . t))) + (ns-appearance . dark) + (ns-transparent-titlebar . t))) diff --git a/home/emacs/config/pre-init.el b/home/emacs/config/pre-init.el index a1dbb39..b034e59 100644 --- a/home/emacs/config/pre-init.el +++ b/home/emacs/config/pre-init.el @@ -43,11 +43,17 @@ (elpaca elpaca-use-package (elpaca-use-package-mode)) +;; (defun rs/get-default-font () +;; (cond +;; ((eq system-type 'windows-nt) "Consolas-11") +;; ((eq system-type 'gnu/linux) "Consolas-11") +;; ((eq system-type 'darwin) "Consolas-11"))) + (defun rs/get-default-font () (cond ((eq system-type 'windows-nt) "Consolas-11") ((eq system-type 'gnu/linux) "Consolas-11") - ((eq system-type 'darwin) "Consolas-11"))) + ((eq system-type 'darwin) "SF Mono-11"))) ;; Font settings ;; (set-frame-font (font-spec :size 13)) diff --git a/home/email/davmail.nix b/home/email/davmail.nix deleted file mode 100644 index 3ab3dfc..0000000 --- a/home/email/davmail.nix +++ /dev/null @@ -1,117 +0,0 @@ -{ - config, - lib, - pkgs, - home-dir, - ... -}: -let - cfg = config.services.davmail; - configType = - with lib.types; - oneOf [ - (attrsOf configType) - str - int - bool - ] - // { - description = "davmail config type (str, int, bool or attribute set thereof)"; - }; - - toStr = val: if lib.isBool val then lib.boolToString val else toString val; - - linesForAttrs = - attrs: - lib.concatMap ( - name: - let - value = attrs.${name}; - in - if lib.isAttrs value then - map (line: name + "." + line) (linesForAttrs value) - else - [ "${name}=${toStr value}" ] - ) (lib.attrNames attrs); - - configFile = pkgs.writeText "davmail.properties" ( - lib.concatStringsSep "\n" (linesForAttrs cfg.config) - ); -in -{ - options.services.davmail = { - enable = lib.mkEnableOption "davmail, an MS Exchange gateway"; - - url = lib.mkOption { - type = lib.types.str; - description = "Outlook Web Access URL to access the exchange server, i.e. the base webmail URL."; - example = "https://outlook.office365.com/EWS/Exchange.asmx"; - }; - - config = lib.mkOption { - type = configType; - default = { }; - description = '' - Davmail configuration. Refer to - - and - for details on supported values. - ''; - example = lib.literalExpression '' - { - davmail.allowRemote = true; - davmail.imapPort = 55555; - davmail.bindAddress = "10.0.1.2"; - davmail.smtpSaveInSent = true; - davmail.folderSizeLimit = 10; - davmail.caldavAutoSchedule = false; - log4j.logger.rootLogger = "DEBUG"; - } - ''; - }; - }; - - config = lib.mkIf cfg.enable { - - services.davmail.config = { - davmail = lib.mapAttrs (name: lib.mkDefault) { - server = true; - disableUpdateCheck = true; - logFilePath = "/tmp/davmail.log"; - logFileSize = "1MB"; - mode = "auto"; - url = cfg.url; - caldavPort = 1080; - imapPort = 1143; - ldapPort = 1389; - popPort = 1110; - smtpPort = 1025; - oauth.tokenFilePath = "${home-dir}/.config/davmail/token"; - }; - log4j = { - logger.davmail = lib.mkDefault "WARN"; - logger.httpclient.wire = lib.mkDefault "WARN"; - logger.org.apache.commons.httpclient = lib.mkDefault "WARN"; - rootLogger = lib.mkDefault "WARN"; - }; - }; - - systemd.user.services.davmail = { - Unit = { - Description = "DavMail POP/IMAP/SMTP Exchange Gateway"; - }; - - Install = { - WantedBy = [ "default.target" ]; - }; - - Service = { - Type = "simple"; - ExecStart = "${pkgs.davmail}/bin/davmail ${configFile}"; - Restart = "on-failure"; - }; - }; - - home.packages = [ pkgs.davmail ]; - }; -} diff --git a/home/email/default.nix b/home/email/default.nix index 6acd9af..82d88be 100644 --- a/home/email/default.nix +++ b/home/email/default.nix @@ -9,7 +9,6 @@ { imports = [ - ./davmail.nix ./neomutt ./mailcap.nix ]; @@ -23,11 +22,11 @@ config = lib.mkIf config.custom.email.enable { services.davmail = { enable = config.custom.email.davmail; - url = "https://outlook.office365.com/EWS/Exchange.asmx"; - config = { - davmail.mode = "O365Manual"; + settings = { + "davmail.mode" = "O365Manual"; + "davmail.url" = "https://outlook.office365.com/EWS/Exchange.asmx"; # davmail.mode = "O365Modern"; - davmail.keepDelay = 30; + "davmail.keepDelay" = 30; # log4j.logger.davmail = "DEBUG"; }; }; diff --git a/home/ghostty.nix b/home/ghostty.nix index 6723aab..2b440c0 100644 --- a/home/ghostty.nix +++ b/home/ghostty.nix @@ -3,8 +3,10 @@ pkgs, inputs, lib, + system-font, ... }: + { options.custom.gui = with lib; { ghostty = { @@ -13,15 +15,16 @@ }; config = lib.mkIf config.custom.gui.ghostty.enable { - home.packages = with pkgs; [ + home.packages = lib.mkIf pkgs.stdenv.isLinux (with pkgs; [ inputs.ghostty.packages."${system}".default - ]; + ]); xdg.configFile."ghostty/config".text = '' -gtk-single-instance = false +gtk-single-instance = true gtk-titlebar = false window-decoration = server +quit-after-last-window-closed = true # gtk-adwaita = false -font-family = Consolas +font-family = ${system-font} font-size = 11 app-notifications = no-clipboard-copy # theme = gruber-darker diff --git a/home/gui.nix b/home/gui.nix index 4ccee40..e249b76 100644 --- a/home/gui.nix +++ b/home/gui.nix @@ -15,8 +15,16 @@ ./ghostty.nix ]; - options.custom.gui.default = with lib; { - enable = mkEnableOption "Enable Default GUI"; + options.custom.gui = with lib; { + default = { + enable = mkEnableOption "Enable Default GUI"; + }; + linux = { + enable = mkEnableOption "Enable Linux-only GUI"; + }; + darwin = { + enable = mkEnableOption "Enable Darwin-only GUI"; + }; }; config = lib.mkIf config.custom.gui.default.enable { @@ -30,6 +38,7 @@ programs.vscode = { enable = true; + package = pkgs.vscode; profiles.default = { extensions = with pkgs.vscode-extensions; [ bbenoist.nix @@ -46,27 +55,26 @@ }; }; + programs.firefox = { + enable = true; + # package = lib.mkIf custom.gui.darwin.enable pkgs.firefox-bin or pkgs.firefox; + package = if config.custom.gui.darwin.enable then pkgs.firefox-bin else pkgs.firefox; + }; + + home.sessionVariables = lib.mkIf config.custom.gui.darwin.enable { + MOZ_LEGACY_PROFILES = "1"; + }; + + # launchd.user.envVariables = lib.mkIf config.custom.gui.darwin.enable { + # MOZ_LEGACY_PROFILES = "1"; + # }; + home.packages = with pkgs; [ - inputs.zen-browser.packages."${system}".twilight # globalprotect-openconnect - firefox - chromium - zoom-us - slack - teams-for-linux - skypeforlinux - zotero - spotify - arandr - webex - kitty - seahorse # gnome keyring - xfce.thunar - xfce.thunar-volman - xclip - quickemu - gf # debugger + # firefox # fonts + custom.sf-mono + custom.sf-symbols ultimate-oldschool-pc-font-pack vista-fonts nerd-fonts.ubuntu-mono @@ -78,6 +86,29 @@ nerd-fonts.droid-sans-mono nerd-fonts.space-mono nerd-fonts.dejavu-sans-mono + ] + ++ lib.optionals config.custom.gui.darwin.enable [ + raycast + custom.whatsapp-for-mac + ] + ++ lib.optionals config.custom.gui.linux.enable [ + zotero + zoom-us + spotify + slack + webex + whatsapp-for-linux + teams-for-linux + skypeforlinux + inputs.zen-browser.packages."${system}".twilight + chromium + arandr + seahorse # gnome keyring + xfce.thunar + xfce.thunar-volman + xclip + quickemu + gf # debugger ]; gtk = { @@ -89,15 +120,13 @@ }; qt = { - enable = true; + enable = config.custom.gui.linux.enable; platformTheme.name = "adwaita"; style.name = "adwaita-dark"; }; - systemd.user.sessionVariables = config.home.sessionVariables; - services.redshift = { - enable = true; + enable = config.custom.gui.linux.enable; # provider = "geoclue2"; provider = "manual"; # madison diff --git a/hosts/dango/default.nix b/hosts/dango/default.nix new file mode 100644 index 0000000..b7b3675 --- /dev/null +++ b/hosts/dango/default.nix @@ -0,0 +1,39 @@ +{ + inputs, + lib, + config, + pkgs, + system, + dots, + user, + hm, + host, + ... +}: { + imports = [ + ]; + + nixpkgs.hostPlatform = system; + + nix.enable = false; + + users.users = { + ${user} = { + home = "/Users/${user}"; + }; + }; + + custom = { + aerospace.enable = true; + }; + + hm.custom = { + emacs.enable = true; + latex.enable = false; + gui = { + default.enable = true; + darwin.enable = true; + ghostty.enable = true; + }; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix index 0e8f59e..2cbb8b9 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,69 +1,151 @@ { inputs, lib, - system, specialArgs, - dots, user ? "rayandrew", ... }: let mkNixosConfiguration = - host: - { - pkgs ? ( - import inputs.nixpkgs { - inherit system; - config.allowUnfree = true; + host: system: + let + pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ + (import ../overlays { + inherit inputs; + inherit (pkgs) system; + }) + ]; + }; + lib = ( + import ../lib.nix { + inherit (inputs.nixpkgs) lib; + inherit pkgs; + inherit (inputs) home-manager; } - ), - }: - lib.nixosSystem { - inherit pkgs; + ); + in + lib.nixosSystem { + inherit pkgs lib; - specialArgs = specialArgs // { - inherit host user dots; + specialArgs = specialArgs // { + inherit host user; + dots = "/home/${user}/dotfiles"; + }; + + modules = [ + inputs.disko.nixosModules.default + ./${host} + ./${host}/hardware.nix + ../nixos + ../overlays + ({config, ...}: { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + extraSpecialArgs = specialArgs // { + inherit host user system; + system-font = "Consolas"; + dots = "/home/${user}/dotfiles"; + home-dir = config.home-manager.users.${user}.home.homeDirectory; + }; + + users.${user} = { + imports = [ + inputs.nix-index-database.hmModules.nix-index + inputs.sops-nix.homeManagerModules.sops + ../home + ] ++ lib.optional(builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; + }; + }; + }) + # alias for home-manager + (lib.mkAliasOptionModule [ "hm" ] [ + "home-manager" + "users" + user + ]) + inputs.home-manager.nixosModules.home-manager + inputs.sops-nix.nixosModules.sops + ]; }; - modules = [ - inputs.disko.nixosModules.default - ./${host} - ./${host}/hardware.nix - ../nixos - ../overlays - ({config, ...}: { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; + mkDarwinConfiguration = + host: system: + let + pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ + (import ../overlays { + inherit inputs; + inherit (pkgs) system; + }) + inputs.nixpkgs-firefox-darwin.overlay + ]; + }; + lib = ( + import ../lib.nix { + inherit (inputs.nixpkgs) lib; + inherit pkgs; + inherit (inputs) home-manager; + } + ); + in + inputs.nix-darwin.lib.darwinSystem { + inherit pkgs lib; - extraSpecialArgs = specialArgs // { - inherit host user system dots; - home-dir = config.home-manager.users.${user}.home.homeDirectory; - }; + specialArgs = specialArgs // { + inherit host user; + dots = "/Users/${user}/dotfiles"; + }; - users.${user} = { - imports = [ - inputs.nix-index-database.hmModules.nix-index - inputs.sops-nix.homeManagerModules.sops - ../home - ] ++ lib.optional(builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; + modules = [ + ./${host} + ../darwin + ({config, ...}: { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + extraSpecialArgs = specialArgs // { + inherit host user system; + system-font = "SF Mono"; + home-dir = config.home-manager.users.${user}.home.homeDirectory; + dots = "/Users/${user}/dotfiles"; + }; + + users.${user} = { + imports = [ + inputs.nix-index-database.hmModules.nix-index + inputs.sops-nix.homeManagerModules.sops + inputs.mac-app-util.homeManagerModules.default + ../home + ] ++ lib.optional(builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; + }; }; - }; - }) - # alias for home-manager - (lib.mkAliasOptionModule [ "hm" ] [ - "home-manager" - "users" - user - ]) - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - ]; - }; + }) + # alias for home-manager + (lib.mkAliasOptionModule [ "hm" ] [ + "home-manager" + "users" + user + ]) + inputs.home-manager.darwinModules.home-manager + inputs.mac-app-util.darwinModules.default + inputs.nix-homebrew.darwinModules.nix-homebrew + ]; + }; in { nixosConfigurations = { - pickwick = mkNixosConfiguration "pickwick" { }; - lemur = mkNixosConfiguration "lemur" { }; + pickwick = mkNixosConfiguration "pickwick" "x86_64-linux"; + lemur = mkNixosConfiguration "lemur" "x86_64-linux"; + }; + darwinConfigurations = { + dango = mkDarwinConfiguration "dango" "aarch64-darwin"; }; } diff --git a/overlays/default.nix b/overlays/default.nix index 6219431..ce8ba4c 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,11 +1,7 @@ { inputs, - pkgs, ... -}: -{ - nixpkgs.overlays = [ - (_: prev: { +}: _: prev: { # include nixpkgs stable stable = import inputs.nixpkgs-stable { inherit (prev.pkgs) system; @@ -22,6 +18,4 @@ # use nixfmt-rfc-style as the default nixfmt = prev.nixfmt-rfc-style; - }) - ]; -} + } diff --git a/packages/default.nix b/packages/default.nix index 7bdeeb1..e6234af 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -8,4 +8,8 @@ let in rec { minimal-emacs-d = callPackage ./minimal-emacs-d { }; boomer = callPackage ./boomer { }; + nh = callPackage ./nh { }; + whatsapp-for-mac = callPackage ./whatsapp-for-mac { }; + sf-symbols = callPackage ./sf-symbols { full = true; }; + sf-mono = callPackage ./sf-mono { }; } diff --git a/packages/nh/default.nix b/packages/nh/default.nix new file mode 100644 index 0000000..dfaaa51 --- /dev/null +++ b/packages/nh/default.nix @@ -0,0 +1,71 @@ +{ + stdenv, + lib, + rustPlatform, + installShellFiles, + makeBinaryWrapper, + darwin, + fetchFromGitHub, + nix-update-script, + nvd, + nix-output-monitor, +}: +let + version = "4.0.0-beta.11"; + runtimeDeps = [ + nvd + nix-output-monitor + ]; +in +rustPlatform.buildRustPackage { + inherit version; + pname = "nh"; + + src = fetchFromGitHub { + owner = "viperML"; + repo = "nh"; + tag = "v${version}"; + hash = "sha256-ILEarFQp89V6RWr5GRU/ip9dB1SEqUFQGs1QMPrk9TQ="; + }; + + strictDeps = true; + + nativeBuildInputs = [ + installShellFiles + makeBinaryWrapper + ]; + + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + preFixup = '' + mkdir completions + $out/bin/nh completions bash > completions/nh.bash + $out/bin/nh completions zsh > completions/nh.zsh + $out/bin/nh completions fish > completions/nh.fish + + installShellCompletion completions/* + ''; + + postFixup = '' + wrapProgram $out/bin/nh \ + --prefix PATH : ${lib.makeBinPath runtimeDeps} + ''; + + useFetchCargoVendor = true; + cargoHash = "sha256-GnRLUV5dyQgcjBBQXzjW0dvfHqIrlBlIup4b7oL8InI="; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Yet another nix cli helper"; + homepage = "https://github.com/viperML/nh"; + license = lib.licenses.eupl12; + mainProgram = "nh"; + maintainers = with lib.maintainers; [ + drupol + viperML + ]; + }; +} diff --git a/packages/sf-mono/default.nix b/packages/sf-mono/default.nix new file mode 100644 index 0000000..87945a5 --- /dev/null +++ b/packages/sf-mono/default.nix @@ -0,0 +1,43 @@ +{ + lib, + stdenvNoCC, + fetchurl, + undmg, + xar, + cpio, +}: +stdenvNoCC.mkDerivation rec { + pname = "sf-mono"; + version = "2025-04-05"; + + src = fetchurl { + url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg"; + sha256 = "sha256-bUoLeOOqzQb5E/ZCzq0cfbSvNO1IhW1xcaLgtV2aeUU="; + }; + + nativeBuildInputs = [ + cpio + xar + undmg + ]; + + unpackPhase = '' + undmg $src + xar -xf SF\ Mono\ Fonts.pkg + cd SFMonoFonts.pkg + zcat Payload | cpio -id + ''; + + sourceRoot = "."; + + installPhase = '' + mkdir -p $out/share/fonts/truetype + cp ./Library/Fonts/* $out/share/fonts/truetype + ''; + + meta = { + description = "SF Mono"; + homepage = "https://developer.apple.com/fonts/"; + platforms = lib.platforms.all; + }; +} diff --git a/packages/sf-symbols/default.nix b/packages/sf-symbols/default.nix new file mode 100644 index 0000000..998ffe6 --- /dev/null +++ b/packages/sf-symbols/default.nix @@ -0,0 +1,63 @@ +{ + lib, + stdenvNoCC, + fetchurl, + undmg, + xar, + cpio, + fonts ? true, + full ? false, + app ? false, +}: +stdenvNoCC.mkDerivation rec { + pname = "sf-symbols"; + version = "6"; + + src = fetchurl { + url = "https://devimages-cdn.apple.com/design/resources/download/SF-Symbols-${version}.dmg"; + sha256 = "sha256-hG6QyidNVtI0pXO698oGVsG4awy8XWr27nEyYSUMhPo="; + }; + + nativeBuildInputs = [ + cpio + xar + undmg + ]; + + unpackPhase = '' + undmg $src + xar -xf SF\ Symbols.pkg + cd SFSymbols.pkg + zcat Payload | cpio -id + ''; + + sourceRoot = "."; + + installPhase = + '' + '' + + lib.optionalString fonts '' + mkdir -p $out/share/fonts/truetype + cp ./Library/Fonts/${ + if full + then "*" + else "SF-Pro.ttf" + } $out/share/fonts/truetype + '' + + lib.optionalString app '' + mkdir -p $out/Applications + cp -R ./Applications/SF\ Symbols.app $out/Applications + ''; + + meta = { + description = + if app + then "Tool that provides consistent, highly configurable symbols for apps" + else "Fonts from SF Symbols"; + homepage = "https://developer.apple.com/sf-symbols/"; + platforms = + if app + then lib.platforms.darwin + else lib.platforms.all; + }; +} diff --git a/packages/whatsapp-for-mac/default.nix b/packages/whatsapp-for-mac/default.nix new file mode 100644 index 0000000..c48521d --- /dev/null +++ b/packages/whatsapp-for-mac/default.nix @@ -0,0 +1,58 @@ +{ + lib, + fetchzip, + stdenvNoCC, + writeShellApplication, + curl, + xmlstarlet, + common-updater-scripts, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "whatsapp-for-mac"; + version = "2.25.8.76"; + + src = fetchzip { + extension = "zip"; + name = "WhatsApp.app"; + url = "https://web.whatsapp.com/desktop/mac_native/release/?version=${finalAttrs.version}&extension=zip&configuration=Release&branch=relbranch"; + hash = "sha256-yrQSGnAr5qDNZ7ouqxHlYed2SLBCOu66aKFOzyiegaU="; + }; + + dontConfigure = true; + dontBuild = true; + + sourceRoot = "."; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/Applications" + cp -r *.app "$out/Applications" + + runHook postInstall + ''; + + passthru.updateScript = lib.getExe (writeShellApplication { + name = "whatsapp-update-script"; + runtimeInputs = [ + curl + xmlstarlet + common-updater-scripts + ]; + text = '' + url=$(curl --silent "https://web.whatsapp.com/desktop/mac_native/updates/?branch=relbranch&configuration=Release") + version=$(echo "$url" | xmlstarlet sel -t -v "substring-before(substring-after(//enclosure/@url, 'version='), '&')") + update-source-version whatsapp-for-mac "$version" --file=./pkgs/by-name/wh/whatsapp-for-mac/package.nix + ''; + }); + + meta = { + description = "Native desktop client for WhatsApp"; + homepage = "https://www.whatsapp.com/"; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ iivusly ]; + platforms = lib.platforms.darwin; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + }; +})