idiosyn/flake.nix
2024-07-22 01:54:47 +02:00

60 lines
1.7 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
};
nixConfig = {
extra-substituters = [
"https://cache.kyouma.net"
];
extra-trusted-public-keys = [
"cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg="
];
};
outputs = { self, nixpkgs, lix-module, ... }@inputs:
let
inherit (nixpkgs) lib;
platforms = builtins.mapAttrs
(_: platform: lib.systems.elaborate platform)
(import ./platforms.nix);
modules = lib.attrNames (builtins.readDir ./modules);
modName = lib.removeSuffix ".nix";
in {
overlays.default = import ./overlay.nix;
legacyPackages = builtins.mapAttrs (name: platform:
import nixpkgs {
localSystem = builtins.currentSystem or platform.system;
crossSystem = platform;
overlays = [
self.overlays.default
lix-module.overlays.default
];
config.allowUnfree = true;
}) platforms;
nixosModules = builtins.listToAttrs
(builtins.map (mod: { name = modName mod; value = import ./modules/${mod}; }) modules)
// { default = { ... }: { imports = map (mod: self.nixosModules.${modName mod}) modules; }; };
nixosConfigurations = builtins.mapAttrs (_: platform: lib.nixosSystem {
specialArgs = { pkgs = self.legacyPackages.${platform.system}; };
modules = [ self.nixosModules.default ./nixos.nix ];
}) platforms;
hydraJobs = {
nixosConfigurations = builtins.mapAttrs
(_: host: host.config.system.build.vm)
self.nixosConfigurations;
};
};
}