diff --git a/flake.lock b/flake.lock index 3085b83a..5034bb7b 100644 --- a/flake.lock +++ b/flake.lock @@ -10,11 +10,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1723293904, - "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", + "lastModified": 1754433428, + "narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=", "owner": "ryantm", "repo": "agenix", - "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", + "rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d", "type": "github" }, "original": { @@ -75,6 +75,23 @@ "url": "ssh://gitea@git.sealight.xyz/aynish/basant" } }, + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1758543057, + "narHash": "sha256-lw3V2jOGYphUFHYQ5oARcb6urlbNpUCLJy1qhsGdUmc=", + "owner": "Homebrew", + "repo": "brew", + "rev": "5b236456eb93133c2bd0d60ef35ed63f1c0712f6", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "4.6.12", + "repo": "brew", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -83,11 +100,11 @@ ] }, "locked": { - "lastModified": 1700795494, - "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "lastModified": 1744478979, + "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "rev": "43975d782b418ebf4969e9ccba82466728c2851b", "type": "github" }, "original": { @@ -97,6 +114,27 @@ "type": "github" } }, + "darwin_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757432263, + "narHash": "sha256-qHn+/0+IOz5cG68BZUwL9BV3EO/e9eNKCjH3+N7wMdI=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "1fef4404de4d1596aa5ab2bd68078370e1b9dcdb", + "type": "github" + }, + "original": { + "owner": "LnL7", + "ref": "nix-darwin-25.05", + "repo": "nix-darwin", + "type": "github" + } + }, "deploy-rs": { "inputs": { "flake-compat": "flake-compat_2", @@ -106,11 +144,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1718194053, - "narHash": "sha256-FaGrf7qwZ99ehPJCAwgvNY5sLCqQ3GDiE/6uLhxxwSY=", + "lastModified": 1756719547, + "narHash": "sha256-N9gBKUmjwRKPxAafXEk1EGadfk2qDZPBQp4vXWPHINQ=", "owner": "serokell", "repo": "deploy-rs", - "rev": "3867348fa92bc892eba5d9ddb2d7a97b9e127a8a", + "rev": "125ae9e3ecf62fb2c0fd4f2d894eb971f1ecaed2", "type": "github" }, "original": { @@ -178,11 +216,11 @@ ] }, "locked": { - "lastModified": 1724031427, - "narHash": "sha256-o1HdAf+7IGv9M13R3c+zc/sJ0QgeEnhsvHBcodI4UpM=", + "lastModified": 1758287904, + "narHash": "sha256-IGmaEf3Do8o5Cwp1kXBN1wQmZwQN3NLfq5t4nHtVtcU=", "owner": "nix-community", "repo": "disko", - "rev": "4e719b38fa7c85f4f65d0308ca7084c91e7bdd6d", + "rev": "67ff9807dd148e704baadbd4fd783b54282ca627", "type": "github" }, "original": { @@ -232,11 +270,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -277,6 +315,27 @@ "type": "indirect" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-root": { "locked": { "lastModified": 1692742795, @@ -405,11 +464,11 @@ }, "hardware": { "locked": { - "lastModified": 1723310128, - "narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", + "lastModified": 1758663926, + "narHash": "sha256-6CFdj7Xs616t1W4jLDH7IohAAvl5Dyib3qEv/Uqw1rk=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", + "rev": "170ff93c860b2a9868ed1e1102d4e52cb3d934e1", "type": "github" }, "original": { @@ -426,11 +485,11 @@ ] }, "locked": { - "lastModified": 1703113217, - "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "lastModified": 1745494811, + "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", "owner": "nix-community", "repo": "home-manager", - "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", "type": "github" }, "original": { @@ -446,11 +505,11 @@ ] }, "locked": { - "lastModified": 1751810233, - "narHash": "sha256-kllkNbIqQi3VplgTMeGzuh1t8Gk8TauvkTRt93Km+tQ=", + "lastModified": 1758463745, + "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=", "owner": "nix-community", "repo": "home-manager", - "rev": "9b0873b46c9f9e4b7aa01eb634952c206af53068", + "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3", "type": "github" }, "original": { @@ -460,6 +519,75 @@ "type": "github" } }, + "homebrew-bundle": { + "flake": false, + "locked": { + "lastModified": 1745335228, + "narHash": "sha256-TIKR2UgtyUmHLNZp255/vLs+1I10hXe+sciMEbAGFwE=", + "owner": "homebrew", + "repo": "homebrew-bundle", + "rev": "a3265c84b232e13048ecbf6fc18a2eedfadbeb08", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-bundle", + "type": "github" + } + }, + "homebrew-cask": { + "flake": false, + "locked": { + "lastModified": 1759110411, + "narHash": "sha256-wsvLofMB/1bkjY6OQjjWU80+AbQiPzZSLZ3cjsYpOAs=", + "owner": "homebrew", + "repo": "homebrew-cask", + "rev": "80f95de379d69edb696dd29106b2d8b077c98896", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-cask", + "type": "github" + } + }, + "homebrew-core": { + "flake": false, + "locked": { + "lastModified": 1759116320, + "narHash": "sha256-FGqC/WlIJnMkhV7l6XK6r5AqUYkwTHvHBCUjFe3DUUY=", + "owner": "homebrew", + "repo": "homebrew-core", + "rev": "0ccf924357d3eca3268d6dafb224ad9dc4f2398a", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-core", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "unstable" + ] + }, + "locked": { + "lastModified": 1757230583, + "narHash": "sha256-4uqu7sFPOaVTCogsxaGMgbzZ2vK40GVGMfUmrvK3/LY=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "fc3960e6c32c9d4f95fff2ef84444284d24d3bea", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, "lowdown-src": { "flake": false, "locked": { @@ -516,6 +644,46 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src" + }, + "locked": { + "lastModified": 1758598228, + "narHash": "sha256-qr60maXGbZ4FX5tejPRI3nr0bnRTnZ3AbbbfO6/6jq4=", + "owner": "zhaofengli-wip", + "repo": "nix-homebrew", + "rev": "f36e5db56e117f7df701ab152d0d2036ea85218c", + "type": "github" + }, + "original": { + "owner": "zhaofengli-wip", + "repo": "nix-homebrew", + "type": "github" + } + }, "nix-matrix-appservices": { "inputs": { "devshell": "devshell", @@ -576,11 +744,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1723310128, - "narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", + "lastModified": 1758663926, + "narHash": "sha256-6CFdj7Xs616t1W4jLDH7IohAAvl5Dyib3qEv/Uqw1rk=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", + "rev": "170ff93c860b2a9868ed1e1102d4e52cb3d934e1", "type": "github" }, "original": { @@ -690,11 +858,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1755274400, - "narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", + "lastModified": 1758791193, + "narHash": "sha256-F8WmEwFoHsnix7rt290R0rFXNJiMbClMZyIC/e+HYf0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad7196ae55c295f53a7d1ec39e4a06d922f3b899", + "rev": "25e53aa156d47bad5082ff7618f5feb1f5e02d01", "type": "github" }, "original": { @@ -704,13 +872,33 @@ "type": "github" } }, - "nur": { + "nixpkgs_5": { "locked": { - "lastModified": 1724040334, - "narHash": "sha256-Ia4gRRmhFn4oJ4SJKJPDNPomsRRFWU+bqCK7yuiLW4E=", + "lastModified": 1758690382, + "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e643668fd71b949c53f8626614b21ff71a07379d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1759117007, + "narHash": "sha256-DSnkPMhK2Eg0XLiyjEPVtIpdcmWmYsBMhVGCN1144SA=", "owner": "nix-community", "repo": "NUR", - "rev": "24471a48600e18669d13d24c9640b9859357d2cf", + "rev": "fccc09dffa659dc1410eceb33285831ba12bc7f6", "type": "github" }, "original": { @@ -726,11 +914,11 @@ ] }, "locked": { - "lastModified": 1756350023, - "narHash": "sha256-4S6EUvEFvOnwjSo/LqAVVuX2/JjAJ8gQFmQQ0DS4oXU=", + "lastModified": 1759014010, + "narHash": "sha256-NMpUufnxiGDTs/4Nxj8t+n4wc4aSs02a4T5OORo0gBQ=", "ref": "main", - "rev": "a807111f9b20c501183516baf8082c4359aaaaa1", - "revCount": 1594, + "rev": "08c1dddf38c39d6f7c73a24f4d396f4c925185bf", + "revCount": 1602, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, @@ -775,11 +963,17 @@ "agenix": "agenix", "autohide-tdrop": "autohide-tdrop", "basant": "basant", + "darwin": "darwin_2", "deploy-rs": "deploy-rs", "disko": "disko", "grasp": "grasp", "hardware": "hardware", "home-manager": "home-manager_2", + "homebrew-bundle": "homebrew-bundle", + "homebrew-cask": "homebrew-cask", + "homebrew-core": "homebrew-core", + "jovian": "jovian", + "nix-homebrew": "nix-homebrew", "nix-matrix-appservices": "nix-matrix-appservices", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_4", @@ -815,11 +1009,11 @@ ] }, "locked": { - "lastModified": 1724034091, - "narHash": "sha256-b1g7w0sw+MDAhUAeCoX1vlTghsqcDZkxr+k9OZmxPa8=", + "lastModified": 1759113356, + "narHash": "sha256-xm4kEUcV2jk6u15aHazFP4YsMwhq+PczA+Ul/4FDKWI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c7d36e0947826e0751a5214ffe82533fbc909bc0", + "rev": "be3b8843a2be2411500f6c052876119485e957a2", "type": "github" }, "original": { @@ -933,11 +1127,11 @@ "vowel-src": "vowel-src" }, "locked": { - "lastModified": 1723223284, - "narHash": "sha256-NAT+g5nsaJZkpR0sCZjerd1xx233ZUdRH3ZWwZhzq/c=", + "lastModified": 1730626669, + "narHash": "sha256-nFyZrvTPn9OM9UZmuAwy3e1Ba0ZuYc2FaDCOOhGtqg4=", "owner": "mitchmindtree", "repo": "tidalcycles.nix", - "rev": "82f3e8e8d02eb9f0c9dfe9ab3773b825c6bc1982", + "rev": "0db0918e7a3d3c30ed7a6e81dc9d4e3832870ac4", "type": "github" }, "original": { @@ -966,11 +1160,11 @@ }, "unstable": { "locked": { - "lastModified": 1752687322, - "narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=", + "lastModified": 1758690382, + "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251", + "rev": "e643668fd71b949c53f8626614b21ff71a07379d", "type": "github" }, "original": { @@ -985,11 +1179,11 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 616d6edd..ced56e29 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,33 @@ # Matrix nix-matrix-appservices.url = "gitlab:coffeetables/nix-matrix-appservices"; + # Darwin + darwin = { + url = "github:LnL7/nix-darwin/nix-darwin-25.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-homebrew = { + url = "github:zhaofengli-wip/nix-homebrew"; + }; + homebrew-bundle = { + url = "github:homebrew/homebrew-bundle"; + flake = false; + }; + homebrew-core = { + url = "github:homebrew/homebrew-core"; + flake = false; + }; + homebrew-cask = { + url = "github:homebrew/homebrew-cask"; + flake = false; + }; + + # Steam Deck / Gaming + jovian = { + url = "github:Jovian-Experiments/Jovian-NixOS"; + inputs.nixpkgs.follows = "unstable"; + }; + # Others nur.url = "github:nix-community/NUR"; rust-overlay = { @@ -61,7 +88,8 @@ outputs = { self, nixpkgs, unstable, nixos-hardware, home-manager, deploy-rs , agenix, disko, basant, grasp, nix-matrix-appservices, nur, tidalcycles - , rust-overlay, vimwikicli, autohide-tdrop, ... }@inputs: + , rust-overlay, vimwikicli, autohide-tdrop, darwin, nix-homebrew, homebrew-bundle + , homebrew-core, homebrew-cask, jovian, ... }@inputs: let forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" @@ -124,6 +152,65 @@ tidalcycles.overlays.default # needed for nvim which comes pre-installed lol ]; }); + + # Package set for Darwin systems + darwinPkgsFor = forAllSystems (system: + import nixpkgs { + inherit system; + config = { + permittedInsecurePackages = [ + "olm-3.2.16" + ]; + allowUnfreePredicate = pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "ripcord" + "vcv-rack" + "SunVox" + "renoise" + ]; + }; + overlays = [ + rust-overlay.overlays.default + tidalcycles.overlays.default + agenix.overlays.default + nur.overlay + unstableOverlay + vimwikiOverlay + self.overlays.additions + self.overlays.modifications + ]; + }); + + # Package set for Steam Deck (gaming-focused) + deckPkgsFor = forAllSystems (system: + import unstable { + inherit system; + config = { + permittedInsecurePackages = [ + "olm-3.2.16" + ]; + allowUnfreePredicate = pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "ripcord" + "vcv-rack" + "SunVox" + "renoise" + "steam" + "steam-original" + "steam-runtime" + ]; + }; + overlays = [ + rust-overlay.overlays.default + tidalcycles.overlays.default + agenix.overlays.default + nur.overlay + unstableOverlay + vimwikiOverlay + self.overlays.additions + self.overlays.modifications + ]; + }); in { # Your custom packages # Acessible through 'nix build', 'nix shell', etc @@ -230,6 +317,48 @@ } ]; }; + + deck = unstable.lib.nixosSystem rec { + specialArgs = { inherit inputs self; }; + system = "x86_64-linux"; + pkgs = deckPkgsFor.${system}; + modules = [ + ./hosts/deck + jovian.nixosModules.default + self.nixosModules.wireguard + agenix.nixosModules.age + self.nixosModules.backup + home-manager.nixosModules.home-manager + { + nix.registry.nixpkgs.flake = unstable; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.anish = import ./home/gui; + } + ]; + }; + }; + + # Darwin configuration entrypoint + darwinConfigurations = { + "Anishs-MacBook-Pro" = darwin.lib.darwinSystem rec { + system = "aarch64-darwin"; + pkgs = darwinPkgsFor.${system}; + specialArgs = { inherit inputs self; }; + modules = [ + ./hosts/darwin + home-manager.darwinModules.home-manager + agenix.darwinModules.default + { + users.users.anishlakhwara.home = "/Users/anishlakhwara"; + home-manager = { + users.anishlakhwara = import ./home/darwin; + useGlobalPkgs = true; + useUserPackages = true; + }; + } + ]; + }; }; # Standalone home-manager configuration entrypoint diff --git a/home/darwin/default.nix b/home/darwin/default.nix new file mode 100644 index 00000000..289f8c84 --- /dev/null +++ b/home/darwin/default.nix @@ -0,0 +1,28 @@ +{ self, pkgs, ... }: +{ + imports = [ + ../profiles/nvim + ../profiles/cli + ../profiles/direnv + ../profiles/git + ../profiles/task + ../profiles/kitty + # ../profiles/firefox + ]; + + home.username = "anishlakhwara"; + home.homeDirectory = "/Users/anishlakhwara"; + home.stateVersion = "22.05"; + + programs.zsh.initExtra = '' + PATH=/Users/anishlakhwara/.sourcegraph/bin:/Users/anishlakhwara/.sourcegraph/sg.zsh_autocomplete:/Users/anishlakhwara/google-cloud-sdk/bin:/Users/anishlakhwara/google-cloud-sdk/completion.zsh.inc:/Users/anishlakhwara/google-cloud-sdk/path.zsh.inc:/Users/anishlakhwara/.sg:/opt/homebrew/bin:$PATH + ''; + + # Managing sketchybar plugins from home-manager + home.file = { + ".config/sketchybar" = { + source = ./sketchybar; + recursive = true; + }; + }; +} diff --git a/home/darwin/sketchybar/battery.sh b/home/darwin/sketchybar/battery.sh new file mode 100644 index 00000000..0414f3bc --- /dev/null +++ b/home/darwin/sketchybar/battery.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$CYAN" + +sketchybar --add item battery right \ + --set battery \ + update_freq=60 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.padding_right=10 \ + label.color="$COLOR" \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/power.sh" \ + --subscribe battery power_source_change diff --git a/home/darwin/sketchybar/items/battery.sh b/home/darwin/sketchybar/items/battery.sh new file mode 100755 index 00000000..0414f3bc --- /dev/null +++ b/home/darwin/sketchybar/items/battery.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$CYAN" + +sketchybar --add item battery right \ + --set battery \ + update_freq=60 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.padding_right=10 \ + label.color="$COLOR" \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/power.sh" \ + --subscribe battery power_source_change diff --git a/home/darwin/sketchybar/items/calendar.sh b/home/darwin/sketchybar/items/calendar.sh new file mode 100755 index 00000000..064a1919 --- /dev/null +++ b/home/darwin/sketchybar/items/calendar.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +COLOR="$BLUE" + +sketchybar --add item calendar right \ + --set calendar update_freq=15 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/calendar.sh" diff --git a/home/darwin/sketchybar/items/clock.sh b/home/darwin/sketchybar/items/clock.sh new file mode 100755 index 00000000..0dbf7e41 --- /dev/null +++ b/home/darwin/sketchybar/items/clock.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +COLOR="$MAGENTA" + +sketchybar --add item clock right \ + --set clock update_freq=60 \ + icon.padding_left=10 \ + icon.color="$COLOR" \ + icon=" " \ + label.color="$COLOR" \ + label.padding_right=5 \ + label.width=43 \ + align=center \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=2 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/clock.sh" diff --git a/home/darwin/sketchybar/items/cpu.sh b/home/darwin/sketchybar/items/cpu.sh new file mode 100755 index 00000000..b4c6493e --- /dev/null +++ b/home/darwin/sketchybar/items/cpu.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +COLOR="$YELLOW" + +sketchybar --add item cpu right \ + --set cpu \ + update_freq=3 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/cpu.sh" diff --git a/home/darwin/sketchybar/items/front_app.sh b/home/darwin/sketchybar/items/front_app.sh new file mode 100755 index 00000000..ecee1a8c --- /dev/null +++ b/home/darwin/sketchybar/items/front_app.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$WHITE" + +sketchybar \ + --add item front_app left \ + --set front_app script="$PLUGIN_DIR/front_app.sh" \ + icon.drawing=off \ + background.height=26 \ + background.padding_left=0 \ + background.padding_right=10 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.corner_radius="$CORNER_RADIUS" \ + background.color="$BAR_COLOR" \ + label.color="$COLOR" \ + label.padding_left=10 \ + label.padding_right=10 \ + associated_display=active \ + --subscribe front_app front_app_switched diff --git a/home/darwin/sketchybar/items/spaces.sh b/home/darwin/sketchybar/items/spaces.sh new file mode 100755 index 00000000..52743696 --- /dev/null +++ b/home/darwin/sketchybar/items/spaces.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") + +sketchybar --add item spacer.1 left \ + --set spacer.1 background.drawing=off \ + label.drawing=off \ + icon.drawing=off \ + width=10 + +for i in {0..9}; do + sid=$((i + 1)) + sketchybar --add space space.$sid left \ + --set space.$sid associated_space=$sid \ + label.drawing=off \ + icon.padding_left=10 \ + icon.padding_right=10 \ + background.padding_left=-5 \ + background.padding_right=-5 \ + script="$PLUGIN_DIR/space.sh" +done + +sketchybar --add item spacer.2 left \ + --set spacer.2 background.drawing=off \ + label.drawing=off \ + icon.drawing=off \ + width=5 + +sketchybar --add bracket spaces '/space.*/' \ + --set spaces background.border_width="$BORDER_WIDTH" \ + background.border_color="$RED" \ + background.corner_radius="$CORNER_RADIUS" \ + background.color="$BAR_COLOR" \ + background.height=26 \ + background.drawing=on + +sketchybar --add item separator left \ + --set separator icon= \ + icon.font="$FONT:Regular:16.0" \ + background.padding_left=26 \ + background.padding_right=15 \ + label.drawing=off \ + associated_display=active \ + icon.color="$YELLOW" diff --git a/home/darwin/sketchybar/items/spotify.sh b/home/darwin/sketchybar/items/spotify.sh new file mode 100755 index 00000000..b94fe7aa --- /dev/null +++ b/home/darwin/sketchybar/items/spotify.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +COLOR="$ORANGE" + +sketchybar --add item spotify q \ + --set spotify \ + scroll_texts=on \ + icon=󰎆 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + background.color="$BAR_COLOR" \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.padding_right=-5 \ + background.drawing=on \ + label.padding_right=10 \ + label.max_chars=20 \ + associated_display=active \ + updates=on \ + script="$PLUGIN_DIR/spotify.sh" \ + --subscribe spotify media_change diff --git a/home/darwin/sketchybar/items/volume.sh b/home/darwin/sketchybar/items/volume.sh new file mode 100755 index 00000000..77f746db --- /dev/null +++ b/home/darwin/sketchybar/items/volume.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$GREEN" + +sketchybar \ + --add item sound right \ + --set sound \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/sound.sh" \ + --subscribe sound volume_change diff --git a/home/darwin/sketchybar/items/vpn.sh b/home/darwin/sketchybar/items/vpn.sh new file mode 100755 index 00000000..2c640c90 --- /dev/null +++ b/home/darwin/sketchybar/items/vpn.sh @@ -0,0 +1,4 @@ +sketchybar -m --add item vpn right \ + --set vpn icon= \ + update_freq=5 \ + script="~/.config/sketchybar/plugins/vpn.sh" diff --git a/home/darwin/sketchybar/plugins/calendar.sh b/home/darwin/sketchybar/plugins/calendar.sh new file mode 100755 index 00000000..9194e224 --- /dev/null +++ b/home/darwin/sketchybar/plugins/calendar.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sketchybar --set "$NAME" icon="󰸗 " label="$(date '+%a %d. %b')" diff --git a/home/darwin/sketchybar/plugins/clock.sh b/home/darwin/sketchybar/plugins/clock.sh new file mode 100755 index 00000000..f5f6d9f2 --- /dev/null +++ b/home/darwin/sketchybar/plugins/clock.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +LABEL=$(date '+%H:%M') +sketchybar --set "$NAME" icon=" " label="$LABEL" diff --git a/home/darwin/sketchybar/plugins/cpu.sh b/home/darwin/sketchybar/plugins/cpu.sh new file mode 100755 index 00000000..77e7573b --- /dev/null +++ b/home/darwin/sketchybar/plugins/cpu.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sketchybar --set "$NAME" icon="" label="$(ps -A -o %cpu | awk '{s+=$1} END {s /= 8} END {printf "%.1f%%\n", s}')" diff --git a/home/darwin/sketchybar/plugins/front_app.sh b/home/darwin/sketchybar/plugins/front_app.sh new file mode 100755 index 00000000..8f446a35 --- /dev/null +++ b/home/darwin/sketchybar/plugins/front_app.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +case "$SENDER" in +"front_app_switched") + sketchybar --set "$NAME" label="$INFO" + ;; +esac diff --git a/home/darwin/sketchybar/plugins/power.sh b/home/darwin/sketchybar/plugins/power.sh new file mode 100755 index 00000000..181ae01e --- /dev/null +++ b/home/darwin/sketchybar/plugins/power.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) +CHARGING=$(pmset -g batt | grep 'AC Power') + +if [ "$PERCENTAGE" = "" ]; then + exit 0 +fi + +case ${PERCENTAGE} in +9[0-9] | 100) + ICON=" " + ;; +[6-8][0-9]) + ICON=" " + ;; +[3-5][0-9]) + ICON=" " + ;; +[1-2][0-9]) + ICON=" " + ;; +*) ICON=" " ;; +esac + +if [ "$CHARGING" != "" ]; then + ICON="" +fi + +sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}% " diff --git a/home/darwin/sketchybar/plugins/sound.sh b/home/darwin/sketchybar/plugins/sound.sh new file mode 100755 index 00000000..65f9446a --- /dev/null +++ b/home/darwin/sketchybar/plugins/sound.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +VOLUME=$(osascript -e "output volume of (get volume settings)") +MUTED=$(osascript -e "output muted of (get volume settings)") + +if [ "$MUTED" != "false" ]; then + ICON="󰖁 " + VOLUME=0 +else + case ${VOLUME} in + 100) ICON=" " ;; + [5-9]*) ICON=" " ;; + [0-9]*) ICON=" " ;; + *) ICON=" " ;; + esac +fi + +sketchybar -m \ + --set "$NAME" icon=$ICON \ + --set "$NAME" label="$VOLUME%" diff --git a/home/darwin/sketchybar/plugins/space.sh b/home/darwin/sketchybar/plugins/space.sh new file mode 100755 index 00000000..79b4d338 --- /dev/null +++ b/home/darwin/sketchybar/plugins/space.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors + +SPACE_ICONS=(" " " " "󰺻 " " " " " "6" "7" "8" "9" "10") + +SPACE_CLICK_SCRIPT="yabai -m space --focus $SID 2>/dev/null" + +if [ "$SELECTED" = "true" ]; then + sketchybar --animate tanh 5 --set "$NAME" \ + icon.color="$RED" \ + icon="${SPACE_ICONS[$SID - 1]}" \ + click_script="$SPACE_CLICK_SCRIPT" +else + sketchybar --animate tanh 5 --set "$NAME" \ + icon.color="$COMMENT" \ + icon="${SPACE_ICONS[$SID - 1]}" \ + click_script="$SPACE_CLICK_SCRIPT" +fi diff --git a/home/darwin/sketchybar/plugins/spotify.sh b/home/darwin/sketchybar/plugins/spotify.sh new file mode 100755 index 00000000..d0dbc33e --- /dev/null +++ b/home/darwin/sketchybar/plugins/spotify.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +STATE="$(echo "$INFO" | jq -r '.state')" +APP="$(echo "$INFO" | jq -r '.app')" + +if [ "$STATE" = "playing" ] && [ "$APP" == "Spotify" ]; then + MEDIA="$(echo "$INFO" | jq -r '.title + " - " + .artist')" + sketchybar --set "$NAME" label="$MEDIA" drawing=on +else + sketchybar --set "$NAME" drawing=off +fi diff --git a/home/darwin/sketchybar/plugins/vpn.sh b/home/darwin/sketchybar/plugins/vpn.sh new file mode 100755 index 00000000..8b71a6e2 --- /dev/null +++ b/home/darwin/sketchybar/plugins/vpn.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +### You need to edit sudoers file to run wg-quick without password + +# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick + +WG_PIDFILE="/var/run/wireguard/wg0.name" + +if [ -f $WG_PIDFILE ]; then + sketchybar -m --set vpn icon= \ + label="$VPN" \ + drawing=on \ + click_script="~/.config/sketchybar/plugins/wg_off.sh" +else + sketchybar -m --set vpn drawing=off click_script="~/.config/sketchybar/plugins/wg_on.sh" +fi diff --git a/home/darwin/sketchybar/plugins/wg_off.sh b/home/darwin/sketchybar/plugins/wg_off.sh new file mode 100755 index 00000000..8d9713e0 --- /dev/null +++ b/home/darwin/sketchybar/plugins/wg_off.sh @@ -0,0 +1,5 @@ +### You need to edit sudoers file to run wg-quick without password + +# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick + +sudo wg-quick down wg0 diff --git a/home/darwin/sketchybar/plugins/wg_on.sh b/home/darwin/sketchybar/plugins/wg_on.sh new file mode 100755 index 00000000..532ca0ad --- /dev/null +++ b/home/darwin/sketchybar/plugins/wg_on.sh @@ -0,0 +1,5 @@ +### You need to edit sudoers file to run wg-quick without password + +# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick + +sudo wg-quick up wg0 diff --git a/home/darwin/sketchybar/variables.sh b/home/darwin/sketchybar/variables.sh new file mode 100755 index 00000000..84ca8c83 --- /dev/null +++ b/home/darwin/sketchybar/variables.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env sh + +# Color Palette +# Tokyonight Night +BLACK=0xff24283b +WHITE=0xffa9b1d6 +MAGENTA=0xffbb9af7 +BLUE=0xff7aa2f7 +CYAN=0xff7dcfff +GREEN=0xff9ece6a +YELLOW=0xffe0af68 +ORANGE=0xffff9e64 +RED=0xfff7768e +BAR_COLOR=0xff1a1b26 +COMMENT=0xff565f89 + +# Tokyonight Day +# BLACK=0xffe9e9ed +# WHITE=0xff3760bf +# MAGENTA=0xff9854f1 +# BLUE=0xff2e7de9 +# CYAN=0xff007197 +# GREEN=0xff587539 +# YELLOW=0xff8c6c3e +# ORANGE=0xffb15c00 +# RED=0xfff52a65 +# BAR_COLOR=0xffe1e2e7 + +TRANSPARENT=0x00000000 + +# General bar colors +ICON_COLOR=$WHITE # Color of all icons +LABEL_COLOR=$WHITE # Color of all labels + +ITEM_DIR="$HOME/.config/sketchybar/items" +PLUGIN_DIR="$HOME/.config/sketchybar/plugins" + +FONT="Iosevka Nerd Font" + +PADDINGS=3 + +POPUP_BORDER_WIDTH=2 +POPUP_CORNER_RADIUS=11 +POPUP_BACKGROUND_COLOR=$BLACK +POPUP_BORDER_COLOR=$COMMENT + +CORNER_RADIUS=15 +BORDER_WIDTH=2 + +SHADOW=on diff --git a/hosts/darwin/casks/default.nix b/hosts/darwin/casks/default.nix new file mode 100644 index 00000000..e645495e --- /dev/null +++ b/hosts/darwin/casks/default.nix @@ -0,0 +1,43 @@ +{ ... }: + +{ + homebrew.enable = true; + homebrew.brews = [ + "kind" + "kubectl" + "bazelisk" + "sourcegraph/src-cli/src-cli" + "gh" + # "postgresql@15" + # "redis" + ]; + homebrew.casks = [ + # Development Tools + "homebrew/cask/docker" + # "syncthing" + # "insomnia" + # "tableplus" + # "ngrok" + "postico" + "wireshark" + "1password" + "orbstack" + + # Communication Tools + # Already installed manually + # "loom" + # "slack" + # "zoom" + # "firefox" + # "1password-cli" + + # Utility Tools + # "syncthing" + + # Productivity Tools + "raycast" + + # AI + # "diffusionbee" + ]; +} diff --git a/hosts/darwin/default.nix b/hosts/darwin/default.nix new file mode 100644 index 00000000..25cc7264 --- /dev/null +++ b/hosts/darwin/default.nix @@ -0,0 +1,154 @@ +{ self, pkgs, config, ... }: + +{ + imports = [ + ./sketchybar + ./yabai + # ./casks + # ../../modules/darwin/home-manager.nix + # ../../modules/shared + # ../../modules/shared/cachix + ]; + + environment.systemPackages = [ + pkgs.go + pkgs.python3 + pkgs.cargo + pkgs.k9s + pkgs.kubernetes-helm + pkgs.shellcheck + ]; + + age.identityPaths = [ "/Users/anishlakhwara/.ssh/id_ed25519" ]; + age.secrets.work-wg.file = "${self}/secrets/work-wg.age"; + age.secrets.work-wg.owner = "anishlakhwara"; + networking.wg-quick.interfaces = { + wg0 = { + address = [ "10.0.69.7/24" ]; + listenPort = 60990; # to match firewall allowedUDPPorts (without this wg uses random port numbers) + privateKeyFile = config.age.secrets.work-wg.path; + dns = [ "10.0.69.4" ]; + postDown = '' + sudo /usr/sbin/networksetup -setdnsservers Wi-Fi "Empty" + ''; + peers = [ + # For a client configuration, one peer entry for the server will suffice. + { + publicKey = "c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI="; + allowedIPs = [ "10.0.69.0/24" ]; + # Set this to the server IP and port. + endpoint = "sealight.xyz:60990"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 + persistentKeepalive = 25; + } + ]; + }; + }; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + nixpkgs.hostPlatform = "aarch64-darwin"; + programs.zsh.enable = true; + + # Setup user, packages, programs + nix = { + # package = pkgs.nixUnstable; + settings.trusted-users = [ "@admin" "anishlakhwara" ]; + + gc = { + user = "root"; + automatic = true; + interval = { Weekday = 0; Hour = 2; Minute = 0; }; + options = "--delete-older-than 30d"; + }; + + # Turn this on to make command line easier + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + # Turn off NIX_PATH warnings now that we're using flakes + system.checks.verifyNixPath = false; + + # Load configuration that is shared across systems + # environment.systemPackages = with pkgs; [ + # + # ] ++ (import ../../modules/shared/packages.nix { inherit pkgs; }); + + # Enable fonts dir + # fonts.fontDir.enable = true; + fonts.packages = with pkgs; [ + fira-code + fira-code-symbols + hermit + #hack + siji + font-awesome + proggyfonts + (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "Iosevka" ]; }) + ]; + + system = { + stateVersion = 4; + + keyboard = { + enableKeyMapping = true; + }; + + defaults = { + LaunchServices = { + LSQuarantine = false; + }; + + NSGlobalDomain = { + AppleShowAllExtensions = true; + ApplePressAndHoldEnabled = false; + + # 120, 90, 60, 30, 12, 6, 2 + KeyRepeat = 2; + + # 120, 94, 68, 35, 25, 15 + InitialKeyRepeat = 15; + + "com.apple.mouse.tapBehavior" = 1; + "com.apple.sound.beep.volume" = 0.0; + "com.apple.sound.beep.feedback" = 0; + }; + + loginwindow = { + # disable guest account + GuestEnabled = false; + # show name instead of username + SHOWFULLNAME = false; + }; + + dock = { + autohide = true; + autohide-delay = 0.0; + autohide-time-modifier = 1.0; + static-only = false; + showhidden = false; + show-recents = false; + launchanim = true; + mouse-over-hilite-stack = true; + orientation = "bottom"; + tilesize = 48; + mru-spaces = false; + }; + + finder = { + _FXShowPosixPathInTitle = false; + }; + + trackpad = { + Clicking = false; + TrackpadThreeFingerDrag = true; + }; + }; + + # keyboard = { + # enableKeyMapping = true; + # remapCapsLockToControl = true; + # }; + }; +} diff --git a/hosts/darwin/sketchybar/default.nix b/hosts/darwin/sketchybar/default.nix new file mode 100644 index 00000000..8fe56678 --- /dev/null +++ b/hosts/darwin/sketchybar/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + services.sketchybar = { + enable = true; + config = (builtins.readFile ./sketchybarrc); + extraPackages = [ pkgs.jq ]; + }; + +} diff --git a/hosts/darwin/sketchybar/sketchybarrc b/hosts/darwin/sketchybar/sketchybarrc new file mode 100755 index 00000000..775c7141 --- /dev/null +++ b/hosts/darwin/sketchybar/sketchybarrc @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors + +# General bar and defaults +# parts I didn't want +# y_offset=5 \ +# margin=5 \ + +sketchybar --bar height=35 \ + color="$BAR_COLOR" \ + shadow="$SHADOW" \ + position=top \ + sticky=on \ + padding_right=0 \ + padding_left=3 \ + corner_radius="$CORNER_RADIUS" \ + blur_radius=20 \ + notch_width=200 \ + --default updates=when_shown \ + icon.font="$FONT:Bold:13.5" \ + icon.color="$ICON_COLOR" \ + icon.padding_left="$PADDINGS" \ + icon.padding_right="$PADDINGS" \ + label.font="$FONT:Bold:13.0" \ + label.color="$LABEL_COLOR" \ + label.padding_left="$PADDINGS" \ + label.padding_right="$PADDINGS" \ + background.padding_right="$PADDINGS" \ + background.padding_left="$PADDINGS" \ + popup.background.border_width=1 \ + popup.background.corner_radius=11 \ + popup.background.border_color="$POPUP_BORDER_COLOR" \ + popup.background.color="$POPUP_BACKGROUND_COLOR" \ + popup.background.shadow.drawing="$SHADOW" + +# Left +# source "$ITEM_DIR/apple.sh" +source "$ITEM_DIR/spaces.sh" + +# Center (of notch) +# source "$ITEM_DIR/spotify.sh" +source "$ITEM_DIR/front_app.sh" + +# Right +source "$ITEM_DIR/clock.sh" +source "$ITEM_DIR/calendar.sh" +source "$ITEM_DIR/battery.sh" +source "$ITEM_DIR/volume.sh" +source "$ITEM_DIR/cpu.sh" +source "$ITEM_DIR/vpn.sh" + +#################### Finalizing Setup #################### + +# sketchybar --hotload true + +sketchybar --update + +echo "sketchybar configuration loaded.." diff --git a/hosts/darwin/yabai/default.nix b/hosts/darwin/yabai/default.nix new file mode 100644 index 00000000..5a9769ef --- /dev/null +++ b/hosts/darwin/yabai/default.nix @@ -0,0 +1,102 @@ +{pkgs, ... }: + +{ + services.yabai = { + enable = true; + config = { + mouse_follows_focus = "off"; + focus_follows_mouse = "off"; + window_placement = "second_child"; + window_topmost = "off"; + window_opacity = "off"; + window_opacity_duration = 0.0; + window_shadow = "on"; + window_border = "off"; + window_border_placement = "inset"; + window_border_width = 4; + window_border_radius = -1.0; + active_window_border_topmost = "off"; + active_window_border_color = "0xff775759"; + normal_window_border_color = "0xff505050"; + insert_window_border_color = "0xffd75f5f"; + active_window_opacity = 1.0; + normal_window_opacity = 0.9; + split_ratio = 0.73; + auto_balance = "on"; + mouse_modifier = "fn"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + layout = "bsp"; + top_padding = 5; + bottom_padding = 5; + left_padding = 5; + right_padding = 5; + window_gap = 5; + }; + extraConfig = '' + # Do not manage windows with certain titles eg. Copying files or moving to bin + yabai -m rule --add title="(Copy|Bin|About This Mac|Info)" manage=off + # Do not manage some apps which are not resizable + yabai -m rule --add app="^(Calculator|System Preferences|[sS]tats|[Jj]et[Bb]rains [Tt]ool[Bb]ox|kftray)$" manage=off + ''; + }; + + system.activationScripts.yabai = { + enable = true; + text = '' + yabai --install-service && yabai --start-service + ''; + }; + + services.skhd = { + enable = true; + skhdConfig = '' +# Open iTerm2 +cmd - enter : kitty --single-instance -d ~ + +################## +# Window Motions # +################## +# Rotate +lalt - r : yabai -m space --rotate 90 +# Mirror verticaly +lalt - x : yabai -m space --mirror y-axis +# Mirror horizontaly +lalt - y : yabai -m space --mirror x-axis +# yes, i know i swapped x and y, but I mainly use y-axis and y is further... +# Fullscreen +cmd - f : yabai -m window --toggle zoom-fullscreen +# Swap +lalt - q : yabai -m window --swap west +lalt - s : yabai -m window --swap south +lalt - z : yabai -m window --swap north +lalt - d : yabai -m window --swap east +# Warp +shift + lalt - q : yabai -m window --warp west +shift + lalt - s : yabai -m window --warp south +shift + lalt - z : yabai -m window --warp north +shift + lalt - d : yabai -m window --warp east + +######### +# Focus # +######### +# Clockwise +# alt - tab : yabai -m window --focus "$(yabai -m query --windows --space | jq -re "[sort_by(.id, .frame) | .[] | select(.role == \"AXWindow\" and .subrole == \"AXStandardWindow\") | .id] | nth(index($(yabai -m query --windows --window | jq -re ".id")) - 1)")" +# Counter-clockwise +# shift - tab : yabai -m window --focus "$(yabai -m query --windows --space | jq -re "[sort_by(.id, .frame) | reverse | .[] | select(.role == \"AXWindow\" and .subrole == \"AXStandardWindow\") | .id] | nth(index($(yabai -m query --windows --window | jq -re ".id")) - 1)")" + +########## +# Spaces # +########## +ctrl - left : yabai -m space --focus prev +ctrl - right : yabai -m space --focus next +ctrl + shift - right : yabai -m window --space next; yabai -m space --focus next +ctrl + shift - left : yabai -m window --space prev; yabai -m space --focus prev +cmd - 1 : yabai -m window --space 1; yabai -m space --focus 1 +cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2 +cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3 +cmd - 4 : yabai -m window --space 4; yabai -m space --focus 4 +cmd - 5 : yabai -m window --space 5; yabai -m space --focus 5 + ''; + }; +} diff --git a/hosts/deck/configuration.nix b/hosts/deck/configuration.nix new file mode 100644 index 00000000..8926d078 --- /dev/null +++ b/hosts/deck/configuration.nix @@ -0,0 +1,120 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "deck"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + # time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # i18n.extraLocaleSettings = { + # LC_ADDRESS = "en_US.UTF-8"; + # LC_IDENTIFICATION = "en_US.UTF-8"; + # LC_MEASUREMENT = "en_US.UTF-8"; + # LC_MONETARY = "en_US.UTF-8"; + # LC_NAME = "en_US.UTF-8"; + # LC_NUMERIC = "en_US.UTF-8"; + # LC_PAPER = "en_US.UTF-8"; + # LC_TELEPHONE = "en_US.UTF-8"; + # LC_TIME = "en_US.UTF-8"; + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb = { + # layout = "us"; + # variant = ""; + # }; + + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.anish = { + # isNormalUser = true; + # extraGroups = [ "networkmanager" "wheel" ]; + # packages = with pkgs; [ + # # thunderbird + # ]; + # }; + + # Enable automatic login for the user. + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = "anish"; + + # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 + systemd.services."getty@tty1".enable = false; + systemd.services."autovt@tty1".enable = false; + + # Install firefox. + # programs.firefox.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; # Did you read the comment? + +} diff --git a/hosts/deck/default.nix b/hosts/deck/default.nix new file mode 100644 index 00000000..cda17705 --- /dev/null +++ b/hosts/deck/default.nix @@ -0,0 +1,51 @@ +{ self, pkgs, config, ... }: +{ + imports = [ + ./configuration.nix + ../users/anish + ../profiles/core + # ../profiles/bluetooth + # ../profiles/music + ../profiles/sync/cal + ../profiles/wifi + ../profiles/desktop + ../profiles/mimetypes + ../profiles/syncthing + ../profiles/mossnet-hosts + # ../profiles/fly-wg + # ../profiles/mount-mossnet + ]; + + # age.secrets.deck-wg.file = "${self}/secrets/deck-wg.age"; + # age.secrets.deck-wg.owner = "deck"; + # mossnet.wg = { + # enable = true; + # ips = [ "10.0.69.6/24" ]; + # privateKeyFile = "/run/agenix/deck-wg"; + # }; + + users.users.anish.extraGroups = [ "adbusers" "wheel" "plugdev" "libvertd" ]; + # boot.plymouth = { + # enable = true; + # themePackages = [ pkgs.plymouth-themes ]; + # theme = "motion"; + # }; + + jovian.steam.enable = true; + jovian.devices.steamdeck.enable = true; + jovian.steam.user = "anish"; + jovian.steam.autoStart = true; + jovian.steam.desktopSession = "gnome"; + # jovian.steam.desktopSession = "none+bspwm"; + + # Install XR drivers + # environment.systemPackages = with pkgs; [ + # xrlinuxdriver + # breezy-gnome + # ]; + + # services.udev.packages = with pkgs; [ + # xrlinuxdriver + # ]; + +} diff --git a/hosts/deck/hardware-configuration.nix b/hosts/deck/hardware-configuration.nix new file mode 100644 index 00000000..8313aefe --- /dev/null +++ b/hosts/deck/hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d432dae0-3512-4891-9582-56d7ecd8524c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/5B4C-7406"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f75a730e-c849-4edd-a17f-52492d4260dc"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/darwin/README.md b/modules/darwin/README.md new file mode 100644 index 00000000..ccff20ff --- /dev/null +++ b/modules/darwin/README.md @@ -0,0 +1,12 @@ + +## Layout +``` +. +├── dock # MacOS dock configuration +├── casks.nix # List of homebrew casks +├── default.nix # Defines module, system-level config +├── files.nix # Non-Nix, static configuration files (now immutable!) +├── home-manager.nix # Defines user programs +├── packages.nix # List of packages to install for MacOS +├── secrets.nix # Age-encrypted secrets with agenix +``` diff --git a/modules/darwin/dock/default.nix b/modules/darwin/dock/default.nix new file mode 100644 index 00000000..19af49f9 --- /dev/null +++ b/modules/darwin/dock/default.nix @@ -0,0 +1,67 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.local.dock; + inherit (pkgs) stdenv dockutil; +in +{ + options = { + local.dock.enable = mkOption { + description = "Enable dock"; + default = stdenv.isDarwin; + example = false; + }; + + local.dock.entries = mkOption + { + description = "Entries on the Dock"; + type = with types; listOf (submodule { + options = { + path = lib.mkOption { type = str; }; + section = lib.mkOption { + type = str; + default = "apps"; + }; + options = lib.mkOption { + type = str; + default = ""; + }; + }; + }); + readOnly = true; + }; + }; + + config = + mkIf cfg.enable + ( + let + normalize = path: if hasSuffix ".app" path then path + "/" else path; + entryURI = path: "file://" + (builtins.replaceStrings + [" " "!" "\"" "#" "$" "%" "&" "'" "(" ")"] + ["%20" "%21" "%22" "%23" "%24" "%25" "%26" "%27" "%28" "%29"] + (normalize path) + ); + wantURIs = concatMapStrings + (entry: "${entryURI entry.path}\n") + cfg.entries; + createEntries = concatMapStrings + (entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n") + cfg.entries; + in + { + system.activationScripts.postUserActivation.text = '' + echo >&2 "Setting up the Dock..." + haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" + if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then + echo >&2 "Resetting Dock." + ${dockutil}/bin/dockutil --no-restart --remove all + ${createEntries} + killall Dock + else + echo >&2 "Dock setup complete." + fi + ''; + } + ); +} diff --git a/modules/darwin/files.nix b/modules/darwin/files.nix new file mode 100644 index 00000000..530f1098 --- /dev/null +++ b/modules/darwin/files.nix @@ -0,0 +1,54 @@ +{ user, config, pkgs, ... }: + +let + xdg_configHome = "${config.users.users.${user}.home}/.config"; + xdg_dataHome = "${config.users.users.${user}.home}/.local/share"; + xdg_stateHome = "${config.users.users.${user}.home}/.local/state"; in +{ + + # Raycast script so that "Run Emacs" is available and uses Emacs daemon + "${xdg_dataHome}/bin/emacsclient" = { + executable = true; + text = '' + #!/bin/zsh + # + # Required parameters: + # @raycast.schemaVersion 1 + # @raycast.title Run Emacs + # @raycast.mode silent + # + # Optional parameters: + # @raycast.packageName Emacs + # @raycast.icon ${xdg_dataHome}/img/icons/Emacs.icns + # @raycast.iconDark ${xdg_dataHome}/img/icons/Emacs.icns + + if [[ $1 = "-t" ]]; then + # Terminal mode + ${pkgs.emacs}/bin/emacsclient -t $@ + else + # GUI mode + ${pkgs.emacs}/bin/emacsclient -c -n $@ + fi + ''; + }; + + # Script to import Drafts into Emacs org-roam + "${xdg_dataHome}/bin/import-drafts" = { + executable = true; + text = '' + #!/bin/sh + + for f in ${xdg_stateHome}/drafts/* + do + if [[ ! "$f" =~ "done" ]]; then + echo "Importing $f" + filename="$(head -c 10 $f)" + output="${xdg_dataHome}/org-roam/daily/$filename.org" + echo '\n' >> "$output" + tail -n +3 $f >> "$output" + mv $f done + fi + done + ''; + }; +} diff --git a/modules/darwin/home-manager.nix b/modules/darwin/home-manager.nix new file mode 100644 index 00000000..9f856079 --- /dev/null +++ b/modules/darwin/home-manager.nix @@ -0,0 +1,85 @@ +{ config, pkgs, lib, home-manager, ... }: + +let + user = "anishlakhwara"; + # Define the content of your file as a derivation + myEmacsLauncher = pkgs.writeScript "emacs-launcher.command" '' + #!/bin/sh + emacsclient -c -n & + ''; + sharedFiles = import ../shared/files.nix { inherit config pkgs; }; + additionalFiles = import ./files.nix { inherit user config pkgs; }; +in +{ + imports = [ + ./dock + ]; + + # It me + users.users.${user} = { + name = "${user}"; + home = "/Users/${user}"; + isHidden = false; + shell = pkgs.zsh; + }; + + # Enable home-manager + home-manager = { + useGlobalPkgs = true; + users.${user} = { pkgs, config, lib, ... }:{ + home = { + enableNixpkgsReleaseCheck = false; + packages = pkgs.callPackage ./packages.nix {}; + file = lib.mkMerge [ + sharedFiles + additionalFiles + { "emacs-launcher.command".source = myEmacsLauncher; } + ]; + + stateVersion = "23.11"; + }; + + programs = {} // import ../shared/home-manager.nix { inherit config pkgs lib; }; + + # Marked broken Oct 20, 2022 check later to remove this + # https://github.com/nix-community/home-manager/issues/3344 + manual.manpages.enable = false; + }; + }; + + # Fully declarative dock using the latest from Nix Store + local = { + dock.enable = true; + dock.entries = [ + { path = "/Applications/Slack.app/"; } + { path = "/System/Applications/Messages.app/"; } + { path = "/System/Applications/Facetime.app/"; } + { path = "/Applications/Telegram.app/"; } + { path = "${pkgs.alacritty}/Applications/Alacritty.app/"; } + { path = "/System/Applications/Music.app/"; } + { path = "/System/Applications/News.app/"; } + { path = "/System/Applications/Photos.app/"; } + { path = "/System/Applications/Photo Booth.app/"; } + { path = "/System/Applications/TV.app/"; } + { path = "${pkgs.jetbrains.phpstorm}/Applications/PhpStorm.app/"; } + { path = "/Applications/TablePlus.app/"; } + { path = "/Applications/Asana.app/"; } + { path = "/Applications/Drafts.app/"; } + { path = "/System/Applications/Home.app/"; } + { + path = toString myEmacsLauncher; + section = "others"; + } + { + path = "${config.users.users.${user}.home}/.local/share/"; + section = "others"; + options = "--sort name --view grid --display folder"; + } + { + path = "${config.users.users.${user}.home}/.local/share/downloads"; + section = "others"; + options = "--sort name --view grid --display stack"; + } + ]; + }; +} diff --git a/modules/darwin/packages.nix b/modules/darwin/packages.nix new file mode 100644 index 00000000..7eaa1d81 --- /dev/null +++ b/modules/darwin/packages.nix @@ -0,0 +1,7 @@ +{ pkgs }: + +with pkgs; +let shared-packages = import ../shared/packages.nix { inherit pkgs; }; in +shared-packages ++ [ + dockutil +] diff --git a/modules/darwin/secrets.nix b/modules/darwin/secrets.nix new file mode 100644 index 00000000..bed9479e --- /dev/null +++ b/modules/darwin/secrets.nix @@ -0,0 +1,47 @@ +{ config, pkgs, agenix, secrets, ... }: + +let user = "dustin"; in +{ + age = { + identityPaths = [ + "/Users/${user}/.ssh/id_ed25519" + ]; + + secrets = { + "syncthing-cert" = { + symlink = true; + path = "/Users/${user}/Library/Application Support/Syncthing/cert.pem"; + file = "${secrets}/darwin-syncthing-cert.age"; + mode = "644"; + owner = "${user}"; + group = "staff"; + }; + + "syncthing-key" = { + symlink = true; + path = "/Users/${user}/Library/Application Support/Syncthing/key.pem"; + file = "${secrets}/darwin-syncthing-key.age"; + mode = "600"; + owner = "${user}"; + group = "staff"; + }; + + "github-ssh-key" = { + symlink = true; + path = "/Users/${user}/.ssh/id_github"; + file = "${secrets}/github-ssh-key.age"; + mode = "600"; + owner = "${user}"; + group = "staff"; + }; + + "github-signing-key" = { + symlink = false; + path = "/Users/${user}/.ssh/pgp_github.key"; + file = "${secrets}/github-signing-key.age"; + mode = "600"; + owner = "${user}"; + }; + }; + }; +} diff --git a/pkgs/breezy-gnome.nix b/pkgs/breezy-gnome.nix new file mode 100644 index 00000000..1c90e80f --- /dev/null +++ b/pkgs/breezy-gnome.nix @@ -0,0 +1,54 @@ +# Imported from https://github.com/wheaney/breezy-desktop/pull/113/files +# Use flake or nixpkgs once upstreamed +{ + self, + lib, + stdenv, + glib, + ... +}: stdenv.mkDerivation { + pname = "breezy-gnome"; + version = "unstable"; + + src = lib.cleanSource "${self}/gnome/src/."; + + buildInputs = [ + glib + ]; + + passthru = { + extensionUuid = "breezydesktop@xronlinux.com"; + }; + + buildPhase = '' + mkdir -p build/schemas + glib-compile-schemas --targetdir="build/schemas" $src/schemas/ + cp $src/*.js build/ + cp $src/*.frag build/ + mkdir -p build/schemas/ + cp $src/schemas/*.xml build/schemas/ + mkdir -p build/dbus-interfaces/ + cp $src/dbus-interfaces/*.xml build/dbus-interfaces/ + mkdir -p build/textures/ + cp -rL $src/textures/* build/textures/ + cp $src/metadata.json build/ + ''; + + installPhase = '' + extra_source=() + for file in "$DEST_DIR"/*; do + extra_source+=("--extra-source=$file") + done + gnome-extensions pack --force "$${extra_source[@]}" "build" -o "$out" + ''; + + doInstallCheck = false; + # The default release is a script which will do an impure download + # just ensure that the application can run without network + + meta = with lib; { + homepage = "https://github.com/wheaney/breezy-desktop"; + maintainers = with maintainers; [shymega]; + platforms = platforms.linux; + }; + } diff --git a/pkgs/xr-linux-driver.nix b/pkgs/xr-linux-driver.nix new file mode 100644 index 00000000..dfccc097 --- /dev/null +++ b/pkgs/xr-linux-driver.nix @@ -0,0 +1,114 @@ +# Imported from https://github.com/wheaney/XRLinuxDriver/pull/80/files +# Use flake or nixpkgs once upstreamed +{ + self, + lib, + pkgs, + stdenv, + fetchFromGitLab, + libusb1, + curl, + openssl, + libevdev, + json_c, + hidapi, + wayland, + cmake, + pkg-config, + python3, + libffi, + autoPatchelfHook, + ... +}: let + pythonEnv = python3.withPackages (ps: [ps.pyyaml]); + buildInputs = [ + curl + hidapi + json_c + libevdev + libffi + libusb1 + openssl + stdenv.cc.cc.lib + wayland + ]; + arch = + if pkgs.system == "aarch64-linux" + then "aarch64" + else if pkgs.system == "x86_64-linux" + then "x86_64" + else throw "Unsupported system ${pkgs.system}"; +in + stdenv.mkDerivation rec { + pname = "xrlinuxdriver"; + version = "0.12.0.1"; + + srcs = [ + (fetchFromGitLab rec { + domain = "gitlab.com"; + owner = "TheJackiMonster"; + repo = "nrealAirLinuxDriver"; + rev = "3225fcc575e19a8407d5019903567cff1c3ed1a8"; + hash = "sha256-NRbcANt/CqREQZoYIYtTGVbvkZ7uo2Tm90s6prlsrQE="; + fetchSubmodules = true; + name = "${repo}-src"; + }) + (lib.cleanSourceWith { + src = self; + name = "${pname}-src"; + }) + ]; + sourceRoot = "${(builtins.elemAt srcs 1).name}"; + + postUnpack = let + nrealAirLinuxDriver = (builtins.elemAt srcs 0).name; + in '' + mkdir -p $sourceRoot/modules/xrealInterfaceLibrary + cp -R ${nrealAirLinuxDriver}/* $sourceRoot/modules/xrealInterfaceLibrary + chmod -R u+w $sourceRoot + ''; + + nativeBuildInputs = [ + cmake + pkg-config + pythonEnv + autoPatchelfHook + ]; + inherit buildInputs; + + cmakeFlags = [ + "-DCMAKE_SKIP_RPATH=ON" + ]; + cmakeBuildDir = "build"; + cmakeBuildType = "RelWithDebInfo"; + + installPhase = '' + mkdir -p $out/bin $out/lib/systemd/user $out/lib/udev/rules.d $out/lib/${arch} + cp xrDriver ../bin/xr_driver_cli ../bin/xr_driver_verify $out/bin + cp ../udev/* $out/lib/udev/rules.d/ + cp ../lib/${arch}/* $out/lib/${arch}/ + cp ../systemd/xr-driver.service $out/lib/systemd/user/xr-driver.service + cp ${hidapi}/lib/libhidapi-hidraw.so.0 $out/lib/ + substituteInPlace \ + $out/lib/systemd/user/xr-driver.service \ + --replace-fail "ExecStart={bin_dir}/xrDriver" "ExecStart=$out/bin/xrDriver" \ + --replace-fail "{ld_library_path}" "$out/lib/${arch}" + ''; + + preBuild = '' + addAutoPatchelfSearchPath $out/usr/lib/${arch} + ''; + + doInstallCheck = false; + # The default release is a script which will do an impure download + # just ensure that the application can run without network + + meta = with lib; { + homepage = "https://github.com/wheaney/XRLinuxDriver"; + license = licenses.mit; + description = "Linux service for interacting with XR devices."; + mainProgram = "xrDriver"; + maintainers = with maintainers; [shymega]; + platforms = platforms.linux; + }; + }