flake: new forAllSystems
This commit is contained in:
parent
27dbba9d02
commit
93331e06f3
1 changed files with 35 additions and 42 deletions
77
flake.nix
77
flake.nix
|
|
@ -22,13 +22,13 @@
|
||||||
let
|
let
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
|
|
||||||
supportedSystems = [
|
systems = [
|
||||||
"x86_64-linux"
|
"aarch64-darwin"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
||||||
|
|
||||||
lib = nixpkgs.lib.extend (final: prev: inputs.synix.lib or { });
|
lib = nixpkgs.lib.extend (final: prev: inputs.synix.lib or { });
|
||||||
|
|
||||||
mkNixosConfiguration =
|
mkNixosConfiguration =
|
||||||
|
|
@ -39,9 +39,21 @@
|
||||||
inherit inputs outputs lib;
|
inherit inputs outputs lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
forAllSystems =
|
||||||
|
function:
|
||||||
|
lib.genAttrs systems (
|
||||||
|
system:
|
||||||
|
function (
|
||||||
|
import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ self.overlays.modifications ];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
packages = forAllSystems (pkgs: import ./pkgs pkgs);
|
||||||
|
|
||||||
overlays = import ./overlays { inherit inputs; };
|
overlays = import ./overlays { inherit inputs; };
|
||||||
|
|
||||||
|
|
@ -51,24 +63,16 @@
|
||||||
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
|
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (pkgs: {
|
||||||
system:
|
default = pkgs.mkShell {
|
||||||
let
|
shellHook = "export FLAKE_PATH=$(pwd)";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
};
|
||||||
in
|
});
|
||||||
{
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
shellHook = "export FLAKE_PATH=$(pwd)";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
formatter = forAllSystems (
|
formatter = forAllSystems (
|
||||||
system:
|
pkgs:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
inherit (self.checks.${pkgs.system}.pre-commit-check.config) package configFile;
|
||||||
config = self.checks.${system}.pre-commit-check.config;
|
|
||||||
inherit (config) package configFile;
|
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.lib.getExe package} run --all-files --config ${configFile}
|
${pkgs.lib.getExe package} run --all-files --config ${configFile}
|
||||||
'';
|
'';
|
||||||
|
|
@ -76,28 +80,17 @@
|
||||||
pkgs.writeShellScriptBin "pre-commit-run" script
|
pkgs.writeShellScriptBin "pre-commit-run" script
|
||||||
);
|
);
|
||||||
|
|
||||||
checks = forAllSystems (
|
checks = forAllSystems (pkgs: {
|
||||||
system:
|
pre-commit-check = inputs.git-hooks.lib.${pkgs.system}.run {
|
||||||
let
|
src = ./.;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
hooks = {
|
||||||
flakePkgs = self.packages.${system};
|
nixfmt.enable = true;
|
||||||
overlaidPkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
overlays = [ self.overlays.modifications ];
|
|
||||||
};
|
};
|
||||||
in
|
};
|
||||||
{
|
build-packages = pkgs.linkFarm "flake-packages-${pkgs.system}" self.packages.${pkgs.system};
|
||||||
pre-commit-check = inputs.git-hooks.lib.${system}.run {
|
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${pkgs.system}" (
|
||||||
src = ./.;
|
self.overlays.modifications pkgs pkgs
|
||||||
hooks = {
|
);
|
||||||
nixfmt.enable = true;
|
});
|
||||||
};
|
|
||||||
};
|
|
||||||
build-packages = pkgs.linkFarm "flake-packages-${system}" flakePkgs;
|
|
||||||
build-overlays = pkgs.linkFarm "flake-overlays-${system}" {
|
|
||||||
# package = overlaidPkgs.package;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue