normalize the base kernel config nixpkgs applies for each host
This commit is contained in:
@@ -2,4 +2,6 @@
|
||||
let
|
||||
sane-nix-files = import ./pkgs/by-name/sane-nix-files/package.nix { };
|
||||
in
|
||||
import "${sane-nix-files}/impure.nix" args
|
||||
import "${sane-nix-files}/impure.nix" ({
|
||||
localSystem = builtins.currentSystem;
|
||||
} // args)
|
||||
|
64
impure.nix
64
impure.nix
@@ -4,7 +4,7 @@
|
||||
# race conditions or eval failures.
|
||||
#
|
||||
# see default.nix for a wrapper around this with better purity guarantees.
|
||||
{ }:
|
||||
{ localSystem }:
|
||||
let
|
||||
mkPkgs = branch: args: (
|
||||
(import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix {}).override args
|
||||
@@ -12,9 +12,9 @@ let
|
||||
pkgs = mkPkgs "master" {};
|
||||
inherit (pkgs) lib;
|
||||
|
||||
evalHost = { name, system, branch ? "master", variant ? null }:
|
||||
evalHost = { name, localSystem, system, branch ? "master", variant ? null }:
|
||||
let
|
||||
pkgs = mkPkgs branch { inherit system; };
|
||||
pkgs = mkPkgs branch { inherit localSystem system; };
|
||||
in pkgs.nixos [
|
||||
(import ./hosts/instantiate.nix { hostName = name; inherit variant; })
|
||||
(import ./modules)
|
||||
@@ -49,19 +49,53 @@ let
|
||||
"${args.name}-min-staging" = mkFlavoredHost (args // { variant = "min"; branch = "staging"; });
|
||||
};
|
||||
|
||||
hosts = builtins.foldl' (acc: host: acc // mkHost host) {} [
|
||||
# real hosts:
|
||||
{ name = "crappy"; system = "armv7l-linux"; }
|
||||
{ name = "desko"; system = "x86_64-linux"; }
|
||||
{ name = "lappy"; system = "x86_64-linux"; }
|
||||
{ name = "moby"; system = "aarch64-linux"; }
|
||||
{ name = "servo"; system = "x86_64-linux"; }
|
||||
# this exists to unify my kernel configs across different platforms.
|
||||
# ordinarily, certain kernel config options are derived by nixpkgs using the `system` parameter,
|
||||
# via <repo:nixos/nixpkgs:lib/systems/platforms.nix>.
|
||||
# but i want these a little more normalized, which is possible either here, or
|
||||
# by assigning `boot.kernelPackages`.
|
||||
#
|
||||
# TODO: maybe just call `lib.platforms.elaborate`, and patch whatever i care about on top that?
|
||||
elaborate = system: {
|
||||
inherit system;
|
||||
linux-kernel.name = "unknown"; #< i'm 90% sure this doesn't impact anything
|
||||
linux-kernel.baseConfig = "defconfig";
|
||||
linux-kernel.DTB = system != "x86_64-linux"; #< x86_64 doesn't even know how to compile device trees
|
||||
linux-kernel.autoModules = true;
|
||||
# build all features as modules where possible, especially because
|
||||
# 1. some bootloaders fail on large payloads and this allows the kernel/initrd to be smaller.
|
||||
# 2. building as module means i can override that module very cheaply as i develop.
|
||||
linux-kernel.preferBuiltin = false;
|
||||
# `target` support matrix:
|
||||
# Image: aarch64:yes (nixpkgs defaule) x86_64:no
|
||||
# Image.gz: aarch64:yes, if capable bootloader x86_64:no
|
||||
# zImage aarch64:no x86_64:yes
|
||||
# bzImage aarch64:no x86_64:yes (nixpkgs default)
|
||||
# vmlinux aarch64:? x86_64:no?
|
||||
# vmlinuz aarch64:? x86_64:?
|
||||
# uImage aarch64:bootloader? x86_64:probably not
|
||||
linux-kernel.target = if system == "x86_64-linux" then "bzImage" else "Image";
|
||||
};
|
||||
# elaborate = system: system;
|
||||
|
||||
{ name = "rescue"; system = "x86_64-linux"; }
|
||||
# pseudo hosts used for debugging
|
||||
{ name = "baseline-x86_64"; system = "x86_64-linux"; }
|
||||
{ name = "baseline-aarch64"; system = "aarch64-linux"; }
|
||||
];
|
||||
hosts = builtins.foldl'
|
||||
# XXX: i `elaborate` localSystem the same as i do `system` because otherwise nixpkgs
|
||||
# sees they're (slightly) different and forces everything down the (expensive) cross-compilation path.
|
||||
(acc: host: acc // mkHost ({ localSystem = elaborate localSystem; } // host))
|
||||
{}
|
||||
[
|
||||
# real hosts:
|
||||
# { name = "crappy"; system = "armv7l-linux"; }
|
||||
{ name = "desko"; system = elaborate "x86_64-linux"; }
|
||||
{ name = "lappy"; system = elaborate "x86_64-linux"; }
|
||||
{ name = "moby"; system = elaborate "aarch64-linux"; }
|
||||
{ name = "servo"; system = elaborate "x86_64-linux"; }
|
||||
|
||||
{ name = "rescue"; system = elaborate "x86_64-linux"; }
|
||||
# pseudo hosts used for debugging
|
||||
{ name = "baseline-x86_64"; system = elaborate "x86_64-linux"; }
|
||||
{ name = "baseline-aarch64"; system = elaborate "aarch64-linux"; }
|
||||
];
|
||||
|
||||
# subAttrNames :: AttrSet -> [ String ]
|
||||
# returns the names of all items in `attrs` which are themselves attrsets.
|
||||
|
Reference in New Issue
Block a user