idiosyn/flake.nix
2024-07-22 18:38:42 +02:00

69 lines
2 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 {
packages = builtins.mapAttrs (_: platform:
let
inherit (self.legacyPackages.${platform.system}.pkgs) callPackage;
in {
locale-archive-stub = callPackage ./pkgs/locale-archive-stub.nix { };
}) platforms;
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;
config.allowBroken = true; # temporarily
}) platforms;
overlays.default = import ./overlay.nix;
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;
};
};
}