nix-config/flake.nix
Donovan Glover c9652f1680
flake: use checks for all systems
This seems to work now, possibly fixed by using the latest Nix version.
2024-10-11 14:39:18 -04:00

103 lines
2.5 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:donovanglover/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:donovanglover/stylix";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
sakaya = {
url = "github:donovanglover/sakaya";
inputs.nixpkgs.follows = "nixpkgs";
};
mobile-nixos = {
url = "github:donovanglover/mobile-nixos";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self, nixpkgs, ... }:
let
inherit (nixpkgs.lib) nixosSystem genAttrs;
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
inherit (builtins) map replaceStrings;
forAllSystems =
function:
genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system: function nixpkgs.legacyPackages.${system});
nameOf = path: replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString path));
in
{
packages = forAllSystems (
pkgs:
packagesFromDirectoryRecursive {
inherit (pkgs) callPackage;
directory = ./packages;
}
);
nixosModules = genAttrs (map nameOf (listFilesRecursive ./modules)) (
name: import ./modules/${name}.nix
);
homeModules = genAttrs (map nameOf (listFilesRecursive ./home)) (
name: import ./home/${name}.nix
);
overlays = genAttrs (map nameOf (listFilesRecursive ./overlays)) (
name: import ./overlays/${name}.nix
);
checks = forAllSystems (
pkgs:
genAttrs (map nameOf (listFilesRecursive ./tests)) (
name:
import ./tests/${name}.nix {
inherit self pkgs;
}
)
);
nixosConfigurations = {
nixos = nixosSystem {
system = "x86_64-linux";
specialArgs.nix-config = self;
modules = [
./hosts/laptop/configuration.nix
./hosts/laptop/hardware-configuration.nix
];
};
mobile-nixos = nixosSystem {
system = "aarch64-linux";
specialArgs.nix-config = self;
modules = [
./hosts/phone/configuration.nix
./hosts/phone/hardware-configuration.nix
];
};
};
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
}