70 lines
1.9 KiB
Nix
70 lines
1.9 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
};
|
|
|
|
nixConfig = {
|
|
extra-substituters = [ "https://cache.kyouma.net" ];
|
|
extra-trusted-public-keys = [ "cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg=" ];
|
|
};
|
|
|
|
outputs = { self, nixpkgs, ... }@inputs:
|
|
let
|
|
inherit (builtins) mapAttrs;
|
|
inherit (nixpkgs) lib;
|
|
|
|
platforms = mapAttrs
|
|
(name: platform: lib.systems.elaborate platform)
|
|
(import ./platforms.nix);
|
|
in {
|
|
lib = {
|
|
inherit platforms;
|
|
replaceConfig = {
|
|
replaceStdenv =
|
|
{ pkgs }: pkgs.idiosyn pkgs.stdenv;
|
|
replaceCrossStdenv =
|
|
{ buildPackages, baseStdenv }: buildPackages.idiosyn baseStdenv;
|
|
};
|
|
};
|
|
overlays.default = import ./overlay.nix inputs;
|
|
|
|
nixosModules.default = { ... }: {
|
|
nixpkgs = {
|
|
overlays = [ self.overlays.default ];
|
|
config = self.lib.replaceConfig // {
|
|
allowUnsupportedSystem = true;
|
|
};
|
|
};
|
|
|
|
imports = [ ./module.nix ];
|
|
};
|
|
|
|
legacyPackages = mapAttrs (system: platform:
|
|
import nixpkgs {
|
|
localSystem = system;
|
|
crossSystem = platform;
|
|
overlays = [ self.overlays.default ];
|
|
config = self.lib.replaceConfig // {
|
|
allowUnsupportedSystem = true;
|
|
};
|
|
}) platforms;
|
|
|
|
nixosConfigurations = mapAttrs (system: platform: lib.nixosSystem {
|
|
modules = [
|
|
self.nixosModules.default
|
|
./nixos.nix {
|
|
nixpkgs.buildPlatform = system;
|
|
nixpkgs.hostPlatform = platform;
|
|
}
|
|
];
|
|
}) platforms;
|
|
|
|
hydraJobs = {
|
|
stdenv = mapAttrs (system: pkgs: pkgs.stdenv) self.legacyPackages;
|
|
nixos = mapAttrs (system: host: host.config.system.build.toplevel) self.nixosConfigurations;
|
|
pkgs = mapAttrs (system: pkgs: {
|
|
inherit (pkgs) rustc;
|
|
}) self.legacyPackages;
|
|
};
|
|
};
|
|
}
|