initial commit
This commit is contained in:
commit
f5c962b566
8 changed files with 7248 additions and 0 deletions
0
README.md
Normal file
0
README.md
Normal file
79
config/common/repart.nix
Normal file
79
config/common/repart.nix
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
{
|
||||||
|
modulesPath,
|
||||||
|
crossPkgs,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
efiArch = pkgs.stdenv.hostPlatform.efiArch;
|
||||||
|
in {
|
||||||
|
imports = ["${modulesPath}/image/repart.nix"];
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
|
||||||
|
systemd.repart = {
|
||||||
|
enable = true;
|
||||||
|
partitions."03-root".Type = "root";
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd = {
|
||||||
|
supportedFilesystems.ext4 = true;
|
||||||
|
systemd = {
|
||||||
|
enable = true;
|
||||||
|
root = "gpt-auto";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-label/ESP";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
image.repart = {
|
||||||
|
name = "image";
|
||||||
|
split = true;
|
||||||
|
partitions = {
|
||||||
|
"20-esp" = {
|
||||||
|
contents = {
|
||||||
|
"/EFI/EDK2-UEFI-SHELL/SHELL.EFI".source = "${crossPkgs.edk2-uefi-shell.overrideAttrs {env.NIX_CFLAGS_COMPILE = "-Wno-error=maybe-uninitialized";}}/shell.efi";
|
||||||
|
"/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi";
|
||||||
|
"/EFI/Linux/${config.system.boot.loader.ukiFile}".source = "${config.system.build.uki}/${config.system.boot.loader.ukiFile}";
|
||||||
|
"/loader/loader.conf".source = crossPkgs.writeText "loader.conf" ''
|
||||||
|
timeout 5
|
||||||
|
console-mode keep
|
||||||
|
'';
|
||||||
|
"/loader/entries/shell.conf".source = crossPkgs.writeText "shell.conf" ''
|
||||||
|
title EDK2 UEFI Shell
|
||||||
|
efi /EFI/EDK2-UEFI-SHELL/SHELL.EFI
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
repartConfig = {
|
||||||
|
Type = "esp";
|
||||||
|
Label = "ESP";
|
||||||
|
Format = "vfat";
|
||||||
|
SplitName = "system";
|
||||||
|
SizeMinBytes = "500M";
|
||||||
|
GrowFileSystem = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"30-root" = {
|
||||||
|
storePaths = [config.system.build.toplevel];
|
||||||
|
contents."/boot".source = crossPkgs.runCommand "boot" {} "mkdir $out";
|
||||||
|
repartConfig = {
|
||||||
|
Type = "root";
|
||||||
|
Format = "ext4";
|
||||||
|
Label = "nixos";
|
||||||
|
Minimize = "guess";
|
||||||
|
SplitName = "userdata";
|
||||||
|
GrowFileSystem = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
1
config/sdm845/default.nix
Normal file
1
config/sdm845/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{imports = [./kernel.nix];}
|
7034
config/sdm845/kernel-config.nix
Normal file
7034
config/sdm845/kernel-config.nix
Normal file
File diff suppressed because it is too large
Load diff
83
config/sdm845/kernel.nix
Normal file
83
config/sdm845/kernel.nix
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
# Based on https://github.com/linyinfeng/dotfiles/blob/ff3e52e30fcc27b8119792aee9b3afe9ce4739b6/nixos/profiles/boot/kernel/sdm845-mainline/default.nix, thank you!
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
tag = "sdm845-6.16-rc2-4";
|
||||||
|
hash = "sha256-Nu7BwSl40Ytm7nCzyctNed7nqwq7NcVVxHLF3KFMKC4=";
|
||||||
|
version = lib.elemAt (lib.strings.match "sdm845-([0-9\\.]+(-rc[0-9]+)?)(-[a-zA-Z0-9\\-]+)?" tag) 0;
|
||||||
|
major = lib.versions.major version;
|
||||||
|
minor = lib.versions.minor version;
|
||||||
|
inherit (lib.kernel) yes module;
|
||||||
|
structuredExtraConfig =
|
||||||
|
import ../lib/adjust-standalone-config.nix (import ./_config.nix {inherit lib;})
|
||||||
|
// {
|
||||||
|
# for envfs
|
||||||
|
EROFS_FS = yes;
|
||||||
|
NET_9P = module;
|
||||||
|
CONFIG_NET_9P_VIRTIO = module;
|
||||||
|
"9P_FS" = module;
|
||||||
|
# other
|
||||||
|
RUST = yes;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
#
|
||||||
|
passthru.kernel = {
|
||||||
|
conf2nix = inputs.conf2nix.lib.conf2nix {
|
||||||
|
configFile = "${inputs.pmaports}/device/community/linux-postmarketos-qcom-sdm845/config-postmarketos-qcom-sdm845.aarch64";
|
||||||
|
inherit (config.boot.kernelPackages) kernel;
|
||||||
|
preset = "standalone";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
boot = {
|
||||||
|
kernelPackages = let
|
||||||
|
linux_sdm845_fn = {
|
||||||
|
buildLinux,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
buildLinux (
|
||||||
|
args
|
||||||
|
// {
|
||||||
|
inherit version;
|
||||||
|
modDirVersion = "${lib.versions.pad 3 version}-sdm845";
|
||||||
|
extraMeta.branch = lib.versions.majorMinor version;
|
||||||
|
src = pkgs.fetchFromGitLab {
|
||||||
|
owner = "sdm845-mainline";
|
||||||
|
repo = "linux";
|
||||||
|
rev = tag;
|
||||||
|
inherit hash;
|
||||||
|
};
|
||||||
|
defconfig = "defconfig sdm845.config";
|
||||||
|
enableCommonConfig = false;
|
||||||
|
autoModules = false;
|
||||||
|
inherit structuredExtraConfig;
|
||||||
|
|
||||||
|
stdenv = let
|
||||||
|
originalPlatform = pkgs.stdenv.hostPlatform;
|
||||||
|
hostPlatform = assert pkgs.stdenv.hostPlatform.isAarch64;
|
||||||
|
originalPlatform
|
||||||
|
// {
|
||||||
|
linux-kernel =
|
||||||
|
originalPlatform.linux-kernel
|
||||||
|
// {
|
||||||
|
extraConfig = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.stdenv // {inherit hostPlatform;};
|
||||||
|
}
|
||||||
|
// (args.argsOverride or {})
|
||||||
|
);
|
||||||
|
linux_sdm845 = pkgs.callPackage linux_sdm845_fn {
|
||||||
|
kernelPatches = lib.filter (p: !(lib.elem p.name [])) (
|
||||||
|
pkgs."linuxPackages_${major}_${minor}".kernel.kernelPatches or []
|
||||||
|
);
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_sdm845);
|
||||||
|
};
|
||||||
|
}
|
41
flake.nix
Executable file
41
flake.nix
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
gnome-mobile.url = "github:chuangzhu/nixpkgs-gnome-mobile";
|
||||||
|
disko = {
|
||||||
|
url = "github:nix-community/disko";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
conf2nix = {
|
||||||
|
url = "github:linyinfeng/conf2nix";
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
pmaports = {
|
||||||
|
url = "gitlab:postmarketOS/pmaports?host=gitlab.postmarketos.org";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs:
|
||||||
|
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
|
systems = ["x86_64-linux" "aarch64-linux"];
|
||||||
|
perSystem = {
|
||||||
|
lib,
|
||||||
|
self',
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
_module.args.pkgs = import inputs.nixpkgs {inherit system;};
|
||||||
|
packages = import inputs.nixpkgs {
|
||||||
|
hostPlatform = system;
|
||||||
|
localSystem = system;
|
||||||
|
buildPlatform = "x86_64-linux";
|
||||||
|
|
||||||
|
overlays = [inputs.gnome-mobile.overlays.default];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
flake.nixosModules.default = import ./module.nix;
|
||||||
|
};
|
||||||
|
}
|
9
lib/adjust-standalone-config.nix
Normal file
9
lib/adjust-standalone-config.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Taken from https://github.com/linyinfeng/kukui-nixos/blob/53027913fffd5bf48382bbcec6217d0352dc7278/lib/adjust-standalone-config.nix, thank you!
|
||||||
|
{lib}: config:
|
||||||
|
lib.mapAttrs (
|
||||||
|
_: value:
|
||||||
|
if (value.tristate or null) == "y"
|
||||||
|
then lib.mkOverride 90 value
|
||||||
|
else lib.mkOverride 110 value
|
||||||
|
)
|
||||||
|
config
|
1
module.nix
Normal file
1
module.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}: {}
|
Loading…
Add table
Add a link
Reference in a new issue