neoidiosyn/flake.nix
2024-11-20 14:47:25 +01:00

106 lines
2.6 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 = "riscv64-unknown-linux-gnu";
aarch64-linux = "aarch64-unknown-linux-musl";
x86_64-linux = "x86_64-unknown-linux-musl";
}.${system};
inherit crossSystem;
overlays = [ self.overlays.default ];
};
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.mapAttrs (system: pkgs: lib.genAttrs [
"clang"
"dbus-broker"
"ffmpeg"
"jaq"
"kitty"
"lix"
"lld"
"musl"
"nftables"
"nushell"
"openssh"
"pipewire"
"python3"
"ripgrep"
"rustc"
"sd"
"stdenv"
"sudo-rs"
"systemd"
"wayland"
] (pkg: pkgs.${pkg})) self.legacyPackages;
};
}