nix-config/flake.nix

92 lines
2.3 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:nix-community/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";
2024-10-11 19:47:59 +02:00
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 =
2024-10-11 19:47:59 +02:00
{ self, nixpkgs, ... }:
let
inherit (nixpkgs.lib) nixosSystem genAttrs replaceStrings;
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
2024-10-10 01:51:53 +02:00
forAllSystems =
function:
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 = 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;
}
)
2024-10-10 01:51:53 +02:00
);
nixosConfigurations = {
nixos = nixosSystem {
system = "x86_64-linux";
2024-10-11 19:47:59 +02:00
specialArgs.nix-config = self;
modules = listFilesRecursive ./hosts/laptop;
};
mobile-nixos = nixosSystem {
system = "aarch64-linux";
2024-10-11 19:47:59 +02:00
specialArgs.nix-config = self;
modules = listFilesRecursive ./hosts/phone;
};
};
2024-10-10 02:10:41 +02:00
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
}