Donovan Glover 2024-10-09 18:50:02 -04:00
parent 421d70a3d8
commit c8adf93d0b
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -34,7 +34,7 @@
... ...
}@attrs: }@attrs:
let let
inherit (nixpkgs.lib) nixosSystem; inherit (nixpkgs.lib) nixosSystem packagesFromDirectoryRecursive;
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux; inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
inherit (builtins) inherit (builtins)
@ -49,7 +49,6 @@
"overlays" "overlays"
"nixosModules" "nixosModules"
"homeModules" "homeModules"
"packages"
"checks" "checks"
]; ];
@ -57,11 +56,21 @@
"overlays" "overlays"
"modules" "modules"
"home" "home"
"packages"
"tests" "tests"
]; ];
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system: function nixpkgs.legacyPackages.${system});
in in
{ {
packages = forAllSystems (pkgs: packagesFromDirectoryRecursive {
callPackage = pkgs.callPackage;
directory = ./packages;
});
nixosConfigurations = nixosConfigurations =
let let
phoneModules = [ phoneModules = [
@ -131,9 +140,7 @@
map (file: { map (file: {
name = replaceStrings [ ".nix" ] [ "" ] file; name = replaceStrings [ ".nix" ] [ "" ] file;
value = value =
if directory == "packages" then if directory == "tests" then
x86_64-linux.callPackage ./${directory}/${file} { }
else if directory == "tests" then
import ./${directory}/${file} { import ./${directory}/${file} {
inherit self; inherit self;
pkgs = x86_64-linux; pkgs = x86_64-linux;
@ -143,21 +150,8 @@
}) (attrNames (readDir ./${directory})) }) (attrNames (readDir ./${directory}))
); );
aarch64Packages = listToAttrs (
map (file: {
name = replaceStrings [ ".nix" ] [ "" ] file;
value =
if directory == "packages" then aarch64-linux.callPackage ./${directory}/${file} { } else null;
}) (attrNames (readDir ./${directory}))
);
attributeSet = attributeSet =
if directory == "packages" then if directory == "tests" then
{
x86_64-linux = attributeValue;
aarch64-linux = aarch64Packages;
}
else if directory == "tests" then
{ x86_64-linux = attributeValue; } { x86_64-linux = attributeValue; }
else else
attributeValue; attributeValue;