Support building x86_64 ISOs

This commit is contained in:
asonix 2023-02-10 22:22:57 -06:00
parent 18257bffed
commit 6583702e8c
3 changed files with 75 additions and 7 deletions

View file

@ -1,5 +1,41 @@
{
"nodes": {
"nixlib": {
"locked": {
"lastModified": 1636849918,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1674666581,
"narHash": "sha256-KNI2s/xrL7WOYaPJAWKBtb7cCH3335rLfsL+B+ssuGY=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "6a5dc1d3d557ea7b5c19b15ff91955124d0400fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1675454231,
@ -18,6 +54,7 @@
},
"root": {
"inputs": {
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs"
}
}

View file

@ -4,9 +4,13 @@
# pin this to unstable
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs }:
outputs = { self, nixpkgs, nixos-generators }:
let
pkgs = import nixpkgs {
system = "x86_64-linux";
@ -53,6 +57,19 @@
];
};
x86_64-system = pkgs.callPackage ./pkgs/system {
inherit nixpkgs trusted-public-keys;
extraModules = [
userModule
{
networking.hostName = "x86_64-nixos";
}
];
kernel = pkgs.linuxKernel.packageAliases.linux_latest;
};
quartzUBoots = aarch64Pkgs.callPackage ./pkgs/uboot-quartz64 { };
in
{
@ -65,6 +82,16 @@
};
packages.x86_64-linux =
{
x86_64 = nixos-generators.nixosGenerate {
inherit pkgs;
modules = [
x86_64-system.modules.baseModule
];
format = "install-iso";
};
quartz64a = rockchip {
system = system.quartz64a;
uboot = quartzUBoots.ubootQuartz64a;

View file

@ -1,7 +1,7 @@
{ nixpkgs, pkgs, kernel, authorized-keys ? [ ], trusted-public-keys ? "", extraModules ? [ ] }:
{ nixpkgs, lib, kernel, authorized-keys ? [ ], trusted-public-keys ? "", extraModules ? [ ] }:
let
buildModule = fdt: {
baseModule = {
nixpkgs.overlays = [
(final: super: {
zfs = super.zfs.overrideAttrs (_: {
@ -19,17 +19,20 @@ let
services.openssh = {
enable = true;
settings.PermitRootLogin = "prohibit-password";
settings.PermitRootLogin = lib.mkForce "prohibit-password";
};
time.timeZone = "UTC";
boot.kernelPackages = kernel;
system.stateVersion = "23.05";
};
buildModule = fdt: {
boot.kernelParams = [ "console=ttyS2,1500000n8" "rootwait" "root=PARTLABEL=nixos" "rw" ];
hardware.deviceTree.name = fdt;
system.stateVersion = "23.05";
};
buildSystem = module: nixpkgs.lib.nixosSystem {
@ -38,6 +41,7 @@ let
modules = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
module
baseModule
{
networking.hostName = "nixos-aarch64";
}
@ -45,7 +49,7 @@ let
};
modules = {
inherit buildModule;
inherit baseModule buildModule;
quartz64a = buildModule "rockchip/rk3566-quartz64-a.dtb";
quartz64b = buildModule "rockchip/rk3566-quartz64-b.dtb";