From 7860f1a50e838466692b1d0b882843c9c1f11c15 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 11:53:01 +0900 Subject: [PATCH 01/12] 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; From 0dfefba5c0d0cb45edfb152aeb1e1532793921d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:34:53 +0000 Subject: [PATCH 02/12] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/4aa36568d413aca0ea84a1684d2d46f55dbabad7?narHash=sha256-Zwl8YgTVJTEum%2BL%2B0zVAWvXAGbWAuXHax3KzuejaDyo%3D' (2024-11-05) → 'github:NixOS/nixpkgs/76612b17c0ce71689921ca12d9ffdc9c23ce40b2?narHash=sha256-IigrKK3vYRpUu%2BHEjPL/phrfh7Ox881er1UEsZvw9Q4%3D' (2024-11-09) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/dba414932936fde69f0606b4f1d87c5bc0003ede?narHash=sha256-mwrFF0vElHJP8X3pFCByJR365Q2463ATp2qGIrDUdlE%3D' (2024-11-06) → 'github:NixOS/nixpkgs/83fb6c028368e465cd19bb127b86f971a5e41ebc?narHash=sha256-rz30HrFYCHiWEBCKHMffHbMdWJ35hEkcRVU0h7ms3x0%3D' (2024-11-07) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 57cba612..a30a6d80 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1730785428, - "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", "type": "github" }, "original": { @@ -374,11 +374,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730883749, - "narHash": "sha256-mwrFF0vElHJP8X3pFCByJR365Q2463ATp2qGIrDUdlE=", + "lastModified": 1730963269, + "narHash": "sha256-rz30HrFYCHiWEBCKHMffHbMdWJ35hEkcRVU0h7ms3x0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dba414932936fde69f0606b4f1d87c5bc0003ede", + "rev": "83fb6c028368e465cd19bb127b86f971a5e41ebc", "type": "github" }, "original": { From 63acb1d044f980cb3ac8c114d92a1ed5504ebd01 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 12:09:31 +0900 Subject: [PATCH 03/12] Fix to branch nix channel in homemade packages --- flake.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 7b35b6a1..68b37e51 100644 --- a/flake.nix +++ b/flake.nix @@ -52,10 +52,12 @@ homemade-packages = forAllSystems ( system: - # FIXME: Use nixpkgs-darwin for darwin - (nixpkgs.legacyPackages.${system}.callPackage ./pkgs { - edge-pkgs = edge-nixpkgs.legacyPackages.${system}; - }) + ( + (if (nixpkgs.lib.strings.hasSuffix "-darwin" system) then nixpkgs-darwin else nixpkgs) + .legacyPackages.${system}.callPackage + ./pkgs + { edge-pkgs = edge-nixpkgs.legacyPackages.${system}; } + ) ); in { From f14cdff113b31586f92611d482a6e53024105c1c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 12:31:42 +0900 Subject: [PATCH 04/12] Enable magic-nix-cache-action in home-manager CI only on darwin --- .github/workflows/ci-home.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 00a83689..334286b9 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -54,7 +54,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: DeterminateSystems/nix-installer-action@v14 - # Don't use DeterminateSystems/magic-nix-cache-action in this workflow until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported + # Don't use DeterminateSystems/magic-nix-cache-action for Linux until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported + - uses: DeterminateSystems/magic-nix-cache-action@v8 + # Always slow. Especially since GH-924 + if: runner.os == 'macOS' - name: Print some dotfiles overviews run: | Date: Mon, 11 Nov 2024 12:44:27 +0900 Subject: [PATCH 05/12] Revert "Enable magic-nix-cache-action in home-manager CI only on darwin" This reverts commit f14cdff113b31586f92611d482a6e53024105c1c. --- .github/workflows/ci-home.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 334286b9..00a83689 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -54,10 +54,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: DeterminateSystems/nix-installer-action@v14 - # Don't use DeterminateSystems/magic-nix-cache-action for Linux until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported - - uses: DeterminateSystems/magic-nix-cache-action@v8 - # Always slow. Especially since GH-924 - if: runner.os == 'macOS' + # Don't use DeterminateSystems/magic-nix-cache-action in this workflow until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported - name: Print some dotfiles overviews run: | Date: Mon, 11 Nov 2024 12:48:32 +0900 Subject: [PATCH 06/12] Sync same channel in home-manager --- .github/workflows/ci-nix.yml | 1 + flake.lock | 38 ++++++++++++++++++++++++++++-------- flake.nix | 30 ++++++++++++++++------------ 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 3d40f413..6c63cc50 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -28,6 +28,7 @@ jobs: os: - ubuntu-24.04 - macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. + - macos-13 runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: diff --git a/flake.lock b/flake.lock index a30a6d80..e727ed41 100644 --- a/flake.lock +++ b/flake.lock @@ -139,9 +139,27 @@ } }, "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1726440980, + "narHash": "sha256-ChhIrjtdu5d83W+YDRH+Ec5g1MmM0xk6hJnkz15Ot7M=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a9c9cc6e50f7cbd2d58ccb1cd46a1e06e9e445ff", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager-darwin": { "inputs": { "nixpkgs": [ - "nixpkgs" + "nixpkgs-darwin" ] }, "locked": { @@ -159,20 +177,23 @@ "type": "github" } }, - "home-manager_2": { + "home-manager-linux": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1726440980, - "narHash": "sha256-ChhIrjtdu5d83W+YDRH+Ec5g1MmM0xk6hJnkz15Ot7M=", + "lastModified": 1726989464, + "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", "owner": "nix-community", "repo": "home-manager", - "rev": "a9c9cc6e50f7cbd2d58ccb1cd46a1e06e9e445ff", + "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-24.05", "repo": "home-manager", "type": "github" } @@ -483,7 +504,8 @@ "root": { "inputs": { "edge-nixpkgs": "edge-nixpkgs", - "home-manager": "home-manager", + "home-manager-darwin": "home-manager-darwin", + "home-manager-linux": "home-manager-linux", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs", "nixpkgs-darwin": "nixpkgs-darwin", @@ -615,7 +637,7 @@ "crane": "crane", "devshell": "devshell", "flake-parts": "flake-parts", - "home-manager": "home-manager_2", + "home-manager": "home-manager", "hyprland": "hyprland", "nixpkgs": [ "edge-nixpkgs" diff --git a/flake.nix b/flake.nix index 68b37e51..df4a6f8f 100644 --- a/flake.nix +++ b/flake.nix @@ -9,10 +9,14 @@ 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 = { + home-manager-linux = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + home-manager-darwin = { + url = "github:nix-community/home-manager/release-24.05"; + inputs.nixpkgs.follows = "nixpkgs-darwin"; + }; nixos-wsl = { url = "github:nix-community/NixOS-WSL/2405.5.4"; # https://github.com/nix-community/NixOS-WSL/blob/5a965cb108fb1f30b29a26dbc29b473f49e80b41/flake.nix#L5 @@ -37,7 +41,8 @@ nixpkgs, edge-nixpkgs, nixpkgs-darwin, - home-manager, + home-manager-linux, + home-manager-darwin, ... }@inputs: let @@ -169,7 +174,8 @@ # https://github.com/NixOS/nix/issues/6448#issuecomment-1132855605 { name = "home-manager"; - value = mkApp home-manager.defaultPackage.${system}; + # FIXME: Use home-manager-darwin in macOS + value = mkApp home-manager-linux.defaultPackage.${system}; } ] ) @@ -230,7 +236,7 @@ }; in { - "kachick@desktop" = home-manager.lib.homeManagerConfiguration ( + "kachick@desktop" = home-manager-linux.lib.homeManagerConfiguration ( x86-Linux // { modules = [ @@ -241,7 +247,7 @@ } ); - "kachick@wsl-ubuntu" = home-manager.lib.homeManagerConfiguration ( + "kachick@wsl-ubuntu" = home-manager-linux.lib.homeManagerConfiguration ( x86-Linux // { modules = [ @@ -251,7 +257,7 @@ } ); - "nixos@wsl-nixos" = home-manager.lib.homeManagerConfiguration ( + "nixos@wsl-nixos" = home-manager-linux.lib.homeManagerConfiguration ( x86-Linux // { modules = [ @@ -262,11 +268,11 @@ } ); - "kachick@macbook" = home-manager.lib.homeManagerConfiguration ( + "kachick@macbook" = home-manager-darwin.lib.homeManagerConfiguration ( x86-macOS // { modules = [ ./home-manager/kachick.nix ]; } ); - "kachick@lima" = home-manager.lib.homeManagerConfiguration ( + "kachick@lima" = home-manager-darwin.lib.homeManagerConfiguration ( x86-Linux // { modules = [ @@ -276,7 +282,7 @@ } ); - "github-actions@ubuntu-24.04" = home-manager.lib.homeManagerConfiguration ( + "github-actions@ubuntu-24.04" = home-manager-linux.lib.homeManagerConfiguration ( x86-Linux // { # Prefer "kachick" over "common" only here. @@ -289,7 +295,7 @@ } ); - "github-actions@macos-13" = home-manager.lib.homeManagerConfiguration ( + "github-actions@macos-13" = home-manager-darwin.lib.homeManagerConfiguration ( x86-macOS // { # Prefer "kachick" over "common" only here. @@ -301,7 +307,7 @@ } ); - "github-actions@macos-15" = home-manager.lib.homeManagerConfiguration ( + "github-actions@macos-15" = home-manager-darwin.lib.homeManagerConfiguration ( aarch64-macOS // { # Prefer "kachick" over "common" only here. @@ -313,7 +319,7 @@ } ); - "user@linux-cli" = home-manager.lib.homeManagerConfiguration ( + "user@linux-cli" = home-manager-linux.lib.homeManagerConfiguration ( x86-Linux // { modules = [ From faaff2017d014e9b21d7840856e491bf8c558966 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 12:53:11 +0900 Subject: [PATCH 07/12] Remove garbage code in GH-796 --- nixos/desktop/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index e384e093..bd5147cd 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -13,7 +13,6 @@ (import ./font.nix { inherit pkgs homemade-pkgs; }) inputs.xremap-flake.nixosModules.default ./xremap.nix - inputs.home-manager.nixosModules.home-manager ]; # Define a user account. Don't forget to set a password with ‘passwd’. From 78be54c08ee917594eca12f14ce799402f0c4751 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 11 Nov 2024 12:55:56 +0900 Subject: [PATCH 08/12] Enable decadent magic nix cache only in macos-13 --- .github/workflows/ci-home.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 00a83689..21abbfe7 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -54,7 +54,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: DeterminateSystems/nix-installer-action@v14 - # Don't use DeterminateSystems/magic-nix-cache-action in this workflow until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported + # Don't use DeterminateSystems/magic-nix-cache-action for Linux until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported + - uses: DeterminateSystems/magic-nix-cache-action@v8 + # Always slow. Especially since GH-924 + if: runner.name == 'macos-13' - name: Print some dotfiles overviews run: | Date: Mon, 11 Nov 2024 13:03:21 +0900 Subject: [PATCH 09/12] fix? to specify intel mac --- .github/workflows/ci-home.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 21abbfe7..87ee3f04 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -57,7 +57,7 @@ jobs: # Don't use DeterminateSystems/magic-nix-cache-action for Linux until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported - uses: DeterminateSystems/magic-nix-cache-action@v8 # Always slow. Especially since GH-924 - if: runner.name == 'macos-13' + if: runner.os == 'macOS' && runner.arch == 'X64' - name: Print some dotfiles overviews run: | Date: Mon, 11 Nov 2024 13:20:38 +0900 Subject: [PATCH 10/12] Enable decadent magic nix cache only in macos-13 also in ci-nix --- .github/workflows/ci-nix.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 6c63cc50..c9b84a98 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -39,6 +39,8 @@ jobs: Date: Mon, 11 Nov 2024 13:58:25 +0900 Subject: [PATCH 11/12] Don't maintain this repository on darwin, use lima To avoid rate limit --- .github/workflows/ci-nix.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index c9b84a98..7a4da683 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -27,8 +27,6 @@ jobs: matrix: os: - ubuntu-24.04 - - macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. - - macos-13 runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: @@ -38,9 +36,6 @@ jobs: run: | Date: Mon, 11 Nov 2024 14:07:45 +0900 Subject: [PATCH 12/12] Drop macos-15 runner in CI matrix I just experienced with arch problems, not for the OS version problems in home-manager And I want to reduce macos related code with GH-911 --- .github/workflows/ci-go.yml | 1 - cmd/gen_matrix/main.go | 2 -- flake.nix | 20 -------------------- 3 files changed, 23 deletions(-) diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml index 255d62cd..a56e6966 100644 --- a/.github/workflows/ci-go.yml +++ b/.github/workflows/ci-go.yml @@ -27,7 +27,6 @@ jobs: matrix: os: - ubuntu-24.04 - - macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. - windows-latest runs-on: ${{ matrix.os }} steps: diff --git a/cmd/gen_matrix/main.go b/cmd/gen_matrix/main.go index 3e306ec8..893b18e6 100644 --- a/cmd/gen_matrix/main.go +++ b/cmd/gen_matrix/main.go @@ -42,8 +42,6 @@ func main() { // https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811 Os: []string{ "ubuntu-24.04", - // Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. - "macos-15", }, } diff --git a/flake.nix b/flake.nix index df4a6f8f..2a6974b0 100644 --- a/flake.nix +++ b/flake.nix @@ -226,14 +226,6 @@ edge-pkgs = edge-nixpkgs.legacyPackages.x86_64-darwin; }; }; - - aarch64-macOS = { - pkgs = nixpkgs-darwin.legacyPackages.aarch64-darwin; - extraSpecialArgs = { - homemade-pkgs = homemade-packages.aarch64-darwin; - edge-pkgs = edge-nixpkgs.legacyPackages.aarch64-darwin; - }; - }; in { "kachick@desktop" = home-manager-linux.lib.homeManagerConfiguration ( @@ -307,18 +299,6 @@ } ); - "github-actions@macos-15" = home-manager-darwin.lib.homeManagerConfiguration ( - aarch64-macOS - // { - # Prefer "kachick" over "common" only here. - # Using values as much as possible as actual values to create a robust CI - modules = [ - ./home-manager/kachick.nix - { home.username = "runner"; } - ]; - } - ); - "user@linux-cli" = home-manager-linux.lib.homeManagerConfiguration ( x86-Linux // {