From b4f1b3a6476a8b3d220109e51b373eb091d8a5a7 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Thu, 31 Oct 2024 08:21:26 +0700 Subject: [PATCH] feat(nix/darwin): Moving stuff away from homebrew --- .config/nix/flake.lock | 81 +++++++++++++++++++- .config/nix/flake.nix | 19 +++-- .config/nix/systems/darwin/configuration.nix | 1 + .config/nix/systems/darwin/default.nix | 14 +++- 4 files changed, 107 insertions(+), 8 deletions(-) diff --git a/.config/nix/flake.lock b/.config/nix/flake.lock index ae20388..dc4712e 100644 --- a/.config/nix/flake.lock +++ b/.config/nix/flake.lock @@ -1,5 +1,49 @@ { "nodes": { + "brew-api": { + "flake": false, + "locked": { + "lastModified": 1730330788, + "narHash": "sha256-4cBYfZwWbhNB1uxzOMtlG71aanRzckRBum8jCzqLPhA=", + "owner": "BatteredBunny", + "repo": "brew-api", + "rev": "549a465b34da92f8eb2dfbbb9047d73751ce4107", + "type": "github" + }, + "original": { + "owner": "BatteredBunny", + "repo": "brew-api", + "type": "github" + } + }, + "brew-nix": { + "inputs": { + "brew-api": [ + "brew-api" + ], + "flake-utils": "flake-utils", + "nix-darwin": [ + "nix-darwin" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724407874, + "narHash": "sha256-3nw5O0wLkeTeBXJTyY2pZ57JaRtouLva1a6nVx2syLU=", + "owner": "BatteredBunny", + "repo": "brew-nix", + "rev": "d3d3a2666e5330e83b6a64b1eb3e1e9380f6da9b", + "type": "github" + }, + "original": { + "owner": "BatteredBunny", + "repo": "brew-nix", + "rev": "d3d3a2666e5330e83b6a64b1eb3e1e9380f6da9b", + "type": "github" + } + }, "crane": { "locked": { "lastModified": 1727974419, @@ -76,6 +120,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1726560853, "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", @@ -233,6 +295,8 @@ }, "root": { "inputs": { + "brew-api": "brew-api", + "brew-nix": "brew-nix", "firefox-darwin": "firefox-darwin", "home-manager": "home-manager", "nix-darwin": "nix-darwin", @@ -265,7 +329,7 @@ "inputs": { "crane": "crane", "devshell": "devshell", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nix-vm-test": "nix-vm-test", "nixpkgs": [ "nixpkgs" @@ -304,6 +368,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/.config/nix/flake.nix b/.config/nix/flake.nix index ea12265..851cea3 100644 --- a/.config/nix/flake.nix +++ b/.config/nix/flake.nix @@ -40,6 +40,20 @@ url = "github:LnL7/nix-darwin/a60ac02f9466f85f092e576fd8364dfc4406b5a6"; inputs.nixpkgs.follows = "nixpkgs"; }; + firefox-darwin = { + url = "github:bandithedoge/nixpkgs-firefox-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + brew-nix = { + url = "github:BatteredBunny/brew-nix/d3d3a2666e5330e83b6a64b1eb3e1e9380f6da9b"; + inputs.nix-darwin.follows = "nix-darwin"; + inputs.brew-api.follows = "brew-api"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + brew-api = { + url = "github:BatteredBunny/brew-api"; + flake = false; + }; home-manager = { url = "github:nix-community/home-manager/64c6325b28ebd708653dd41d88f306023f296184"; @@ -50,10 +64,5 @@ url = "github:numtide/system-manager/c93e62f2e962b54fd961798731d25eaa5778dbe2"; inputs.nixpkgs.follows = "nixpkgs"; }; - - firefox-darwin = { - url = "github:bandithedoge/nixpkgs-firefox-darwin"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; } diff --git a/.config/nix/systems/darwin/configuration.nix b/.config/nix/systems/darwin/configuration.nix index 1419b88..479bc5a 100644 --- a/.config/nix/systems/darwin/configuration.nix +++ b/.config/nix/systems/darwin/configuration.nix @@ -34,6 +34,7 @@ pkgs.pinentry_mac pkgs.iina pkgs.floorp-bin + pkgs.brewCasks.zotero ]; # Auto upgrade nix package and the daemon service. diff --git a/.config/nix/systems/darwin/default.nix b/.config/nix/systems/darwin/default.nix index 48e71c5..fffbf9a 100644 --- a/.config/nix/systems/darwin/default.nix +++ b/.config/nix/systems/darwin/default.nix @@ -13,7 +13,12 @@ in # Lenovo ThinkPad L460; Intel Core i5-6300U "ThiccBook-Pro" = let - inherit (mkSystem "x86_64-darwin" nixpkgs [inputs.firefox-darwin.overlay]) system pkgs; + inherit ( + mkSystem "x86_64-darwin" nixpkgs [ + inputs.firefox-darwin.overlay + inputs.brew-nix.overlays.default + ] + ) system pkgs; common = (mkCommon pkgs); in nix-darwin.lib.darwinSystem { @@ -27,7 +32,12 @@ in # Imaginary M1, just for reference MacBookProM1 = let - inherit (mkSystem "aarch64-darwin" nixpkgs [inputs.firefox-darwin.overlay]) system pkgs; + inherit ( + mkSystem "aarch64-darwin" nixpkgs [ + inputs.firefox-darwin.overlay + inputs.brew-nix.overlays.default + ] + ) system pkgs; common = (mkCommon pkgs); in nix-darwin.lib.darwinSystem {