idiosyn/flake.nix

76 lines
2.1 KiB
Nix
Raw Normal View History

2024-07-21 16:55:31 +02:00
{
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);
stdenv = import ./stdenv.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;
allowUnsupportedSystem = true;
replaceStdenv = stdenv;
replaceCrossStdenv = stdenv;
};
}) 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;
};
};
}