nix-config/flake.nix

122 lines
2.7 KiB
Nix
Raw Normal View History

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2023-05-17 05:07:14 +02:00
home-manager = {
url = "github:donovanglover/home-manager";
2023-05-17 05:07:14 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
2023-05-17 05:07:14 +02:00
stylix = {
url = "github:donovanglover/stylix";
2023-05-17 05:35:52 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
2023-05-17 05:07:14 +02:00
};
sakaya = {
url = "github:donovanglover/sakaya";
inputs.nixpkgs.follows = "nixpkgs";
};
mobile-nixos = {
url = "github:donovanglover/mobile-nixos";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-06-21 08:41:38 +02:00
};
outputs =
{
self,
nixpkgs,
...
}:
let
inherit (nixpkgs.lib) nixosSystem;
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
inherit (builtins) listToAttrs map replaceStrings;
2024-10-10 01:51:53 +02:00
forAllSystems =
function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system: function nixpkgs.legacyPackages.${system});
2024-10-10 02:16:53 +02:00
nameOf = path: replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString path));
in
{
2024-10-10 01:51:53 +02:00
packages = forAllSystems (
pkgs:
packagesFromDirectoryRecursive {
2024-10-10 14:17:37 +02:00
inherit (pkgs) callPackage;
2024-10-10 01:51:53 +02:00
directory = ./packages;
}
);
nixosModules = listToAttrs (
map (file: {
name = nameOf file;
value = import file;
}) (listFilesRecursive ./modules)
);
homeModules = listToAttrs (
map (file: {
name = nameOf file;
value = import file;
}) (listFilesRecursive ./home)
);
overlays = listToAttrs (
map (file: {
name = nameOf file;
value = import file;
}) (listFilesRecursive ./overlays)
);
2024-10-10 01:51:53 +02:00
checks.x86_64-linux = listToAttrs (
map (file: {
name = nameOf file;
2024-10-10 01:51:53 +02:00
value = import file {
inherit self;
2024-10-10 02:16:53 +02:00
pkgs = nixpkgs.legacyPackages.x86_64-linux;
2024-10-10 01:51:53 +02:00
};
}) (listFilesRecursive ./tests)
);
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
];
};
};
2024-10-10 02:10:41 +02:00
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
}