normalize the base kernel config nixpkgs applies for each host
This commit is contained in:
@@ -2,4 +2,6 @@
|
|||||||
let
|
let
|
||||||
sane-nix-files = import ./pkgs/by-name/sane-nix-files/package.nix { };
|
sane-nix-files = import ./pkgs/by-name/sane-nix-files/package.nix { };
|
||||||
in
|
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.
|
# race conditions or eval failures.
|
||||||
#
|
#
|
||||||
# see default.nix for a wrapper around this with better purity guarantees.
|
# see default.nix for a wrapper around this with better purity guarantees.
|
||||||
{ }:
|
{ localSystem }:
|
||||||
let
|
let
|
||||||
mkPkgs = branch: args: (
|
mkPkgs = branch: args: (
|
||||||
(import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix {}).override args
|
(import ./pkgs/by-name/nixpkgs-bootstrap/${branch}.nix {}).override args
|
||||||
@@ -12,9 +12,9 @@ let
|
|||||||
pkgs = mkPkgs "master" {};
|
pkgs = mkPkgs "master" {};
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
evalHost = { name, system, branch ? "master", variant ? null }:
|
evalHost = { name, localSystem, system, branch ? "master", variant ? null }:
|
||||||
let
|
let
|
||||||
pkgs = mkPkgs branch { inherit system; };
|
pkgs = mkPkgs branch { inherit localSystem system; };
|
||||||
in pkgs.nixos [
|
in pkgs.nixos [
|
||||||
(import ./hosts/instantiate.nix { hostName = name; inherit variant; })
|
(import ./hosts/instantiate.nix { hostName = name; inherit variant; })
|
||||||
(import ./modules)
|
(import ./modules)
|
||||||
@@ -49,19 +49,53 @@ let
|
|||||||
"${args.name}-min-staging" = mkFlavoredHost (args // { variant = "min"; branch = "staging"; });
|
"${args.name}-min-staging" = mkFlavoredHost (args // { variant = "min"; branch = "staging"; });
|
||||||
};
|
};
|
||||||
|
|
||||||
hosts = builtins.foldl' (acc: host: acc // mkHost host) {} [
|
# this exists to unify my kernel configs across different platforms.
|
||||||
# real hosts:
|
# ordinarily, certain kernel config options are derived by nixpkgs using the `system` parameter,
|
||||||
{ name = "crappy"; system = "armv7l-linux"; }
|
# via <repo:nixos/nixpkgs:lib/systems/platforms.nix>.
|
||||||
{ name = "desko"; system = "x86_64-linux"; }
|
# but i want these a little more normalized, which is possible either here, or
|
||||||
{ name = "lappy"; system = "x86_64-linux"; }
|
# by assigning `boot.kernelPackages`.
|
||||||
{ name = "moby"; system = "aarch64-linux"; }
|
#
|
||||||
{ name = "servo"; system = "x86_64-linux"; }
|
# 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"; }
|
hosts = builtins.foldl'
|
||||||
# pseudo hosts used for debugging
|
# XXX: i `elaborate` localSystem the same as i do `system` because otherwise nixpkgs
|
||||||
{ name = "baseline-x86_64"; system = "x86_64-linux"; }
|
# sees they're (slightly) different and forces everything down the (expensive) cross-compilation path.
|
||||||
{ name = "baseline-aarch64"; system = "aarch64-linux"; }
|
(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 ]
|
# subAttrNames :: AttrSet -> [ String ]
|
||||||
# returns the names of all items in `attrs` which are themselves attrsets.
|
# returns the names of all items in `attrs` which are themselves attrsets.
|
||||||
|
Reference in New Issue
Block a user