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,12 +1,14 @@
|
|||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./common.nix
|
||||
];
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./common.nix
|
||||
];
|
||||
|
||||
# XDG Portals
|
||||
# XDG Portals
|
||||
xdg = {
|
||||
autostart.enable = true;
|
||||
portal = {
|
||||
|
@ -25,13 +27,13 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
# Services
|
||||
# Services
|
||||
services = {
|
||||
xserver = {
|
||||
enable = true;
|
||||
layout = "us";
|
||||
xkbVariant = "";
|
||||
excludePackages = [ pkgs.xterm ];
|
||||
excludePackages = [pkgs.xterm];
|
||||
videoDrivers = ["amdgpu"];
|
||||
libinput = {
|
||||
enable = true;
|
||||
|
@ -84,7 +86,7 @@
|
|||
waybar = {
|
||||
enable = true;
|
||||
package = pkgs.waybar.overrideAttrs (oldAttrs: {
|
||||
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
|
||||
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
|
||||
});
|
||||
};
|
||||
thunar = {
|
||||
|
@ -148,6 +150,5 @@
|
|||
GTK_USE_PORTAL = "1";
|
||||
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,24 +1,28 @@
|
|||
{ config, lib, pkgs, inputs, outputs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./packages.nix
|
||||
./users.nix
|
||||
./locale.nix
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./packages.nix
|
||||
./users.nix
|
||||
./locale.nix
|
||||
];
|
||||
#
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
nix.settings.auto-optimise-store = true;
|
||||
nix.optimise.automatic = true;
|
||||
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
|
@ -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,17 +1,20 @@
|
|||
{ 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 = {
|
||||
isNormalUser = true;
|
||||
description = "Kyle Brown";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
extraGroups = ["networkmanager" "wheel"];
|
||||
shell = pkgs.zsh;
|
||||
packages = with pkgs; [
|
||||
yadm
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
132
flake.nix
132
flake.nix
|
@ -12,7 +12,7 @@
|
|||
# Home manager
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
|
||||
darwin = {
|
||||
url = "github:lnl7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -32,79 +32,85 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (self) outputs;
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
|
||||
mkNixos = modules: nixpkgs.lib.nixosSystem {
|
||||
mkNixos = modules:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit modules;
|
||||
specialArgs = { inherit inputs outputs; };
|
||||
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; };
|
||||
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; };
|
||||
extraSpecialArgs = {inherit inputs outputs;};
|
||||
};
|
||||
in
|
||||
rec {
|
||||
# Your custom packages
|
||||
# Acessible through 'nix build', 'nix shell', etc
|
||||
#packages = forAllSystems (system:
|
||||
# let pkgs = nixpkgs.legacyPackages.${system};
|
||||
# in import ./pkgs { inherit pkgs; }
|
||||
#);
|
||||
# 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; }
|
||||
);
|
||||
in rec {
|
||||
# Your custom packages
|
||||
# Acessible through 'nix build', 'nix shell', etc
|
||||
#packages = forAllSystems (system:
|
||||
# let pkgs = nixpkgs.legacyPackages.${system};
|
||||
# in import ./pkgs { inherit pkgs; }
|
||||
#);
|
||||
# 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;}
|
||||
);
|
||||
|
||||
# Your custom packages and modifications, exported as overlays
|
||||
overlays = import ./overlays { inherit inputs; };
|
||||
# Reusable nixos modules you might want to export
|
||||
# These are usually stuff you would upstream into nixpkgs
|
||||
#nixosModules = import ./modules/nixos;
|
||||
# Reusable home-manager modules you might want to export
|
||||
# These are usually stuff you would upstream into home-manager
|
||||
#homeManagerModules = import ./modules/home-manager;
|
||||
# Your custom packages and modifications, exported as overlays
|
||||
overlays = import ./overlays {inherit inputs;};
|
||||
# Reusable nixos modules you might want to export
|
||||
# These are usually stuff you would upstream into nixpkgs
|
||||
#nixosModules = import ./modules/nixos;
|
||||
# Reusable home-manager modules you might want to export
|
||||
# These are usually stuff you would upstream into home-manager
|
||||
#homeManagerModules = import ./modules/home-manager;
|
||||
|
||||
# NixOS configuration entrypoint
|
||||
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||
nixosConfigurations = {
|
||||
# M1 mac mini
|
||||
farnsworth = mkNixos [ ./hosts/farnsworth ];
|
||||
# NixOS configuration entrypoint
|
||||
# Available through 'nixos-rebuild --flake .#your-hostname'
|
||||
nixosConfigurations = {
|
||||
# M1 mac mini
|
||||
farnsworth = mkNixos [./hosts/farnsworth];
|
||||
|
||||
# Laptop
|
||||
amy = mkNixos [ ./hosts/amy ];
|
||||
|
||||
};
|
||||
|
||||
#darwinConfigurations = {
|
||||
# 14" M1-Pro macbook
|
||||
#sef-macbook = mkDarwin "aarch64-darwin" [ ./darwin/hosts/macbook.nix ];
|
||||
|
||||
# 16" intel MBP (ShareFile dev)
|
||||
#AMERMACC02FC2U2MD6R = mkDarwin "x86_64-darwin" [ ./darwin/hosts/work-macbook.nix ];
|
||||
#};
|
||||
|
||||
# Standalone home-manager configuration entrypoint
|
||||
# Available through 'home-manager --flake .#your-username@your-hostname'
|
||||
#homeConfigurations = {
|
||||
# TODO: add generic standalone home-manager config
|
||||
#};
|
||||
# Laptop
|
||||
amy = mkNixos [./hosts/amy];
|
||||
};
|
||||
}
|
||||
|
||||
#darwinConfigurations = {
|
||||
# 14" M1-Pro macbook
|
||||
#sef-macbook = mkDarwin "aarch64-darwin" [ ./darwin/hosts/macbook.nix ];
|
||||
|
||||
# 16" intel MBP (ShareFile dev)
|
||||
#AMERMACC02FC2U2MD6R = mkDarwin "x86_64-darwin" [ ./darwin/hosts/work-macbook.nix ];
|
||||
#};
|
||||
|
||||
# Standalone home-manager configuration entrypoint
|
||||
# Available through 'home-manager --flake .#your-username@your-hostname'
|
||||
#homeConfigurations = {
|
||||
# TODO: add generic standalone home-manager config
|
||||
#};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
# 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.
|
||||
./hardware-configuration.nix
|
||||
../../common/nixos/common.nix
|
||||
../../common/networking/zerotier.nix
|
||||
../../common/gui/hyprland.nix
|
||||
../../common/editors/emacs.nix
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../common/nixos/common.nix
|
||||
../../common/networking/zerotier.nix
|
||||
../../common/gui/hyprland.nix
|
||||
../../common/editors/emacs.nix
|
||||
];
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
@ -25,5 +29,4 @@
|
|||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,36 +1,42 @@
|
|||
# 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" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [ "psmouse.synaptics_intertouch=0" ];
|
||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [];
|
||||
boot.kernelParams = ["psmouse.synaptics_intertouch=0"];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/965d7442-87cd-430b-ba33-b5022a88dda3";
|
||||
fsType = "ext4";
|
||||
};
|
||||
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";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/6B1C-C4A0";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [ {
|
||||
device = "/var/lib/swapfile";
|
||||
size = 8*1024;
|
||||
randomEncryption.enable = true;
|
||||
} ];
|
||||
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 {
|
||||
|
@ -29,7 +33,7 @@ in {
|
|||
boot.loader.systemd-boot.extraFiles = bootFiles;
|
||||
|
||||
# ensure the installer has m1n1 in the image
|
||||
system.extraDependencies = lib.mkForce [ bootM1n1 bootUBoot ];
|
||||
system.extraDependencies = lib.mkForce [bootM1n1 bootUBoot];
|
||||
system.build.m1n1 = bootFiles."m1n1/boot.bin";
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./kernel
|
||||
./mesa
|
||||
|
@ -8,22 +12,21 @@
|
|||
./sound
|
||||
];
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.hardware.asahi;
|
||||
in {
|
||||
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
|
||||
config = let
|
||||
cfg = config.hardware.asahi;
|
||||
in {
|
||||
nixpkgs.overlays = lib.mkBefore [cfg.overlay];
|
||||
|
||||
hardware.asahi.pkgs =
|
||||
if cfg.pkgsSystem != "aarch64-linux"
|
||||
then
|
||||
import (pkgs.path) {
|
||||
crossSystem.system = "aarch64-linux";
|
||||
localSystem.system = cfg.pkgsSystem;
|
||||
overlays = [ cfg.overlay ];
|
||||
}
|
||||
else pkgs;
|
||||
};
|
||||
hardware.asahi.pkgs =
|
||||
if cfg.pkgsSystem != "aarch64-linux"
|
||||
then
|
||||
import (pkgs.path) {
|
||||
crossSystem.system = "aarch64-linux";
|
||||
localSystem.system = cfg.pkgsSystem;
|
||||
overlays = [cfg.overlay];
|
||||
}
|
||||
else pkgs;
|
||||
};
|
||||
|
||||
options.hardware.asahi = {
|
||||
pkgsSystem = lib.mkOption {
|
||||
|
|
|
@ -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,37 +1,42 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
config = let
|
||||
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver
|
||||
&& config.hardware.asahi.experimentalGPUInstallMode == mode);
|
||||
in lib.mkMerge [
|
||||
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
|
||||
&& config.hardware.asahi.experimentalGPUInstallMode == mode);
|
||||
in
|
||||
lib.mkMerge [
|
||||
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
|
||||
# install the drivers
|
||||
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
|
||||
|
||||
# install the drivers
|
||||
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
|
||||
|
||||
# required for GPU kernel driver
|
||||
hardware.asahi.addEdgeKernelConfig = true;
|
||||
})
|
||||
(lib.mkIf (isMode "replace") {
|
||||
# replace the Mesa linked into system packages with the Asahi version
|
||||
# without rebuilding them to avoid rebuilding the world.
|
||||
system.replaceRuntimeDependencies = [
|
||||
{ original = pkgs.mesa;
|
||||
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
|
||||
}
|
||||
];
|
||||
})
|
||||
(lib.mkIf (isMode "overlay") {
|
||||
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay,
|
||||
# which requires rebuilding the world but ensures it is done faithfully
|
||||
# (and in a way compatible with pure evaluation)
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
mesa = final.mesa-asahi-edge;
|
||||
})
|
||||
];
|
||||
})
|
||||
];
|
||||
# required for GPU kernel driver
|
||||
hardware.asahi.addEdgeKernelConfig = true;
|
||||
})
|
||||
(lib.mkIf (isMode "replace") {
|
||||
# replace the Mesa linked into system packages with the Asahi version
|
||||
# without rebuilding them to avoid rebuilding the world.
|
||||
system.replaceRuntimeDependencies = [
|
||||
{
|
||||
original = pkgs.mesa;
|
||||
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
|
||||
}
|
||||
];
|
||||
})
|
||||
(lib.mkIf (isMode "overlay") {
|
||||
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay,
|
||||
# which requires rebuilding the world but ensures it is done faithfully
|
||||
# (and in a way compatible with pure evaluation)
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
mesa = final.mesa-asahi-edge;
|
||||
})
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
|
@ -44,7 +49,7 @@
|
|||
};
|
||||
|
||||
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
|
||||
type = lib.types.enum [ "driver" "replace" "overlay" ];
|
||||
type = lib.types.enum ["driver" "replace" "overlay"];
|
||||
default = "replace";
|
||||
description = ''
|
||||
Mode to use to install the experimental GPU driver into the system.
|
||||
|
|
|
@ -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.
|
||||
|
@ -14,11 +19,11 @@
|
|||
pkgs' = config.hardware.asahi.pkgs;
|
||||
in
|
||||
lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null)
|
||||
&& config.hardware.asahi.extractPeripheralFirmware) [
|
||||
&& config.hardware.asahi.extractPeripheralFirmware) [
|
||||
(pkgs.stdenv.mkDerivation {
|
||||
name = "asahi-peripheral-firmware";
|
||||
|
||||
nativeBuildInputs = [ pkgs'.asahi-fwextract pkgs.cpio ];
|
||||
nativeBuildInputs = [pkgs'.asahi-fwextract pkgs.cpio];
|
||||
|
||||
buildCommand = ''
|
||||
mkdir extracted
|
||||
|
@ -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,13 +1,16 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options.hardware.asahi = {
|
||||
setupAlsaUcm = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.sound.enable;
|
||||
description = ''
|
||||
Enable the Asahi-specific ALSA UCM2 configs in the global environment
|
||||
so that headphone jack input and output work properly.
|
||||
Enable the Asahi-specific ALSA UCM2 configs in the global environment
|
||||
so that headphone jack input and output work properly.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
@ -12,8 +12,11 @@
|
|||
rev = "v${version}";
|
||||
hash = "sha256-TCCT0AJx0SdnTzzBaV94zuD2hrPqvk+9vTTuEQmpJjc=";
|
||||
};
|
||||
|
||||
postInstall = oldAttrs.postInstall or "" + ''
|
||||
cp -r ${src_asahi}/ucm2 $out/share/alsa
|
||||
'';
|
||||
|
||||
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";
|
||||
|
@ -26,7 +26,7 @@ python3.pkgs.buildPythonApplication rec {
|
|||
--replace '"xf"' '"-x", "-I", "${gzip}/bin/gzip", "-f"'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ python3.pkgs.setuptools ];
|
||||
nativeBuildInputs = [python3.pkgs.setuptools];
|
||||
|
||||
doCheck = false;
|
||||
}
|
||||
|
|
|
@ -1,145 +1,194 @@
|
|||
{ 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
|
||||
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}")
|
||||
(builtins.head l) (builtins.tail l);
|
||||
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;
|
||||
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}")
|
||||
(builtins.head l) (builtins.tail l);
|
||||
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;
|
||||
|
||||
# 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
|
||||
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)) ];
|
||||
lines = lib.strings.splitString "\n" config;
|
||||
in map t (builtins.filter (l: l != null) (map parseLine lines));
|
||||
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)
|
||||
)
|
||||
];
|
||||
lines = lib.strings.splitString "\n" config;
|
||||
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
|
||||
origConfigText = builtins.readFile origConfigfile;
|
||||
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
|
||||
extraConfig =
|
||||
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}"'';
|
||||
in (map (t: text (i t 0) (i t 1)) extraConfig);
|
||||
# extraConfig from all patches in order
|
||||
extraConfig =
|
||||
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}"'';
|
||||
in (map (t: text (i t 0) (i t 1)) extraConfig);
|
||||
|
||||
# final config as a text file path
|
||||
configfile = if extraConfig == [] then origConfigfile else
|
||||
# final config as a text file path
|
||||
configfile =
|
||||
if extraConfig == []
|
||||
then origConfigfile
|
||||
else
|
||||
writeText "config" ''
|
||||
${origConfigText}
|
||||
|
||||
# Patches
|
||||
${lib.strings.concatStringsSep "\n" extraConfigText}
|
||||
'';
|
||||
# final config as an attrset
|
||||
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));
|
||||
|
||||
# used to (ostensibly) keep compatibility for those running stable versions of nixos
|
||||
rustOlder = version: withRust && (lib.versionOlder rustc.version version);
|
||||
bindgenOlder = version: withRust && (lib.versionOlder rust-bindgen.unwrapped.version version);
|
||||
|
||||
# used to fix issues when nixpkgs gets ahead of the kernel
|
||||
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
|
||||
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
|
||||
# final config as an attrset
|
||||
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));
|
||||
|
||||
# used to (ostensibly) keep compatibility for those running stable versions of nixos
|
||||
rustOlder = version: withRust && (lib.versionOlder rustc.version version);
|
||||
bindgenOlder = version: withRust && (lib.versionOlder rust-bindgen.unwrapped.version version);
|
||||
|
||||
# used to fix issues when nixpkgs gets ahead of the kernel
|
||||
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
|
||||
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
|
||||
in
|
||||
(linuxKernel.manualConfig rec {
|
||||
inherit stdenv lib;
|
||||
inherit stdenv lib;
|
||||
|
||||
version = "6.5.0-asahi";
|
||||
modDirVersion = version;
|
||||
extraMeta.branch = "6.5";
|
||||
version = "6.5.0-asahi";
|
||||
modDirVersion = version;
|
||||
extraMeta.branch = "6.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/PKGBUILD
|
||||
owner = "AsahiLinux";
|
||||
repo = "linux";
|
||||
rev = "asahi-6.5-15";
|
||||
hash = "sha256-Rruk/Nrw425XerZjgDJ4PJ3c63CCycch1qz7vFxHPCE=";
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/PKGBUILD
|
||||
owner = "AsahiLinux";
|
||||
repo = "linux";
|
||||
rev = "asahi-6.5-15";
|
||||
hash = "sha256-Rruk/Nrw425XerZjgDJ4PJ3c63CCycch1qz7vFxHPCE=";
|
||||
};
|
||||
|
||||
kernelPatches = [
|
||||
{ name = "rust-bindgen-version";
|
||||
patch = ./rust-bindgen-version.patch;
|
||||
}
|
||||
] ++ lib.optionals _4KBuild [
|
||||
# thanks to Sven Peter
|
||||
# https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/
|
||||
{ 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) [
|
||||
# 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";
|
||||
patch = ./default-pagesize-16k.patch;
|
||||
}
|
||||
] ++ _kernelPatches;
|
||||
kernelPatches =
|
||||
[
|
||||
{
|
||||
name = "rust-bindgen-version";
|
||||
patch = ./rust-bindgen-version.patch;
|
||||
}
|
||||
]
|
||||
++ lib.optionals _4KBuild [
|
||||
# thanks to Sven Peter
|
||||
# https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/
|
||||
{
|
||||
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) [
|
||||
# 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";
|
||||
patch = ./default-pagesize-16k.patch;
|
||||
}
|
||||
]
|
||||
++ _kernelPatches;
|
||||
|
||||
inherit configfile config;
|
||||
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
||||
rust-bindgen
|
||||
rustfmt
|
||||
rustc
|
||||
removeReferencesTo
|
||||
];
|
||||
# HACK: references shouldn't have been there in the first place
|
||||
# TODO: remove once 23.05 is obsolete
|
||||
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)
|
||||
inherit configfile config;
|
||||
}
|
||||
// (args.argsOverride or {}))
|
||||
.overrideAttrs (old:
|
||||
if withRust
|
||||
then {
|
||||
nativeBuildInputs =
|
||||
(old.nativeBuildInputs or [])
|
||||
++ [
|
||||
rust-bindgen
|
||||
rustfmt
|
||||
rustc
|
||||
removeReferencesTo
|
||||
];
|
||||
# HACK: references shouldn't have been there in the first place
|
||||
# TODO: remove once 23.05 is obsolete
|
||||
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)
|
||||
|
|
|
@ -1,101 +1,108 @@
|
|||
{ 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; [
|
||||
construct
|
||||
pyserial
|
||||
]);
|
||||
|
||||
assert withChainloading -> rust-bin != null;
|
||||
rustenv = rust-bin.selectLatestNightlyWith (toolchain:
|
||||
toolchain.minimal.override {
|
||||
targets = ["aarch64-unknown-none-softfloat"];
|
||||
});
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "m1n1";
|
||||
version = "1.4.2";
|
||||
|
||||
let
|
||||
pyenv = python3.withPackages (p: with p; [
|
||||
construct
|
||||
pyserial
|
||||
]);
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/m1n1/PKGBUILD
|
||||
owner = "AsahiLinux";
|
||||
repo = "m1n1";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-zPHLlhXUIX6MV2pnDkuSg4Pz8gB4YOZiaa8MuLasgPY=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
rustenv = rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
|
||||
targets = [ "aarch64-unknown-none-softfloat" ];
|
||||
});
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "m1n1";
|
||||
version = "1.4.2";
|
||||
makeFlags =
|
||||
["ARCH=${stdenv.cc.targetPrefix}"]
|
||||
++ lib.optional isRelease "RELEASE=1"
|
||||
++ lib.optional withChainloading "CHAINLOADING=1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/m1n1/PKGBUILD
|
||||
owner = "AsahiLinux";
|
||||
repo = "m1n1";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-zPHLlhXUIX6MV2pnDkuSg4Pz8gB4YOZiaa8MuLasgPY=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
nativeBuildInputs =
|
||||
[
|
||||
dtc
|
||||
buildPackages.gcc
|
||||
]
|
||||
++ lib.optional withChainloading rustenv
|
||||
++ lib.optional (customLogo != null) imagemagick;
|
||||
|
||||
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ]
|
||||
++ lib.optional isRelease "RELEASE=1"
|
||||
++ lib.optional withChainloading "CHAINLOADING=1";
|
||||
postPatch = ''
|
||||
substituteInPlace proxyclient/m1n1/asm.py \
|
||||
--replace 'aarch64-linux-gnu-' 'aarch64-unknown-linux-gnu-' \
|
||||
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
dtc
|
||||
buildPackages.gcc
|
||||
] ++ lib.optional withChainloading rustenv
|
||||
++ lib.optional (customLogo != null) imagemagick;
|
||||
preConfigure = lib.optionalString (customLogo != null) ''
|
||||
pushd data &>/dev/null
|
||||
ln -fs ${customLogo} bootlogo_256.png
|
||||
if [[ "$(magick identify bootlogo_256.png)" != 'bootlogo_256.png PNG 256x256'* ]]; then
|
||||
echo "Custom logo is not a 256x256 PNG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace proxyclient/m1n1/asm.py \
|
||||
--replace 'aarch64-linux-gnu-' 'aarch64-unknown-linux-gnu-' \
|
||||
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"'
|
||||
'';
|
||||
rm bootlogo_128.png
|
||||
convert bootlogo_256.png -resize 128x128 bootlogo_128.png
|
||||
patchShebangs --build ./makelogo.sh
|
||||
./makelogo.sh
|
||||
popd &>/dev/null
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString (customLogo != null) ''
|
||||
pushd data &>/dev/null
|
||||
ln -fs ${customLogo} bootlogo_256.png
|
||||
if [[ "$(magick identify bootlogo_256.png)" != 'bootlogo_256.png PNG 256x256'* ]]; then
|
||||
echo "Custom logo is not a 256x256 PNG"
|
||||
exit 1
|
||||
fi
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
|
||||
rm bootlogo_128.png
|
||||
convert bootlogo_256.png -resize 128x128 bootlogo_128.png
|
||||
patchShebangs --build ./makelogo.sh
|
||||
./makelogo.sh
|
||||
popd &>/dev/null
|
||||
'';
|
||||
mkdir -p $out/build
|
||||
cp build/m1n1.bin $out/build
|
||||
''
|
||||
+ (lib.optionalString withTools ''
|
||||
mkdir -p $out/{bin,script,toolchain-bin}
|
||||
cp -r proxyclient $out/script
|
||||
cp -r tools $out/script
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
for toolpath in $out/script/proxyclient/tools/*.py; do
|
||||
tool=$(basename $toolpath .py)
|
||||
script=$out/bin/m1n1-$tool
|
||||
cat > $script <<EOF
|
||||
#!/bin/sh
|
||||
${pyenv}/bin/python $toolpath "\$@"
|
||||
EOF
|
||||
chmod +x $script
|
||||
done
|
||||
|
||||
mkdir -p $out/build
|
||||
cp build/m1n1.bin $out/build
|
||||
'' + (lib.optionalString withTools ''
|
||||
mkdir -p $out/{bin,script,toolchain-bin}
|
||||
cp -r proxyclient $out/script
|
||||
cp -r tools $out/script
|
||||
GCC=${buildPackages.gcc}
|
||||
BINUTILS=${buildPackages.binutils-unwrapped}
|
||||
|
||||
for toolpath in $out/script/proxyclient/tools/*.py; do
|
||||
tool=$(basename $toolpath .py)
|
||||
script=$out/bin/m1n1-$tool
|
||||
cat > $script <<EOF
|
||||
#!/bin/sh
|
||||
${pyenv}/bin/python $toolpath "\$@"
|
||||
EOF
|
||||
chmod +x $script
|
||||
done
|
||||
|
||||
GCC=${buildPackages.gcc}
|
||||
BINUTILS=${buildPackages.binutils-unwrapped}
|
||||
|
||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
|
||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
|
||||
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
|
||||
'';
|
||||
}
|
||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
|
||||
ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
|
||||
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" ];
|
||||
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,8 +1,8 @@
|
|||
final: prev: {
|
||||
linux-asahi = final.callPackage ./linux-asahi { };
|
||||
m1n1 = final.callPackage ./m1n1 { };
|
||||
uboot-asahi = final.callPackage ./uboot-asahi { };
|
||||
asahi-fwextract = final.callPackage ./asahi-fwextract { };
|
||||
mesa-asahi-edge = final.callPackage ./mesa-asahi-edge { inherit (prev) mesa; };
|
||||
alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi { inherit (prev) alsa-ucm-conf; };
|
||||
linux-asahi = final.callPackage ./linux-asahi {};
|
||||
m1n1 = final.callPackage ./m1n1 {};
|
||||
uboot-asahi = final.callPackage ./uboot-asahi {};
|
||||
asahi-fwextract = final.callPackage ./asahi-fwextract {};
|
||||
mesa-asahi-edge = final.callPackage ./mesa-asahi-edge {inherit (prev) mesa;};
|
||||
alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi {inherit (prev) alsa-ucm-conf;};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -15,7 +15,7 @@
|
|||
version = "2023.07.02.asahi3-1";
|
||||
|
||||
defconfig = "apple_m1_defconfig";
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
extraMeta.platforms = ["aarch64-linux"];
|
||||
filesToInstall = [
|
||||
"u-boot-nodtb.bin.gz"
|
||||
"m1n1-u-boot.bin"
|
||||
|
@ -27,9 +27,10 @@
|
|||
CONFIG_VIDEO_FONT_SUN12X22=n
|
||||
CONFIG_VIDEO_FONT_16X32=y
|
||||
'';
|
||||
}).overrideAttrs (o: {
|
||||
})
|
||||
.overrideAttrs (o: {
|
||||
# nixos's downstream patches are not applicable
|
||||
patches = [
|
||||
patches = [
|
||||
];
|
||||
|
||||
# flag somehow breaks DTC compilation so we remove it
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
# 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.
|
||||
./hardware-configuration.nix
|
||||
../../common/nixos/common.nix
|
||||
../../common/networking/zerotier.nix
|
||||
../../common/editors/emacs.nix
|
||||
# Include the necessary packages and configuration for Apple Silicon support.
|
||||
inputs.apple-silicon.nixosModules.apple-silicon-support
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../common/nixos/common.nix
|
||||
../../common/networking/zerotier.nix
|
||||
../../common/editors/emacs.nix
|
||||
# Include the necessary packages and configuration for Apple Silicon support.
|
||||
inputs.apple-silicon.nixosModules.apple-silicon-support
|
||||
];
|
||||
|
||||
# Specify path to peripheral firmware files.
|
||||
hardware.asahi.peripheralFirmwareDirectory = ./firmware;
|
||||
|
@ -27,11 +31,10 @@
|
|||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
|
||||
networking.hostName = "farnsworth"; # Define your hostname.
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,33 +1,39 @@
|
|||
# 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" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "usb_storage"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/7d847b27-80ca-4f25-b4f9-8c0425b449b4";
|
||||
fsType = "ext4";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/7d847b27-80ca-4f25-b4f9-8c0425b449b4";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/FC2B-A077";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/FC2B-A077";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [ {
|
||||
device = "/var/lib/swapfile";
|
||||
size = 8*1024;
|
||||
randomEncryption.enable = true;
|
||||
} ];
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/lib/swapfile";
|
||||
size = 8 * 1024;
|
||||
randomEncryption.enable = true;
|
||||
}
|
||||
];
|
||||
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
|
|
11
nixpkgs.nix
11
nixpkgs.nix
|
@ -1,8 +1,9 @@
|
|||
# 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";
|
||||
sha256 = lock.narHash;
|
||||
})
|
||||
import (fetchTarball {
|
||||
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
|
||||
sha256 = lock.narHash;
|
||||
})
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# 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
|
||||
# with anything in nixpkgs
|
||||
local-pkgs = import ../pkgs { pkgs = final; };
|
||||
local-pkgs = import ../pkgs {pkgs = final;};
|
||||
};
|
||||
|
||||
# This one contains whatever you want to overlay
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# Shell for bootstrapping flake-enabled nix and home-manager
|
||||
# You can enter it through 'nix develop' or (legacy) 'nix-shell'
|
||||
|
||||
{ pkgs ? (import ./nixpkgs.nix) { } }: {
|
||||
{pkgs ? (import ./nixpkgs.nix) {}}: {
|
||||
default = pkgs.mkShell {
|
||||
# Enable experimental features without having to specify the argument
|
||||
NIX_CONFIG = "experimental-features = nix-command flakes";
|
||||
nativeBuildInputs = with pkgs; [ nix home-manager git just ];
|
||||
nativeBuildInputs = with pkgs; [nix home-manager git just];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue