Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
6 changes: 6 additions & 0 deletions jobs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nixpkgs:
import ./toplevel.nix {
fn = p: import "${builtins.toString p}/jobs.nix";
args = nixpkgs;
inherit (nixpkgs) lib;
}
79 changes: 2 additions & 77 deletions microsoft/surface/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions microsoft/surface/pkgs/all.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions microsoft/surface/pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ callPackage }:
{
kernel-stable = callPackage ./kernel {
kernelVersion = "stable";
};

kernel-longterm = callPackage ./kernel {
kernelVersion = "longterm";
};
}
8 changes: 8 additions & 0 deletions microsoft/surface/pkgs/jobs.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 83 additions & 0 deletions microsoft/surface/pkgs/kernel/default.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions toplevel.nix
Original file line number Diff line number Diff line change
@@ -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
)
)
)