mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-08 19:46:10 +01:00
Merge 350fd669eb into 2379bc4099
This commit is contained in:
commit
f149f88667
10 changed files with 184 additions and 80 deletions
|
|
@ -1,3 +1,7 @@
|
|||
# This file is necessary so nix-env -qa does not break,
|
||||
# when nixos-hardware is used as a channel
|
||||
{ }
|
||||
{ pkgs }:
|
||||
import ./toplevel.nix {
|
||||
fn = p: pkgs.callPackages "${builtins.toString p}/all.nix";
|
||||
inherit (pkgs) lib;
|
||||
}
|
||||
|
|
|
|||
21
flake.lock
generated
21
flake.lock
generated
|
|
@ -1,6 +1,25 @@
|
|||
{
|
||||
"nodes": {
|
||||
"root": {}
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1757163567,
|
||||
"narHash": "sha256-uKMQbZmAr6R2tQ/4YpON6ZR00Z0alKeJdAyMHR8n47U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "413fda74348e993e19c01f9bb23f933abcb071bf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
|
|
|
|||
19
flake.nix
19
flake.nix
|
|
@ -1,10 +1,27 @@
|
|||
{
|
||||
description = "nixos-hardware";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
|
||||
outputs =
|
||||
{ ... }:
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
inherit (nixpkgs.lib)
|
||||
genAttrs
|
||||
;
|
||||
|
||||
eachSystem = genAttrs [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
in
|
||||
{
|
||||
|
||||
hydraJobs = import ./jobs.nix nixpkgs;
|
||||
|
||||
packages = eachSystem (system: import ./. { pkgs = nixpkgs.legacyPackages.${system}; });
|
||||
|
||||
nixosModules =
|
||||
let
|
||||
deprecated =
|
||||
|
|
|
|||
6
jobs.nix
Normal file
6
jobs.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
nixpkgs:
|
||||
import ./toplevel.nix {
|
||||
fn = p: import "${builtins.toString p}/jobs.nix";
|
||||
args = nixpkgs;
|
||||
inherit (nixpkgs) lib;
|
||||
}
|
||||
|
|
@ -10,85 +10,10 @@ let
|
|||
mkDefault
|
||||
mkOption
|
||||
types
|
||||
versions
|
||||
;
|
||||
|
||||
# Set the version and hash for the kernel sources
|
||||
srcVersion =
|
||||
with config.hardware.microsoft-surface;
|
||||
if kernelVersion == "longterm" then
|
||||
"6.12.19"
|
||||
else if kernelVersion == "stable" then
|
||||
"6.15.9"
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
srcHash =
|
||||
with config.hardware.microsoft-surface;
|
||||
if kernelVersion == "longterm" then
|
||||
"sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE="
|
||||
else if kernelVersion == "stable" then
|
||||
"sha256-6U86+FSSMC96gZRBRY+AvKCtmRLlpMg8aZ/zxjxSlX0="
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
# Set the version and hash for the linux-surface releases
|
||||
pkgVersion =
|
||||
with config.hardware.microsoft-surface;
|
||||
if kernelVersion == "longterm" then
|
||||
"6.12.7"
|
||||
else if kernelVersion == "stable" then
|
||||
"6.15.3"
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
pkgHash =
|
||||
with config.hardware.microsoft-surface;
|
||||
if kernelVersion == "longterm" then
|
||||
"sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="
|
||||
else if kernelVersion == "stable" then
|
||||
"sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk="
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
# Fetch the linux-surface package
|
||||
repos =
|
||||
pkgs.callPackage
|
||||
(
|
||||
{
|
||||
fetchFromGitHub,
|
||||
rev,
|
||||
hash,
|
||||
}:
|
||||
{
|
||||
linux-surface = fetchFromGitHub {
|
||||
owner = "linux-surface";
|
||||
repo = "linux-surface";
|
||||
rev = rev;
|
||||
hash = hash;
|
||||
};
|
||||
}
|
||||
)
|
||||
{
|
||||
hash = pkgHash;
|
||||
rev = "arch-${pkgVersion}-1";
|
||||
};
|
||||
|
||||
# Fetch and build the kernel package
|
||||
inherit (pkgs.callPackage ./kernel/linux-package.nix { inherit repos; })
|
||||
linuxPackage
|
||||
surfacePatches
|
||||
;
|
||||
kernelPatches = surfacePatches {
|
||||
version = pkgVersion;
|
||||
patchFn = ./kernel/${versions.majorMinor pkgVersion}/patches.nix;
|
||||
patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor pkgVersion}");
|
||||
};
|
||||
kernelPackages = linuxPackage {
|
||||
inherit kernelPatches;
|
||||
version = srcVersion;
|
||||
sha256 = srcHash;
|
||||
ignoreConfigErrors = true;
|
||||
kernelPackages = pkgs.callPackage ../pkgs/kernel {
|
||||
inherit (config.hardware.microsoft-surface) kernelVersion;
|
||||
};
|
||||
|
||||
in
|
||||
|
|
|
|||
12
microsoft/surface/pkgs/all.nix
Normal file
12
microsoft/surface/pkgs/all.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
callPackages,
|
||||
}:
|
||||
let
|
||||
pkgs = callPackages ./. { };
|
||||
in
|
||||
lib.optionalAttrs (stdenv.hostPlatform.isx86_64) {
|
||||
kernel-stable = pkgs.kernel-stable.kernel;
|
||||
kernel-longterm = pkgs.kernel-longterm.kernel;
|
||||
}
|
||||
10
microsoft/surface/pkgs/default.nix
Normal file
10
microsoft/surface/pkgs/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ callPackage }:
|
||||
{
|
||||
kernel-stable = callPackage ./kernel {
|
||||
kernelVersion = "stable";
|
||||
};
|
||||
|
||||
kernel-longterm = callPackage ./kernel {
|
||||
kernelVersion = "longterm";
|
||||
};
|
||||
}
|
||||
8
microsoft/surface/pkgs/jobs.nix
Normal file
8
microsoft/surface/pkgs/jobs.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
nixpkgs:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux.callPackages ./. { };
|
||||
in
|
||||
{
|
||||
kernel-stable.x86_64-linux = nixpkgs.lib.hydraJob pkgs.kernel-stable.kernel;
|
||||
kernel-longterm.x86_64-linux = nixpkgs.lib.hydraJob pkgs.kernel-longterm.kernel;
|
||||
}
|
||||
83
microsoft/surface/pkgs/kernel/default.nix
Normal file
83
microsoft/surface/pkgs/kernel/default.nix
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
lib,
|
||||
kernelVersion,
|
||||
callPackage,
|
||||
}:
|
||||
let
|
||||
inherit (lib) versions;
|
||||
|
||||
# Set the version and hash for the kernel sources
|
||||
srcVersion =
|
||||
if kernelVersion == "longterm" then
|
||||
"6.12.19"
|
||||
else if kernelVersion == "stable" then
|
||||
"6.15.9"
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
srcHash =
|
||||
if kernelVersion == "longterm" then
|
||||
"sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE="
|
||||
else if kernelVersion == "stable" then
|
||||
"sha256-6U86+FSSMC96gZRBRY+AvKCtmRLlpMg8aZ/zxjxSlX0="
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
# Set the version and hash for the linux-surface releases
|
||||
pkgVersion =
|
||||
if kernelVersion == "longterm" then
|
||||
"6.12.7"
|
||||
else if kernelVersion == "stable" then
|
||||
"6.15.3"
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
pkgHash =
|
||||
if kernelVersion == "longterm" then
|
||||
"sha256-Pv7O8D8ma+MPLhYP3HSGQki+Yczp8b7d63qMb6l4+mY="
|
||||
else if kernelVersion == "stable" then
|
||||
"sha256-ozvYrZDiVtMkdCcVnNEdlF2Kdw4jivW0aMJrDynN3Hk="
|
||||
else
|
||||
abort "Invalid kernel version: ${kernelVersion}";
|
||||
|
||||
# Fetch the linux-surface package
|
||||
repos =
|
||||
callPackage
|
||||
(
|
||||
{
|
||||
fetchFromGitHub,
|
||||
rev,
|
||||
hash,
|
||||
}:
|
||||
{
|
||||
linux-surface = fetchFromGitHub {
|
||||
owner = "linux-surface";
|
||||
repo = "linux-surface";
|
||||
rev = rev;
|
||||
hash = hash;
|
||||
};
|
||||
}
|
||||
)
|
||||
{
|
||||
hash = pkgHash;
|
||||
rev = "arch-${pkgVersion}-1";
|
||||
};
|
||||
|
||||
# Fetch and build the kernel package
|
||||
inherit (callPackage ../../common/kernel/linux-package.nix { inherit repos; })
|
||||
linuxPackage
|
||||
surfacePatches
|
||||
;
|
||||
|
||||
kernelPatches = surfacePatches {
|
||||
version = pkgVersion;
|
||||
patchFn = ../../common/kernel/${versions.majorMinor pkgVersion}/patches.nix;
|
||||
patchSrc = (repos.linux-surface + "/patches/${versions.majorMinor pkgVersion}");
|
||||
};
|
||||
in
|
||||
linuxPackage {
|
||||
inherit kernelPatches;
|
||||
version = srcVersion;
|
||||
sha256 = srcHash;
|
||||
ignoreConfigErrors = true;
|
||||
}
|
||||
20
toplevel.nix
Normal file
20
toplevel.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
lib,
|
||||
fn ? p: import p,
|
||||
args ? { },
|
||||
}:
|
||||
let
|
||||
pkgs = builtins.mapAttrs (_name: p: fn p args) {
|
||||
microsoft-surface = ./microsoft/surface/pkgs;
|
||||
};
|
||||
in
|
||||
lib.foldAttrs (item: acc: item // acc) { } (
|
||||
lib.flatten (
|
||||
lib.attrValues (
|
||||
lib.mapAttrs (
|
||||
toplevelName: jobs:
|
||||
lib.listToAttrs (lib.mapAttrsToList (name: lib.nameValuePair "${toplevelName}/${name}") jobs)
|
||||
) pkgs
|
||||
)
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue