Provide set of supported platforms

This commit is contained in:
Mikael Voss 2024-08-24 15:00:02 +02:00
parent 39b1c13c5b
commit ad369da0f9
No known key found for this signature in database
2 changed files with 26 additions and 13 deletions

View file

@ -74,28 +74,25 @@
in import "${base}/${path}" inputs;
});
eachFlakeSystem = lib.genAttrs lib.systems.flakeExposed;
eachNixosSystem = lib.systems.flakeExposed
|> lib.systems.parse
|> builtins.filter (sys: sys.isLinux)
|> builtins.attrNames
|> lib.genAttrs;
eachSystem = fun: lib.mapAttrs fun self.lib.platforms;
in {
lib = load ./lib "lib" // {
inherit load;
};
overlays = load ./overlay "overlay";
legacyPackages = eachFlakeSystem (system:
legacyPackages = eachSystem (system: platform:
import nixpkgs {
inherit system;
localSystem = builtins.currentSystem or platform;
crossSystem = platform;
overlays = [ self.overlays.default ];
});
packages = eachFlakeSystem (system: let pkgs = self.legacyPackages.${system};
packages = eachSystem (system: platform:
let pkgs = self.legacyPackages.${system};
in load ./package "package"
|> lib.mapAttrs (name: pkg: self.legacyPackages.${system}.callPackage pkg { })
|> lib.filterAttrs (name: pkg: lib.meta.availableOn { inherit system; } pkg));
|> lib.mapAttrs (name: pkg: self.legacyPackages.${system}.callPackage pkg { })
|> lib.filterAttrs (name: pkg: lib.meta.availableOn platform pkg));
nixosModules = load ./nixos/module "module";
@ -120,9 +117,9 @@
homeModules = load ./home/module "module";
homeConfigurations = load ./home/config "home";
devShells = eachFlakeSystem (system: load ./shell "shell"
devShells = eachSystem (system: platform: load ./shell "shell"
|> lib.mapAttrs (name: shell: self.legacyPackages.${system}.callPackage shell { })
|> lib.filterAttrs (name: shell: lib.meta.availableOn { inherit system; } shell));
|> lib.filterAttrs (name: shell: lib.meta.availableOn platform shell));
hydraJobs = {
package = self.packages;

16
lib/platforms.nix Normal file
View file

@ -0,0 +1,16 @@
{ nixpkgs, ... }:
let inherit (nixpkgs) lib;
in lib.mapAttrs (system: platform: lib.systems.elaborate platform) {
"x86_64-linux" = {
system = "x86_64-linux";
};
"aarch64-linux" = {
system = "aarch64-linux";
};
"riscv64-linux" = {
system = "riscv64-linux";
};
}