Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make most packages refer darwin special channel if run on macOS #924

Merged
merged 13 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' && runner.arch == 'X64'
- name: Print some dotfiles overviews
run: |
</etc/nix/nix.conf
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
Expand All @@ -37,7 +36,6 @@ jobs:
run: |
</etc/nix/nix.conf
ls -alh ~
- uses: DeterminateSystems/magic-nix-cache-action@v8
- run: nix develop --command echo 'This step should be done before any other "nix develop" steps because of measuring Nix build time'
- run: nix flake show
- run: nix flake check
Expand Down
2 changes: 0 additions & 2 deletions cmd/gen_matrix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}

Expand Down
67 changes: 53 additions & 14 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 27 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
# - 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";
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you reach this repository with searching 08gjpy7gfpylh2m2dyhasd0l5i3y7mz2-ghostscript-10.04.0.drv, this line is the answer by me 🤷‍♂️ 🍎

# 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
Expand All @@ -36,7 +40,9 @@
self,
nixpkgs,
edge-nixpkgs,
home-manager,
nixpkgs-darwin,
home-manager-linux,
home-manager-darwin,
...
}@inputs:
let
Expand All @@ -51,9 +57,12 @@

homemade-packages = forAllSystems (
system:
(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
{
Expand Down Expand Up @@ -164,7 +173,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};
}
]
)
Expand Down Expand Up @@ -209,23 +219,15 @@
};

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

aarch64-macOS = {
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
extraSpecialArgs = {
homemade-pkgs = homemade-packages.aarch64-darwin;
edge-pkgs = edge-nixpkgs.legacyPackages.aarch64-darwin;
};
};
in
{
"kachick@desktop" = home-manager.lib.homeManagerConfiguration (
"kachick@desktop" = home-manager-linux.lib.homeManagerConfiguration (
x86-Linux
// {
modules = [
Expand All @@ -236,7 +238,7 @@
}
);

"kachick@wsl-ubuntu" = home-manager.lib.homeManagerConfiguration (
"kachick@wsl-ubuntu" = home-manager-linux.lib.homeManagerConfiguration (
x86-Linux
// {
modules = [
Expand All @@ -246,7 +248,7 @@
}
);

"nixos@wsl-nixos" = home-manager.lib.homeManagerConfiguration (
"nixos@wsl-nixos" = home-manager-linux.lib.homeManagerConfiguration (
x86-Linux
// {
modules = [
Expand All @@ -257,11 +259,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 = [
Expand All @@ -271,7 +273,7 @@
}
);

"[email protected]" = home-manager.lib.homeManagerConfiguration (
"[email protected]" = home-manager-linux.lib.homeManagerConfiguration (
x86-Linux
// {
# Prefer "kachick" over "common" only here.
Expand All @@ -284,7 +286,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.
Expand All @@ -296,19 +298,7 @@
}
);

"github-actions@macos-15" = home-manager.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.lib.homeManagerConfiguration (
"user@linux-cli" = home-manager-linux.lib.homeManagerConfiguration (
x86-Linux
// {
modules = [
Expand Down
1 change: 0 additions & 1 deletion nixos/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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’.
Expand Down