idiosyn/flake.nix
2024-07-25 00:29:25 +02:00

71 lines
2.1 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
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, rust-overlay, ... }@inputs:
let
inherit (builtins) mapAttrs;
inherit (nixpkgs) lib;
platforms = mapAttrs
(name: platform: lib.systems.elaborate platform)
(import ./platforms.nix);
in {
lib = { inherit platforms; };
overlays.default = import ./overlay.nix inputs;
nixosModules.default = { ... }: {
nixpkgs = {
overlays = [ self.overlays.default rust-overlay.overlays.default ];
config = {
allowUnsupportedSystem = true;
replaceStdenv =
{ pkgs }: pkgs.idiosyn pkgs.stdenv;
replaceCrossStdenv =
{ buildPackages, baseStdenv }: buildPackages.idiosyn baseStdenv;
};
};
imports = [ ./module.nix ];
};
legacyPackages = mapAttrs (system: platform:
import nixpkgs {
localSystem = builtins.currentSystem or system;
crossSystem = platform;
overlays = [ self.overlays.default rust-overlay.overlays.default ];
config = {
allowUnsupportedSystem = true;
replaceStdenv =
{ pkgs }: pkgs.idiosyn pkgs.stdenv;
replaceCrossStdenv =
{ buildPackages, baseStdenv }: buildPackages.idiosyn baseStdenv;
};
}) platforms;
nixosConfigurations = mapAttrs (system: platform: lib.nixosSystem {
modules = [
self.nixosModules.default
./nixos.nix {
nixpkgs.buildPlatform = builtins.currentSystem or system;
nixpkgs.hostPlatform = platform;
}
];
}) platforms;
hydraJobs = {
stdenv = mapAttrs (system: pkgs: pkgs.stdenv) self.legacyPackages;
nixos = mapAttrs (name: host: host.config.system.build.toplevel) self.nixosConfigurations;
};
};
}