From 7860f1a50e838466692b1d0b882843c9c1f11c15 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 11:53:01 +0900 Subject: [PATCH] Make most packages refers darwin special channel if run on macOS Fixes GH-910 --- flake.lock | 17 +++++++++++++++++ flake.nix | 10 ++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 33173ee9..57cba612 100644 --- a/flake.lock +++ b/flake.lock @@ -388,6 +388,22 @@ "type": "github" } }, + "nixpkgs-darwin": { + "locked": { + "lastModified": 1730891215, + "narHash": "sha256-i85DPrhDuvzgvIWCpJlbfM2UFtNYbapo20MtQXsvay4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c128e44a249d6180740d0a979b6480d5b795c013", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-lib": { "locked": { "lastModified": 1725233747, @@ -470,6 +486,7 @@ "home-manager": "home-manager", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs", + "nixpkgs-darwin": "nixpkgs-darwin", "selfup": "selfup", "xremap-flake": "xremap-flake" } diff --git a/flake.nix b/flake.nix index 35acef1c..7b35b6a1 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,9 @@ # - https://discourse.nixos.org/t/differences-between-nix-channels/13998 # How to update the revision # - `nix flake update --commit-lock-file` # https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-update.html - # TODO: Use nixpkgs-24.05-darwin only in macOS. See GH-910 nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; - edge-nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + edge-nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Unfit for darwin, might be broken. See https://github.com/NixOS/nixpkgs/issues/107466 + nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; # https://github.com/nix-community/home-manager/blob/release-24.05/docs/manual/nix-flakes.md home-manager = { url = "github:nix-community/home-manager/release-24.05"; @@ -36,6 +36,7 @@ self, nixpkgs, edge-nixpkgs, + nixpkgs-darwin, home-manager, ... }@inputs: @@ -51,6 +52,7 @@ homemade-packages = forAllSystems ( system: + # FIXME: Use nixpkgs-darwin for darwin (nixpkgs.legacyPackages.${system}.callPackage ./pkgs { edge-pkgs = edge-nixpkgs.legacyPackages.${system}; }) @@ -210,7 +212,7 @@ }; x86-macOS = { - pkgs = nixpkgs.legacyPackages.x86_64-darwin; + pkgs = nixpkgs-darwin.legacyPackages.x86_64-darwin; extraSpecialArgs = { homemade-pkgs = homemade-packages.x86_64-darwin; edge-pkgs = edge-nixpkgs.legacyPackages.x86_64-darwin; @@ -218,7 +220,7 @@ }; aarch64-macOS = { - pkgs = nixpkgs.legacyPackages.aarch64-darwin; + pkgs = nixpkgs-darwin.legacyPackages.aarch64-darwin; extraSpecialArgs = { homemade-pkgs = homemade-packages.aarch64-darwin; edge-pkgs = edge-nixpkgs.legacyPackages.aarch64-darwin;