Skip to content

Commit 2187359

Browse files
committed
flake: try to fix macos builds
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 9a98767 commit 2187359

File tree

1 file changed

+59
-37
lines changed

1 file changed

+59
-37
lines changed

flake.nix

Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,61 +17,83 @@
1717
nixpkgs-qt5153,
1818
}:
1919
let
20-
system = "x86_64-linux";
21-
pkgs = nixpkgs.legacyPackages.${system};
22-
pkgs-qt69 = nixpkgs-qt69.legacyPackages.${system};
23-
pkgs-qt5153 = nixpkgs-qt5153.legacyPackages.${system};
20+
# Define supported systems
21+
systems = [
22+
"x86_64-linux"
23+
"aarch64-linux"
24+
"x86_64-darwin"
25+
"aarch64-darwin"
26+
];
27+
28+
# Helper function to generate attributes for each system
29+
forAllSystems = nixpkgs.lib.genAttrs systems;
30+
31+
# Helper to get package sets for a given system
32+
pkgsFor = system: nixpkgs.legacyPackages.${system};
33+
pkgsQt69For = system: nixpkgs-qt69.legacyPackages.${system};
34+
pkgsQt5153For = system: nixpkgs-qt5153.legacyPackages.${system};
2435
in
2536
{
26-
packages.${system} = {
27-
qownnotes-qt6 = pkgs.callPackage (import ./default.nix) { };
28-
qownnotes-qt69 = pkgs-qt69.callPackage (import ./default.nix) { };
29-
qownnotes-qt5 = pkgs.libsForQt5.callPackage (import ./build-systems/nix/default-qt5.nix) { };
30-
qownnotes-qt5153 =
31-
pkgs-qt5153.libsForQt5.callPackage (import ./build-systems/nix/default-qt5.nix)
32-
{ };
33-
default = pkgs.qt6Packages.callPackage (import ./default.nix) { };
34-
};
37+
packages = forAllSystems (
38+
system:
39+
let
40+
pkgs = pkgsFor system;
41+
pkgs-qt69 = pkgsQt69For system;
42+
pkgs-qt5153 = pkgsQt5153For system;
43+
in
44+
{
45+
qownnotes-qt6 = pkgs.callPackage (import ./default.nix) { };
46+
qownnotes-qt69 = pkgs-qt69.callPackage (import ./default.nix) { };
47+
qownnotes-qt5 = pkgs.libsForQt5.callPackage (import ./build-systems/nix/default-qt5.nix) { };
48+
qownnotes-qt5153 =
49+
pkgs-qt5153.libsForQt5.callPackage (import ./build-systems/nix/default-qt5.nix)
50+
{ };
51+
default = pkgs.qt6Packages.callPackage (import ./default.nix) { };
52+
}
53+
);
3554

36-
devShell.x86_64-linux =
37-
with import nixpkgs { system = "x86_64-linux"; };
38-
mkShell {
39-
nativeBuildInputs =
40-
with nixpkgs;
41-
with qt6;
42-
[
43-
gnumake
44-
crowdin-cli
45-
cmakeWithGui
55+
devShells = forAllSystems (
56+
system:
57+
let
58+
pkgs = import nixpkgs { inherit system; };
59+
in
60+
{
61+
default = pkgs.mkShell {
62+
nativeBuildInputs = with pkgs.qt6; [
63+
pkgs.gnumake
64+
pkgs.crowdin-cli
65+
pkgs.cmakeWithGui
4666
qmake
4767
qttools
4868
wrapQtAppsHook
49-
pkg-config
69+
pkgs.pkg-config
5070

5171
# for ./build-systems/github/build-github-src.sh
52-
coreutils
53-
gh
72+
pkgs.coreutils
73+
pkgs.gh
5474
];
5575

56-
buildInputs =
57-
with nixpkgs;
58-
with qt6;
59-
[
76+
buildInputs = with pkgs.qt6; [
6077
qtbase
6178
qtwebsockets
6279
qtdeclarative
6380
qtsvg
64-
botan3
65-
libgit2
81+
pkgs.botan3
82+
pkgs.libgit2
6683
];
6784

68-
shellHook = ''
69-
echo "qmake: $(qmake --version)"
70-
'';
71-
};
85+
shellHook = ''
86+
echo "qmake: $(qmake --version)"
87+
'';
88+
};
89+
}
90+
);
91+
92+
# Legacy devShell attribute for backwards compatibility
93+
devShell = forAllSystems (system: self.devShells.${system}.default);
7294

7395
checks.x86_64-linux = {
74-
qownnotes = pkgs.testers.runNixOSTest ./tests/vm/qownnotes.nix;
96+
qownnotes = (pkgsFor "x86_64-linux").testers.runNixOSTest ./tests/vm/qownnotes.nix;
7597
};
7698
};
7799
}

0 commit comments

Comments
 (0)