eosyn/flake.nix
2024-11-23 16:22:17 +01:00

110 lines
2.7 KiB
Nix

{
description = "I do not have to explain myself";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
lix = {
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
flake = false;
};
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
inputs.lix.follows = "lix";
};
};
nixConfig = {
extra-experimental-features = [ "pipe-operator" "pipe-operators" ];
extra-substituters = [ "https://cache.kyouma.net" ];
extra-trusted-public-keys = [ "cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg=" ];
};
outputs = { self, nixpkgs, lix-module, ... }: let
lib = nixpkgs.lib.extend (final: prev: {
neoidiosyn = {
systems = {
riscv64 = "rv64gc";
aarch64 = "armv8.2-a";
x86_64 = "x86-64-v3";
} |> final.mapAttrs' (cpu: arch: {
name = "${cpu}-linux";
value = {
config = "${cpu}-unknown-linux-musl";
useLLVM = true;
linker = "lld";
gcc = { inherit arch; };
};
});
};
});
in {
inherit lib;
overlays.default = lib.composeExtensions
lix-module.overlays.default
(import ./overlay.nix { inherit lib; });
legacyPackages = lib.neoidiosyn.systems
|> lib.mapAttrs (system: crossSystem: let
pkgs = import nixpkgs {
localSystem.config = {
riscv64-linux = "x86_64-unknown-linux-musl";
aarch64-linux = "aarch64-unknown-linux-musl";
x86_64-linux = "x86_64-unknown-linux-musl";
}.${system};
inherit crossSystem;
overlays = [ self.overlays.default ];
config = {
allowBroken = true;
allowUnsupportedSystem = true;
};
};
in pkgs // {
config = let
stdenv = import ./stdenv.nix { inherit lib pkgs; };
in pkgs.config or { } // {
replaceStdenv = stdenv;
replaceCrossStdenv = stdenv;
};
});
nixosModules = {
default = import ./module.nix;
} // lib.mapAttrs (system: pkgs: {
nixpkgs = {
inherit (pkgs)
buildPlatform
hostPlatform
overlays
config;
};
}) self.legacyPackages;
hydraJobs = lib.genAttrs [
"stdenv"
"dbus-broker"
"electron"
"ffmpeg"
"jaq"
"mesa"
"mimalloc"
"nushell"
"openssh"
"pipewire"
"python3"
"rustc"
"sqlite"
"sudo-rs"
"systemd"
"wayland"
"zlib"
] (name: lib.mapAttrs (system: pkgs: lib.hydraJob pkgs.${name}) self.legacyPackages);
};
}