Skip to content

Commit 9cf737b

Browse files
Make most packages refer darwin special channel if run on macOS (#924)
* Make most packages refers darwin special channel if run on macOS Fixes GH-910 * flake.lock: Update 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) * Fix to branch nix channel in homemade packages * Enable magic-nix-cache-action in home-manager CI only on darwin * Revert "Enable magic-nix-cache-action in home-manager CI only on darwin" This reverts commit f14cdff. * Sync same channel in home-manager * Remove garbage code in GH-796 * Enable decadent magic nix cache only in macos-13 * fix? to specify intel mac * Enable decadent magic nix cache only in macos-13 also in ci-nix * Don't maintain this repository on darwin, use lima To avoid rate limit * 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 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent fb5f31a commit 9cf737b

File tree

7 files changed

+84
-58
lines changed

7 files changed

+84
-58
lines changed

.github/workflows/ci-go.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
matrix:
2828
os:
2929
- ubuntu-24.04
30-
- macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed.
3130
- windows-latest
3231
runs-on: ${{ matrix.os }}
3332
steps:

.github/workflows/ci-home.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ jobs:
5454
runs-on: ${{ matrix.os }}
5555
steps:
5656
- uses: DeterminateSystems/nix-installer-action@v14
57-
# Don't use DeterminateSystems/magic-nix-cache-action in this workflow until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported
57+
# Don't use DeterminateSystems/magic-nix-cache-action for Linux until https://github.com/DeterminateSystems/magic-nix-cache-action/issues/26 is supported
58+
- uses: DeterminateSystems/magic-nix-cache-action@v8
59+
# Always slow. Especially since GH-924
60+
if: runner.os == 'macOS' && runner.arch == 'X64'
5861
- name: Print some dotfiles overviews
5962
run: |
6063
</etc/nix/nix.conf

.github/workflows/ci-nix.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
matrix:
2828
os:
2929
- ubuntu-24.04
30-
- macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed.
3130
runs-on: ${{ matrix.os }}
3231
timeout-minutes: 30
3332
steps:
@@ -37,7 +36,6 @@ jobs:
3736
run: |
3837
</etc/nix/nix.conf
3938
ls -alh ~
40-
- uses: DeterminateSystems/magic-nix-cache-action@v8
4139
- run: nix develop --command echo 'This step should be done before any other "nix develop" steps because of measuring Nix build time'
4240
- run: nix flake show
4341
- run: nix flake check

cmd/gen_matrix/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ func main() {
4242
// https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
4343
Os: []string{
4444
"ubuntu-24.04",
45-
// Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed.
46-
"macos-15",
4745
},
4846
}
4947

flake.lock

Lines changed: 53 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55
# - https://discourse.nixos.org/t/differences-between-nix-channels/13998
66
# How to update the revision
77
# - `nix flake update --commit-lock-file` # https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-update.html
8-
# TODO: Use nixpkgs-24.05-darwin only in macOS. See GH-910
98
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
10-
edge-nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
9+
edge-nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Unfit for darwin, might be broken. See https://github.com/NixOS/nixpkgs/issues/107466
10+
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
1111
# https://github.com/nix-community/home-manager/blob/release-24.05/docs/manual/nix-flakes.md
12-
home-manager = {
12+
home-manager-linux = {
1313
url = "github:nix-community/home-manager/release-24.05";
1414
inputs.nixpkgs.follows = "nixpkgs";
1515
};
16+
home-manager-darwin = {
17+
url = "github:nix-community/home-manager/release-24.05";
18+
inputs.nixpkgs.follows = "nixpkgs-darwin";
19+
};
1620
nixos-wsl = {
1721
url = "github:nix-community/NixOS-WSL/2405.5.4";
1822
# https://github.com/nix-community/NixOS-WSL/blob/5a965cb108fb1f30b29a26dbc29b473f49e80b41/flake.nix#L5
@@ -36,7 +40,9 @@
3640
self,
3741
nixpkgs,
3842
edge-nixpkgs,
39-
home-manager,
43+
nixpkgs-darwin,
44+
home-manager-linux,
45+
home-manager-darwin,
4046
...
4147
}@inputs:
4248
let
@@ -51,9 +57,12 @@
5157

5258
homemade-packages = forAllSystems (
5359
system:
54-
(nixpkgs.legacyPackages.${system}.callPackage ./pkgs {
55-
edge-pkgs = edge-nixpkgs.legacyPackages.${system};
56-
})
60+
(
61+
(if (nixpkgs.lib.strings.hasSuffix "-darwin" system) then nixpkgs-darwin else nixpkgs)
62+
.legacyPackages.${system}.callPackage
63+
./pkgs
64+
{ edge-pkgs = edge-nixpkgs.legacyPackages.${system}; }
65+
)
5766
);
5867
in
5968
{
@@ -164,7 +173,8 @@
164173
# https://github.com/NixOS/nix/issues/6448#issuecomment-1132855605
165174
{
166175
name = "home-manager";
167-
value = mkApp home-manager.defaultPackage.${system};
176+
# FIXME: Use home-manager-darwin in macOS
177+
value = mkApp home-manager-linux.defaultPackage.${system};
168178
}
169179
]
170180
)
@@ -209,23 +219,15 @@
209219
};
210220

211221
x86-macOS = {
212-
pkgs = nixpkgs.legacyPackages.x86_64-darwin;
222+
pkgs = nixpkgs-darwin.legacyPackages.x86_64-darwin;
213223
extraSpecialArgs = {
214224
homemade-pkgs = homemade-packages.x86_64-darwin;
215225
edge-pkgs = edge-nixpkgs.legacyPackages.x86_64-darwin;
216226
};
217227
};
218-
219-
aarch64-macOS = {
220-
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
221-
extraSpecialArgs = {
222-
homemade-pkgs = homemade-packages.aarch64-darwin;
223-
edge-pkgs = edge-nixpkgs.legacyPackages.aarch64-darwin;
224-
};
225-
};
226228
in
227229
{
228-
"kachick@desktop" = home-manager.lib.homeManagerConfiguration (
230+
"kachick@desktop" = home-manager-linux.lib.homeManagerConfiguration (
229231
x86-Linux
230232
// {
231233
modules = [
@@ -236,7 +238,7 @@
236238
}
237239
);
238240

239-
"kachick@wsl-ubuntu" = home-manager.lib.homeManagerConfiguration (
241+
"kachick@wsl-ubuntu" = home-manager-linux.lib.homeManagerConfiguration (
240242
x86-Linux
241243
// {
242244
modules = [
@@ -246,7 +248,7 @@
246248
}
247249
);
248250

249-
"nixos@wsl-nixos" = home-manager.lib.homeManagerConfiguration (
251+
"nixos@wsl-nixos" = home-manager-linux.lib.homeManagerConfiguration (
250252
x86-Linux
251253
// {
252254
modules = [
@@ -257,11 +259,11 @@
257259
}
258260
);
259261

260-
"kachick@macbook" = home-manager.lib.homeManagerConfiguration (
262+
"kachick@macbook" = home-manager-darwin.lib.homeManagerConfiguration (
261263
x86-macOS // { modules = [ ./home-manager/kachick.nix ]; }
262264
);
263265

264-
"kachick@lima" = home-manager.lib.homeManagerConfiguration (
266+
"kachick@lima" = home-manager-darwin.lib.homeManagerConfiguration (
265267
x86-Linux
266268
// {
267269
modules = [
@@ -271,7 +273,7 @@
271273
}
272274
);
273275

274-
"[email protected]" = home-manager.lib.homeManagerConfiguration (
276+
"[email protected]" = home-manager-linux.lib.homeManagerConfiguration (
275277
x86-Linux
276278
// {
277279
# Prefer "kachick" over "common" only here.
@@ -284,7 +286,7 @@
284286
}
285287
);
286288

287-
"github-actions@macos-13" = home-manager.lib.homeManagerConfiguration (
289+
"github-actions@macos-13" = home-manager-darwin.lib.homeManagerConfiguration (
288290
x86-macOS
289291
// {
290292
# Prefer "kachick" over "common" only here.
@@ -296,19 +298,7 @@
296298
}
297299
);
298300

299-
"github-actions@macos-15" = home-manager.lib.homeManagerConfiguration (
300-
aarch64-macOS
301-
// {
302-
# Prefer "kachick" over "common" only here.
303-
# Using values as much as possible as actual values to create a robust CI
304-
modules = [
305-
./home-manager/kachick.nix
306-
{ home.username = "runner"; }
307-
];
308-
}
309-
);
310-
311-
"user@linux-cli" = home-manager.lib.homeManagerConfiguration (
301+
"user@linux-cli" = home-manager-linux.lib.homeManagerConfiguration (
312302
x86-Linux
313303
// {
314304
modules = [

nixos/desktop/default.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
(import ./font.nix { inherit pkgs homemade-pkgs; })
1414
inputs.xremap-flake.nixosModules.default
1515
./xremap.nix
16-
inputs.home-manager.nixosModules.home-manager
1716
];
1817

1918
# Define a user account. Don't forget to set a password with ‘passwd’.

0 commit comments

Comments
 (0)