fix: formatting
This commit is contained in:
parent
15d38facce
commit
b8adc59703
31 changed files with 645 additions and 514 deletions
|
@ -1,11 +1,13 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
services.emacs =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacs; # replace with emacs-gtk, or a version provided by the community overlay if desired.
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver.enable = true;
|
||||
|
||||
|
||||
# Configure keymap in X11
|
||||
services.xserver = {
|
||||
layout = "us";
|
||||
|
@ -21,5 +24,4 @@
|
|||
hardware.bluetooth.enable = true;
|
||||
|
||||
programs.sway.enable = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./common.nix
|
||||
];
|
||||
|
||||
|
@ -149,5 +151,4 @@
|
|||
NIXOS_XDG_OPEN_USE_PORTAL = "1";
|
||||
WLR_NO_HARDWARE_CURSOR = "1";
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
services.zerotierone = {
|
||||
joinNetworks = [
|
||||
"4e72329aec6688e3"
|
||||
];
|
||||
enable = true;
|
||||
|
||||
};
|
||||
|
||||
networking.extraHosts =
|
||||
''
|
||||
networking.extraHosts = ''
|
||||
192.168.194.109 planex.far
|
||||
192.168.194.210 farnsworth.far
|
||||
192.168.194.24 zapp.far
|
||||
|
@ -20,5 +22,4 @@
|
|||
192.168.194.38 cubert.far
|
||||
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./packages.nix
|
||||
./users.nix
|
||||
./locale.nix
|
||||
|
@ -28,5 +32,4 @@
|
|||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.11"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/Los_Angeles";
|
||||
|
||||
|
@ -19,5 +23,4 @@
|
|||
LC_TELEPHONE = "en_US.UTF-8";
|
||||
LC_TIME = "en_US.UTF-8";
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
programs.gnupg.agent = {
|
||||
|
@ -9,7 +13,6 @@
|
|||
enableSSHSupport = true;
|
||||
};
|
||||
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@ -20,5 +23,4 @@
|
|||
home-manager
|
||||
yadm
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
# Define a user account. Don't forget to set a password with 'passwd'.
|
||||
programs.zsh.enable = true;
|
||||
users.users.kdb424 = {
|
||||
|
@ -13,5 +17,4 @@
|
|||
yadm
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
30
flake.nix
30
flake.nix
|
@ -32,8 +32,12 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (self) outputs;
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
|
@ -43,22 +47,24 @@
|
|||
"x86_64-darwin"
|
||||
];
|
||||
|
||||
mkNixos = modules: nixpkgs.lib.nixosSystem {
|
||||
mkNixos = modules:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit modules;
|
||||
specialArgs = {inherit inputs outputs;};
|
||||
};
|
||||
|
||||
mkDarwin = system: modules: inputs.darwin.lib.darwinSystem {
|
||||
mkDarwin = system: modules:
|
||||
inputs.darwin.lib.darwinSystem {
|
||||
inherit modules system inputs;
|
||||
specialArgs = {inherit inputs outputs;};
|
||||
};
|
||||
|
||||
mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration {
|
||||
mkHome = modules: pkgs:
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
inherit modules pkgs;
|
||||
extraSpecialArgs = {inherit inputs outputs;};
|
||||
};
|
||||
in
|
||||
rec {
|
||||
in rec {
|
||||
# Your custom packages
|
||||
# Acessible through 'nix build', 'nix shell', etc
|
||||
#packages = forAllSystems (system:
|
||||
|
@ -67,9 +73,11 @@
|
|||
#);
|
||||
# Devshell for bootstrapping
|
||||
# Acessible through 'nix develop' or 'nix-shell' (legacy)
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in import ./shell.nix { inherit pkgs; }
|
||||
devShells = forAllSystems (
|
||||
system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
import ./shell.nix {inherit pkgs;}
|
||||
);
|
||||
|
||||
# Your custom packages and modifications, exported as overlays
|
||||
|
@ -89,7 +97,6 @@
|
|||
|
||||
# Laptop
|
||||
amy = mkNixos [./hosts/amy];
|
||||
|
||||
};
|
||||
|
||||
#darwinConfigurations = {
|
||||
|
@ -107,4 +114,3 @@
|
|||
#};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../common/nixos/common.nix
|
||||
../../common/networking/zerotier.nix
|
||||
|
@ -25,5 +29,4 @@
|
|||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
|
||||
|
@ -14,23 +18,25 @@
|
|||
boot.extraModulePackages = [];
|
||||
boot.kernelParams = ["psmouse.synaptics_intertouch=0"];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/965d7442-87cd-430b-ba33-b5022a88dda3";
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/965d7442-87cd-430b-ba33-b5022a88dda3";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."luks-4613d281-839b-483b-bb3c-6b151a43bf68".device = "/dev/disk/by-uuid/4613d281-839b-483b-bb3c-6b151a43bf68";
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/6B1C-C4A0";
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/6B1C-C4A0";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [ {
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/lib/swapfile";
|
||||
size = 8 * 1024;
|
||||
randomEncryption.enable = true;
|
||||
} ];
|
||||
}
|
||||
];
|
||||
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
{...}: {
|
||||
imports = [
|
||||
./modules/default.nix
|
||||
];
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
pkgs' = config.hardware.asahi.pkgs;
|
||||
|
||||
bootM1n1 = pkgs'.m1n1.override {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./kernel
|
||||
./mesa
|
||||
|
@ -8,8 +12,7 @@
|
|||
./sound
|
||||
];
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.hardware.asahi;
|
||||
in {
|
||||
nixpkgs.overlays = lib.mkBefore [cfg.overlay];
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
# the Asahi Linux kernel and options that must go along with it
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
config = {
|
||||
boot.kernelPackages = let
|
||||
pkgs' = config.hardware.asahi.pkgs;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
# the Asahi Linux edge config and options that must go along with it
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
config = lib.mkIf config.hardware.asahi.addEdgeKernelConfig {
|
||||
boot.kernelPatches = [
|
||||
{
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
config = let
|
||||
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver
|
||||
&& config.hardware.asahi.experimentalGPUInstallMode == mode);
|
||||
in lib.mkMerge [
|
||||
in
|
||||
lib.mkMerge [
|
||||
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
|
||||
|
||||
# install the drivers
|
||||
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
|
||||
|
||||
|
@ -16,7 +20,8 @@
|
|||
# replace the Mesa linked into system packages with the Asahi version
|
||||
# without rebuilding them to avoid rebuilding the world.
|
||||
system.replaceRuntimeDependencies = [
|
||||
{ original = pkgs.mesa;
|
||||
{
|
||||
original = pkgs.mesa;
|
||||
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
|
||||
}
|
||||
];
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
config = {
|
||||
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
|
||||
{ assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
|
||||
{
|
||||
assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
|
||||
message = ''
|
||||
Asahi peripheral firmware extraction is enabled but the firmware
|
||||
location appears incorrect.
|
||||
|
@ -45,7 +50,8 @@
|
|||
peripheralFirmwareDirectory = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
|
||||
default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null
|
||||
default =
|
||||
lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null
|
||||
[
|
||||
# path when the system is operating normally
|
||||
/boot/asahi
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.hardware.asahi = {
|
||||
setupAlsaUcm = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, alsa-ucm-conf }:
|
||||
|
||||
(alsa-ucm-conf.overrideAttrs (oldAttrs: rec {
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
alsa-ucm-conf,
|
||||
}: (alsa-ucm-conf.overrideAttrs (oldAttrs: rec {
|
||||
version = "3";
|
||||
|
||||
src_asahi = fetchFromGitHub {
|
||||
|
@ -13,7 +13,10 @@
|
|||
hash = "sha256-TCCT0AJx0SdnTzzBaV94zuD2hrPqvk+9vTTuEQmpJjc=";
|
||||
};
|
||||
|
||||
postInstall = oldAttrs.postInstall or "" + ''
|
||||
postInstall =
|
||||
oldAttrs.postInstall
|
||||
or ""
|
||||
+ ''
|
||||
cp -r ${src_asahi}/ucm2 $out/share/alsa
|
||||
'';
|
||||
}))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{ lib
|
||||
, python3
|
||||
, fetchFromGitHub
|
||||
, gzip
|
||||
, gnutar
|
||||
, lzfse
|
||||
{
|
||||
lib,
|
||||
python3,
|
||||
fetchFromGitHub,
|
||||
gzip,
|
||||
gnutar,
|
||||
lzfse,
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "asahi-fwextract";
|
||||
version = "0.6.9";
|
||||
|
|
|
@ -1,57 +1,84 @@
|
|||
{ lib
|
||||
, pkgs
|
||||
, callPackage
|
||||
, writeShellScriptBin
|
||||
, writeText
|
||||
, removeReferencesTo
|
||||
, linuxPackagesFor
|
||||
, _4KBuild ? false
|
||||
, withRust ? false
|
||||
, _kernelPatches ? [ ]
|
||||
}:
|
||||
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
callPackage,
|
||||
writeShellScriptBin,
|
||||
writeText,
|
||||
removeReferencesTo,
|
||||
linuxPackagesFor,
|
||||
_4KBuild ? false,
|
||||
withRust ? false,
|
||||
_kernelPatches ? [],
|
||||
}: let
|
||||
i = builtins.elemAt;
|
||||
|
||||
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
|
||||
# into a list of k, v tuples
|
||||
parseExtraConfig = config:
|
||||
let
|
||||
parseExtraConfig = config: let
|
||||
lines =
|
||||
builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
|
||||
parseLine = line: let
|
||||
t = lib.strings.splitString " " line;
|
||||
join = l: builtins.foldl' (a: b: "${a} ${b}")
|
||||
join = l:
|
||||
builtins.foldl' (a: b: "${a} ${b}")
|
||||
(builtins.head l) (builtins.tail l);
|
||||
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1);
|
||||
v =
|
||||
if (builtins.length t) > 2
|
||||
then join (builtins.tail t)
|
||||
else (i t 1);
|
||||
in ["CONFIG_${i t 0}" v];
|
||||
in map parseLine lines;
|
||||
in
|
||||
map parseLine lines;
|
||||
|
||||
# parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
|
||||
# style configuration as found in a patch's extraStructuredConfig into
|
||||
# a list of k, v tuples
|
||||
parseExtraStructuredConfig = config: lib.attrsets.mapAttrsToList
|
||||
(k: v: [ "CONFIG_${k}" (v.tristate or v.freeform) ] ) config;
|
||||
parseExtraStructuredConfig = config:
|
||||
lib.attrsets.mapAttrsToList
|
||||
(k: v: ["CONFIG_${k}" (v.tristate or v.freeform)])
|
||||
config;
|
||||
|
||||
parsePatchConfig = { extraConfig ? "", extraStructuredConfig ? {}, ... }:
|
||||
(parseExtraConfig extraConfig) ++
|
||||
(parseExtraStructuredConfig extraStructuredConfig);
|
||||
parsePatchConfig = {
|
||||
extraConfig ? "",
|
||||
extraStructuredConfig ? {},
|
||||
...
|
||||
}:
|
||||
(parseExtraConfig extraConfig)
|
||||
++ (parseExtraStructuredConfig extraStructuredConfig);
|
||||
|
||||
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
|
||||
# into a list of k, v tuples
|
||||
parseConfig = config:
|
||||
let
|
||||
parseConfig = config: let
|
||||
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
|
||||
# get either the [ymn] option or the "foo" option; whichever matched
|
||||
t = l: let v = (i l 2); in [ (i l 0) (if v != null then v else (i l 3)) ];
|
||||
t = l: let
|
||||
v = i l 2;
|
||||
in [
|
||||
(i l 0)
|
||||
(
|
||||
if v != null
|
||||
then v
|
||||
else (i l 3)
|
||||
)
|
||||
];
|
||||
lines = lib.strings.splitString "\n" config;
|
||||
in map t (builtins.filter (l: l != null) (map parseLine lines));
|
||||
in
|
||||
map t (builtins.filter (l: l != null) (map parseLine lines));
|
||||
|
||||
origConfigfile = ./config;
|
||||
|
||||
linux-asahi-pkg = { stdenv, lib, fetchFromGitHub, fetchpatch, linuxKernel,
|
||||
rustPlatform, rustc, rustfmt, rust-bindgen, ... } @ args:
|
||||
let
|
||||
linux-asahi-pkg = {
|
||||
stdenv,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
linuxKernel,
|
||||
rustPlatform,
|
||||
rustc,
|
||||
rustfmt,
|
||||
rust-bindgen,
|
||||
...
|
||||
} @ args: let
|
||||
origConfigText = builtins.readFile origConfigfile;
|
||||
|
||||
# extraConfig from all patches in order
|
||||
|
@ -59,12 +86,17 @@ let
|
|||
lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches;
|
||||
# config file text for above
|
||||
extraConfigText = let
|
||||
text = k: v: if (v == "y") || (v == "m") || (v == "n")
|
||||
then "${k}=${v}" else ''${k}="${v}"'';
|
||||
text = k: v:
|
||||
if (v == "y") || (v == "m") || (v == "n")
|
||||
then "${k}=${v}"
|
||||
else ''${k}="${v}"'';
|
||||
in (map (t: text (i t 0) (i t 1)) extraConfig);
|
||||
|
||||
# final config as a text file path
|
||||
configfile = if extraConfig == [] then origConfigfile else
|
||||
configfile =
|
||||
if extraConfig == []
|
||||
then origConfigfile
|
||||
else
|
||||
writeText "config" ''
|
||||
${origConfigText}
|
||||
|
||||
|
@ -75,7 +107,8 @@ let
|
|||
config = let
|
||||
makePair = t: lib.nameValuePair (i t 0) (i t 1);
|
||||
configList = (parseConfig origConfigText) ++ extraConfig;
|
||||
in builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
|
||||
in
|
||||
builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
|
||||
|
||||
# used to (ostensibly) keep compatibility for those running stable versions of nixos
|
||||
rustOlder = version: withRust && (lib.versionOlder rustc.version version);
|
||||
|
@ -100,30 +133,43 @@ let
|
|||
hash = "sha256-Rruk/Nrw425XerZjgDJ4PJ3c63CCycch1qz7vFxHPCE=";
|
||||
};
|
||||
|
||||
kernelPatches = [
|
||||
{ name = "rust-bindgen-version";
|
||||
kernelPatches =
|
||||
[
|
||||
{
|
||||
name = "rust-bindgen-version";
|
||||
patch = ./rust-bindgen-version.patch;
|
||||
}
|
||||
] ++ lib.optionals _4KBuild [
|
||||
]
|
||||
++ lib.optionals _4KBuild [
|
||||
# thanks to Sven Peter
|
||||
# https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/
|
||||
{ name = "sven-iommu-4k";
|
||||
{
|
||||
name = "sven-iommu-4k";
|
||||
patch = ./sven-iommu-4k.patch;
|
||||
}
|
||||
(builtins.throw "The Asahi 4K kernel patch is currently broken. Contributions to fix are welcome.")
|
||||
] ++ lib.optionals (!_4KBuild) [
|
||||
]
|
||||
++ lib.optionals (!_4KBuild) [
|
||||
# patch the kernel to set the default size to 16k instead of modifying
|
||||
# the config so we don't need to convert our config to the nixos
|
||||
# infrastructure or patch it and thus introduce a dependency on the host
|
||||
# system architecture
|
||||
{ name = "default-pagesize-16k";
|
||||
{
|
||||
name = "default-pagesize-16k";
|
||||
patch = ./default-pagesize-16k.patch;
|
||||
}
|
||||
] ++ _kernelPatches;
|
||||
]
|
||||
++ _kernelPatches;
|
||||
|
||||
inherit configfile config;
|
||||
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
||||
}
|
||||
// (args.argsOverride or {}))
|
||||
.overrideAttrs (old:
|
||||
if withRust
|
||||
then {
|
||||
nativeBuildInputs =
|
||||
(old.nativeBuildInputs or [])
|
||||
++ [
|
||||
rust-bindgen
|
||||
rustfmt
|
||||
rustc
|
||||
|
@ -131,15 +177,18 @@ let
|
|||
];
|
||||
# HACK: references shouldn't have been there in the first place
|
||||
# TODO: remove once 23.05 is obsolete
|
||||
postFixup = (old.postFixup or "") + ''
|
||||
postFixup =
|
||||
(old.postFixup or "")
|
||||
+ ''
|
||||
if [ -f $dev/lib/modules/${old.version}/build/vmlinux ]; then
|
||||
remove-references-to -t $out $dev/lib/modules/${old.version}/build/vmlinux
|
||||
fi
|
||||
remove-references-to -t $dev $out/Image
|
||||
'';
|
||||
RUST_LIB_SRC = rustPlatform.rustLibSrc;
|
||||
} else {});
|
||||
|
||||
linux-asahi = (callPackage linux-asahi-pkg { });
|
||||
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)
|
||||
}
|
||||
else {});
|
||||
|
||||
linux-asahi = callPackage linux-asahi-pkg {};
|
||||
in
|
||||
lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
{ stdenv
|
||||
, buildPackages
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, python3
|
||||
, dtc
|
||||
, imagemagick
|
||||
, isRelease ? false
|
||||
, withTools ? true
|
||||
, withChainloading ? false
|
||||
, rust-bin ? null
|
||||
, customLogo ? null
|
||||
{
|
||||
stdenv,
|
||||
buildPackages,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
python3,
|
||||
dtc,
|
||||
imagemagick,
|
||||
isRelease ? false,
|
||||
withTools ? true,
|
||||
withChainloading ? false,
|
||||
rust-bin ? null,
|
||||
customLogo ? null,
|
||||
}:
|
||||
|
||||
assert withChainloading -> rust-bin != null;
|
||||
|
||||
let
|
||||
pyenv = python3.withPackages (p: with p; [
|
||||
assert withChainloading -> rust-bin != null; let
|
||||
pyenv = python3.withPackages (p:
|
||||
with p; [
|
||||
construct
|
||||
pyserial
|
||||
]);
|
||||
|
||||
rustenv = rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
|
||||
rustenv = rust-bin.selectLatestNightlyWith (toolchain:
|
||||
toolchain.minimal.override {
|
||||
targets = ["aarch64-unknown-none-softfloat"];
|
||||
});
|
||||
in stdenv.mkDerivation rec {
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "m1n1";
|
||||
version = "1.4.2";
|
||||
|
||||
|
@ -36,14 +37,17 @@ in stdenv.mkDerivation rec {
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ]
|
||||
makeFlags =
|
||||
["ARCH=${stdenv.cc.targetPrefix}"]
|
||||
++ lib.optional isRelease "RELEASE=1"
|
||||
++ lib.optional withChainloading "CHAINLOADING=1";
|
||||
|
||||
nativeBuildInputs = [
|
||||
nativeBuildInputs =
|
||||
[
|
||||
dtc
|
||||
buildPackages.gcc
|
||||
] ++ lib.optional withChainloading rustenv
|
||||
]
|
||||
++ lib.optional withChainloading rustenv
|
||||
++ lib.optional (customLogo != null) imagemagick;
|
||||
|
||||
postPatch = ''
|
||||
|
@ -67,12 +71,14 @@ in stdenv.mkDerivation rec {
|
|||
popd &>/dev/null
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/build
|
||||
cp build/m1n1.bin $out/build
|
||||
'' + (lib.optionalString withTools ''
|
||||
''
|
||||
+ (lib.optionalString withTools ''
|
||||
mkdir -p $out/{bin,script,toolchain-bin}
|
||||
cp -r proxyclient $out/script
|
||||
cp -r tools $out/script
|
||||
|
@ -95,7 +101,8 @@ EOF
|
|||
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/
|
||||
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/
|
||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/
|
||||
'') + ''
|
||||
'')
|
||||
+ ''
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{ lib
|
||||
, fetchFromGitLab
|
||||
, mesa }:
|
||||
|
||||
{
|
||||
lib,
|
||||
fetchFromGitLab,
|
||||
mesa,
|
||||
}:
|
||||
(mesa.override {
|
||||
galliumDrivers = ["swrast" "asahi"];
|
||||
vulkanDrivers = ["swrast"];
|
||||
enableGalliumNine = false;
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
})
|
||||
.overrideAttrs (oldAttrs: {
|
||||
# version must be the same length (i.e. no unstable or date)
|
||||
# so that system.replaceRuntimeDependencies can work
|
||||
version = "23.3.0";
|
||||
|
@ -22,7 +24,8 @@
|
|||
mesonFlags =
|
||||
# remove flag to configure xvmc functionality as having it
|
||||
# breaks the build because that no longer exists in Mesa 23
|
||||
(lib.filter (x: !(lib.hasPrefix "-Dxvmc-libs-path=" x)) oldAttrs.mesonFlags) ++ [
|
||||
(lib.filter (x: !(lib.hasPrefix "-Dxvmc-libs-path=" x)) oldAttrs.mesonFlags)
|
||||
++ [
|
||||
# we do not build any graphics drivers these features can be enabled for
|
||||
"-Dgallium-va=disabled"
|
||||
"-Dgallium-vdpau=disabled"
|
||||
|
@ -35,7 +38,10 @@
|
|||
];
|
||||
|
||||
# replace disk cache path patch with one tweaked slightly to apply to this version
|
||||
patches = lib.forEach oldAttrs.patches
|
||||
(p: if lib.hasSuffix "disk_cache-include-dri-driver-path-in-cache-key.patch" p
|
||||
then ./disk_cache-include-dri-driver-path-in-cache-key.patch else p);
|
||||
patches =
|
||||
lib.forEach oldAttrs.patches
|
||||
(p:
|
||||
if lib.hasSuffix "disk_cache-include-dri-driver-path-in-cache-key.patch" p
|
||||
then ./disk_cache-include-dri-driver-path-in-cache-key.patch
|
||||
else p);
|
||||
})
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, buildUBoot
|
||||
, m1n1
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
buildUBoot,
|
||||
m1n1,
|
||||
}:
|
||||
|
||||
(buildUBoot rec {
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/uboot-asahi/PKGBUILD
|
||||
|
@ -27,7 +27,8 @@
|
|||
CONFIG_VIDEO_FONT_SUN12X22=n
|
||||
CONFIG_VIDEO_FONT_16X32=y
|
||||
'';
|
||||
}).overrideAttrs (o: {
|
||||
})
|
||||
.overrideAttrs (o: {
|
||||
# nixos's downstream patches are not applicable
|
||||
patches = [
|
||||
];
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../common/nixos/common.nix
|
||||
../../common/networking/zerotier.nix
|
||||
|
@ -33,5 +37,4 @@
|
|||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "usb_storage"];
|
||||
|
@ -13,21 +17,23 @@
|
|||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/7d847b27-80ca-4f25-b4f9-8c0425b449b4";
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/7d847b27-80ca-4f25-b4f9-8c0425b449b4";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/FC2B-A077";
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/FC2B-A077";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [ {
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/lib/swapfile";
|
||||
size = 8 * 1024;
|
||||
randomEncryption.enable = true;
|
||||
} ];
|
||||
}
|
||||
];
|
||||
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file
|
||||
# This is useful to avoid using channels when using legacy nix commands
|
||||
let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
|
||||
let
|
||||
lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
|
||||
in
|
||||
import (fetchTarball {
|
||||
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# This file defines overlays
|
||||
{ inputs, ... }:
|
||||
{
|
||||
{inputs, ...}: {
|
||||
# This one brings our custom packages from the 'pkgs' directory
|
||||
additions = final: _prev: {
|
||||
# nest everything under a namespace that's not likely to collide
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# Shell for bootstrapping flake-enabled nix and home-manager
|
||||
# You can enter it through 'nix develop' or (legacy) 'nix-shell'
|
||||
|
||||
{pkgs ? (import ./nixpkgs.nix) {}}: {
|
||||
default = pkgs.mkShell {
|
||||
# Enable experimental features without having to specify the argument
|
||||
|
|
Loading…
Add table
Reference in a new issue