flake: new forAllSystems

This commit is contained in:
sid 2026-05-10 17:27:19 +02:00
parent 27dbba9d02
commit 93331e06f3

View file

@ -22,13 +22,13 @@
let
inherit (self) outputs;
supportedSystems = [
"x86_64-linux"
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
lib = nixpkgs.lib.extend (final: prev: inputs.synix.lib or { });
mkNixosConfiguration =
@ -39,9 +39,21 @@
inherit inputs outputs lib;
};
};
forAllSystems =
function:
lib.genAttrs systems (
system:
function (
import nixpkgs {
inherit system;
overlays = [ self.overlays.modifications ];
}
)
);
in
{
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
packages = forAllSystems (pkgs: import ./pkgs pkgs);
overlays = import ./overlays { inherit inputs; };
@ -51,24 +63,16 @@
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
};
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
shellHook = "export FLAKE_PATH=$(pwd)";
};
}
);
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
shellHook = "export FLAKE_PATH=$(pwd)";
};
});
formatter = forAllSystems (
system:
pkgs:
let
pkgs = nixpkgs.legacyPackages.${system};
config = self.checks.${system}.pre-commit-check.config;
inherit (config) package configFile;
inherit (self.checks.${pkgs.system}.pre-commit-check.config) package configFile;
script = ''
${pkgs.lib.getExe package} run --all-files --config ${configFile}
'';
@ -76,28 +80,17 @@
pkgs.writeShellScriptBin "pre-commit-run" script
);
checks = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
flakePkgs = self.packages.${system};
overlaidPkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.modifications ];
checks = forAllSystems (pkgs: {
pre-commit-check = inputs.git-hooks.lib.${pkgs.system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
};
in
{
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
};
};
build-packages = pkgs.linkFarm "flake-packages-${system}" flakePkgs;
build-overlays = pkgs.linkFarm "flake-overlays-${system}" {
# package = overlaidPkgs.package;
};
}
);
};
build-packages = pkgs.linkFarm "flake-packages-${pkgs.system}" self.packages.${pkgs.system};
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${pkgs.system}" (
self.overlays.modifications pkgs pkgs
);
});
};
}