Merge integration branch with darwin support

Amp-Thread-ID: https://ampcode.com/threads/T-0748e36c-aff2-4360-bbfe-f185d2e11209
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Anish Lakhwara 2025-09-28 21:14:56 -07:00
commit 42439b6c0d
41 changed files with 1803 additions and 51 deletions

View file

@ -10,11 +10,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1723293904, "lastModified": 1754433428,
"narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", "narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", "rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -75,6 +75,23 @@
"url": "ssh://gitea@git.sealight.xyz/aynish/basant" "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": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -83,11 +100,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1700795494, "lastModified": 1744478979,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "rev": "43975d782b418ebf4969e9ccba82466728c2851b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -97,6 +114,27 @@
"type": "github" "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": { "deploy-rs": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
@ -106,11 +144,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1718194053, "lastModified": 1756719547,
"narHash": "sha256-FaGrf7qwZ99ehPJCAwgvNY5sLCqQ3GDiE/6uLhxxwSY=", "narHash": "sha256-N9gBKUmjwRKPxAafXEk1EGadfk2qDZPBQp4vXWPHINQ=",
"owner": "serokell", "owner": "serokell",
"repo": "deploy-rs", "repo": "deploy-rs",
"rev": "3867348fa92bc892eba5d9ddb2d7a97b9e127a8a", "rev": "125ae9e3ecf62fb2c0fd4f2d894eb971f1ecaed2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -178,11 +216,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1724031427, "lastModified": 1758287904,
"narHash": "sha256-o1HdAf+7IGv9M13R3c+zc/sJ0QgeEnhsvHBcodI4UpM=", "narHash": "sha256-IGmaEf3Do8o5Cwp1kXBN1wQmZwQN3NLfq5t4nHtVtcU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "4e719b38fa7c85f4f65d0308ca7084c91e7bdd6d", "rev": "67ff9807dd148e704baadbd4fd783b54282ca627",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -232,11 +270,11 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1733328505,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -277,6 +315,27 @@
"type": "indirect" "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": { "flake-root": {
"locked": { "locked": {
"lastModified": 1692742795, "lastModified": 1692742795,
@ -405,11 +464,11 @@
}, },
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1723310128, "lastModified": 1758663926,
"narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", "narHash": "sha256-6CFdj7Xs616t1W4jLDH7IohAAvl5Dyib3qEv/Uqw1rk=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", "rev": "170ff93c860b2a9868ed1e1102d4e52cb3d934e1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -426,11 +485,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703113217, "lastModified": 1745494811,
"narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -446,11 +505,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751810233, "lastModified": 1758463745,
"narHash": "sha256-kllkNbIqQi3VplgTMeGzuh1t8Gk8TauvkTRt93Km+tQ=", "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "9b0873b46c9f9e4b7aa01eb634952c206af53068", "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -460,6 +519,75 @@
"type": "github" "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": { "lowdown-src": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -516,6 +644,46 @@
"type": "github" "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": { "nix-matrix-appservices": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
@ -576,11 +744,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1723310128, "lastModified": 1758663926,
"narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", "narHash": "sha256-6CFdj7Xs616t1W4jLDH7IohAAvl5Dyib3qEv/Uqw1rk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", "rev": "170ff93c860b2a9868ed1e1102d4e52cb3d934e1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -690,11 +858,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1755274400, "lastModified": 1758791193,
"narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", "narHash": "sha256-F8WmEwFoHsnix7rt290R0rFXNJiMbClMZyIC/e+HYf0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ad7196ae55c295f53a7d1ec39e4a06d922f3b899", "rev": "25e53aa156d47bad5082ff7618f5feb1f5e02d01",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -704,13 +872,33 @@
"type": "github" "type": "github"
} }
}, },
"nur": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1724040334, "lastModified": 1758690382,
"narHash": "sha256-Ia4gRRmhFn4oJ4SJKJPDNPomsRRFWU+bqCK7yuiLW4E=", "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", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "24471a48600e18669d13d24c9640b9859357d2cf", "rev": "fccc09dffa659dc1410eceb33285831ba12bc7f6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -726,11 +914,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1756350023, "lastModified": 1759014010,
"narHash": "sha256-4S6EUvEFvOnwjSo/LqAVVuX2/JjAJ8gQFmQQ0DS4oXU=", "narHash": "sha256-NMpUufnxiGDTs/4Nxj8t+n4wc4aSs02a4T5OORo0gBQ=",
"ref": "main", "ref": "main",
"rev": "a807111f9b20c501183516baf8082c4359aaaaa1", "rev": "08c1dddf38c39d6f7c73a24f4d396f4c925185bf",
"revCount": 1594, "revCount": 1602,
"type": "git", "type": "git",
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
}, },
@ -775,11 +963,17 @@
"agenix": "agenix", "agenix": "agenix",
"autohide-tdrop": "autohide-tdrop", "autohide-tdrop": "autohide-tdrop",
"basant": "basant", "basant": "basant",
"darwin": "darwin_2",
"deploy-rs": "deploy-rs", "deploy-rs": "deploy-rs",
"disko": "disko", "disko": "disko",
"grasp": "grasp", "grasp": "grasp",
"hardware": "hardware", "hardware": "hardware",
"home-manager": "home-manager_2", "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", "nix-matrix-appservices": "nix-matrix-appservices",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_4",
@ -815,11 +1009,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1724034091, "lastModified": 1759113356,
"narHash": "sha256-b1g7w0sw+MDAhUAeCoX1vlTghsqcDZkxr+k9OZmxPa8=", "narHash": "sha256-xm4kEUcV2jk6u15aHazFP4YsMwhq+PczA+Ul/4FDKWI=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "c7d36e0947826e0751a5214ffe82533fbc909bc0", "rev": "be3b8843a2be2411500f6c052876119485e957a2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -933,11 +1127,11 @@
"vowel-src": "vowel-src" "vowel-src": "vowel-src"
}, },
"locked": { "locked": {
"lastModified": 1723223284, "lastModified": 1730626669,
"narHash": "sha256-NAT+g5nsaJZkpR0sCZjerd1xx233ZUdRH3ZWwZhzq/c=", "narHash": "sha256-nFyZrvTPn9OM9UZmuAwy3e1Ba0ZuYc2FaDCOOhGtqg4=",
"owner": "mitchmindtree", "owner": "mitchmindtree",
"repo": "tidalcycles.nix", "repo": "tidalcycles.nix",
"rev": "82f3e8e8d02eb9f0c9dfe9ab3773b825c6bc1982", "rev": "0db0918e7a3d3c30ed7a6e81dc9d4e3832870ac4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -966,11 +1160,11 @@
}, },
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1752687322, "lastModified": 1758690382,
"narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=", "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251", "rev": "e643668fd71b949c53f8626614b21ff71a07379d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -985,11 +1179,11 @@
"systems": "systems_4" "systems": "systems_4"
}, },
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1731533236,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {

131
flake.nix
View file

@ -38,6 +38,33 @@
# Matrix # Matrix
nix-matrix-appservices.url = "gitlab:coffeetables/nix-matrix-appservices"; 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 # Others
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
rust-overlay = { rust-overlay = {
@ -61,7 +88,8 @@
outputs = { self, nixpkgs, unstable, nixos-hardware, home-manager, deploy-rs outputs = { self, nixpkgs, unstable, nixos-hardware, home-manager, deploy-rs
, agenix, disko, basant, grasp, nix-matrix-appservices, nur, tidalcycles , 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 let
forAllSystems = nixpkgs.lib.genAttrs [ forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux" "aarch64-linux"
@ -124,6 +152,65 @@
tidalcycles.overlays.default # needed for nvim which comes pre-installed lol 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 { in {
# Your custom packages # Your custom packages
# Acessible through 'nix build', 'nix shell', etc # 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 # Standalone home-manager configuration entrypoint

28
home/darwin/default.nix Normal file
View file

@ -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;
};
};
}

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
sketchybar -m --add item vpn right \
--set vpn icon=\
update_freq=5 \
script="~/.config/sketchybar/plugins/vpn.sh"

View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
sketchybar --set "$NAME" icon="󰸗 " label="$(date '+%a %d. %b')"

View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
LABEL=$(date '+%H:%M')
sketchybar --set "$NAME" icon=" " label="$LABEL"

View file

@ -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}')"

View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
case "$SENDER" in
"front_app_switched")
sketchybar --set "$NAME" label="$INFO"
;;
esac

View file

@ -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}% "

View file

@ -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%"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"
];
}

154
hosts/darwin/default.nix Normal file
View file

@ -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;
# };
};
}

View file

@ -0,0 +1,10 @@
{ pkgs, ... }:
{
services.sketchybar = {
enable = true;
config = (builtins.readFile ./sketchybarrc);
extraPackages = [ pkgs.jq ];
};
}

View file

@ -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.."

View file

@ -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
'';
};
}

View file

@ -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. Its 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?
}

51
hosts/deck/default.nix Normal file
View file

@ -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
# ];
}

View file

@ -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.<interface>.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;
}

12
modules/darwin/README.md Normal file
View file

@ -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
```

View file

@ -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
'';
}
);
}

54
modules/darwin/files.nix Normal file
View file

@ -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
'';
};
}

View file

@ -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";
}
];
};
}

View file

@ -0,0 +1,7 @@
{ pkgs }:
with pkgs;
let shared-packages = import ../shared/packages.nix { inherit pkgs; }; in
shared-packages ++ [
dockutil
]

View file

@ -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}";
};
};
};
}

54
pkgs/breezy-gnome.nix Normal file
View file

@ -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;
};
}

114
pkgs/xr-linux-driver.nix Normal file
View file

@ -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;
};
}