mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 02:09:26 +08:00
init aarch64 support
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
inputs:
|
||||||
|
{
|
||||||
|
config =
|
||||||
|
{
|
||||||
|
nixos =
|
||||||
|
{
|
||||||
|
model.arch = "aarch64";
|
||||||
|
system =
|
||||||
|
{
|
||||||
|
fileSystems =
|
||||||
|
{
|
||||||
|
mount.btrfs."/dev/disk/by-partlabel/r2s-root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||||
|
swap = [ "/nix/swap/swap" ];
|
||||||
|
};
|
||||||
|
network = {};
|
||||||
|
};
|
||||||
|
services =
|
||||||
|
{
|
||||||
|
sshd = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# inputs = { lib, topInputs, ...}; nixpkgs = { march, cuda, nixRoot, nixos };
|
# inputs = { lib, topInputs, ...}; nixpkgs = { march, cuda, nixRoot, nixos, arch };
|
||||||
{ inputs, nixpkgs }:
|
{ inputs, nixpkgs }:
|
||||||
let
|
let
|
||||||
platformConfig =
|
platformConfig =
|
||||||
if nixpkgs.march == null then { system = "x86_64-linux"; }
|
if nixpkgs.march == null then { system = "${nixpkgs.arch or "x86_64"}-linux"; }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
${if nixpkgs.nixos then "hostPlatform" else "localSystem"} =
|
${if nixpkgs.nixos then "hostPlatform" else "localSystem"} =
|
||||||
{ system = "x86_64-linux"; gcc = { arch = nixpkgs.march; tune = nixpkgs.march; }; };
|
{ system = "${nixpkgs.arch or "x86_64"}-linux"; gcc = { arch = nixpkgs.march; tune = nixpkgs.march; }; };
|
||||||
};
|
};
|
||||||
cudaConfig = inputs.lib.optionalAttrs (nixpkgs.cuda != null)
|
cudaConfig = inputs.lib.optionalAttrs (nixpkgs.cuda != null)
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
let
|
let
|
||||||
singles = [ "nas" "pc" "vps4" "vps6" "one" "srv3" ];
|
singles = [ "nas" "pc" "vps4" "vps6" "one" "srv3" ];
|
||||||
cluster = { srv1 = 3; srv2 = 2; };
|
cluster = { srv1 = 3; srv2 = 2; };
|
||||||
arch.r2s = "aarch64";
|
|
||||||
deviceModules = builtins.listToAttrs
|
deviceModules = builtins.listToAttrs
|
||||||
(
|
(
|
||||||
(builtins.map
|
(builtins.map
|
||||||
@@ -28,7 +27,7 @@ let
|
|||||||
in builtins.mapAttrs
|
in builtins.mapAttrs
|
||||||
(n: v: inputs.nixpkgs.lib.nixosSystem
|
(n: v: inputs.nixpkgs.lib.nixosSystem
|
||||||
{
|
{
|
||||||
system = "${arch.${n} or "x86_64"}-linux";
|
system = null;
|
||||||
specialArgs = { topInputs = inputs; inherit localLib; };
|
specialArgs = { topInputs = inputs; inherit localLib; };
|
||||||
modules = localLib.mkModules v;
|
modules = localLib.mkModules v;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ inputs:
|
|||||||
options.nixos.model = let inherit (inputs.lib) mkOption types; in
|
options.nixos.model = let inherit (inputs.lib) mkOption types; in
|
||||||
{
|
{
|
||||||
hostname = mkOption { type = types.nonEmptyStr; };
|
hostname = mkOption { type = types.nonEmptyStr; };
|
||||||
|
arch = mkOption { type = types.nonEmptyStr; default = "x86_64"; };
|
||||||
type = mkOption { type = types.enum [ "minimal" "desktop" "server" ]; default = "minimal"; };
|
type = mkOption { type = types.enum [ "minimal" "desktop" "server" ]; default = "minimal"; };
|
||||||
private = mkOption { type = types.bool; default = false; };
|
private = mkOption { type = types.bool; default = false; };
|
||||||
cluster = mkOption
|
cluster = mkOption
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ inputs:
|
|||||||
config = let inherit (inputs.config.nixos.system) nixpkgs; in
|
config = let inherit (inputs.config.nixos.system) nixpkgs; in
|
||||||
{
|
{
|
||||||
nixpkgs = inputs.localLib.buildNixpkgsConfig
|
nixpkgs = inputs.localLib.buildNixpkgsConfig
|
||||||
{ inherit inputs; nixpkgs = nixpkgs // { nixRoot = null; nixos = true; }; };
|
{
|
||||||
|
inherit inputs;
|
||||||
|
nixpkgs = nixpkgs // { nixRoot = null; nixos = true; inherit (inputs.config.nixos.model) arch; };
|
||||||
|
};
|
||||||
boot.kernelPatches = inputs.lib.mkIf (nixpkgs.march != null)
|
boot.kernelPatches = inputs.lib.mkIf (nixpkgs.march != null)
|
||||||
[{
|
[{
|
||||||
name = "native kernel";
|
name = "native kernel";
|
||||||
|
|||||||
Reference in New Issue
Block a user