mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-02-11 07:19:30 +01:00
flake: use packagesFromDirectoryRecursive
https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.filesystem.packagesFromDirectoryRecursive
This commit is contained in:
parent
421d70a3d8
commit
c8adf93d0b
34
flake.nix
34
flake.nix
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user