fix: formatting

This commit is contained in:
Kyle Brown 2023-10-27 17:15:03 -07:00
parent 15d38facce
commit b8adc59703
31 changed files with 645 additions and 514 deletions

View file

@ -1,11 +1,13 @@
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
config,
services.emacs = lib,
{ pkgs,
inputs,
outputs,
...
}: {
services.emacs = {
enable = true; enable = true;
package = pkgs.emacs; # replace with emacs-gtk, or a version provided by the community overlay if desired. package = pkgs.emacs; # replace with emacs-gtk, or a version provided by the community overlay if desired.
}; };
} }

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
config,
lib,
pkgs,
inputs,
outputs,
...
}: {
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; services.xserver.enable = true;
# Configure keymap in X11 # Configure keymap in X11
services.xserver = { services.xserver = {
layout = "us"; layout = "us";
@ -21,5 +24,4 @@
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
programs.sway.enable = true; programs.sway.enable = true;
} }

View file

@ -1,12 +1,14 @@
{ config, pkgs, inputs, ... }:
{ {
imports = config,
[ pkgs,
./common.nix inputs,
]; ...
}: {
imports = [
./common.nix
];
# XDG Portals # XDG Portals
xdg = { xdg = {
autostart.enable = true; autostart.enable = true;
portal = { portal = {
@ -25,13 +27,13 @@
''; '';
}; };
}; };
# Services # Services
services = { services = {
xserver = { xserver = {
enable = true; enable = true;
layout = "us"; layout = "us";
xkbVariant = ""; xkbVariant = "";
excludePackages = [ pkgs.xterm ]; excludePackages = [pkgs.xterm];
videoDrivers = ["amdgpu"]; videoDrivers = ["amdgpu"];
libinput = { libinput = {
enable = true; enable = true;
@ -84,7 +86,7 @@
waybar = { waybar = {
enable = true; enable = true;
package = pkgs.waybar.overrideAttrs (oldAttrs: { package = pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
}); });
}; };
thunar = { thunar = {
@ -148,6 +150,5 @@
GTK_USE_PORTAL = "1"; GTK_USE_PORTAL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1"; NIXOS_XDG_OPEN_USE_PORTAL = "1";
WLR_NO_HARDWARE_CURSOR = "1"; WLR_NO_HARDWARE_CURSOR = "1";
}; };
} }

View file

@ -1,17 +1,19 @@
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
config,
lib,
pkgs,
inputs,
outputs,
...
}: {
services.zerotierone = { services.zerotierone = {
joinNetworks = [ joinNetworks = [
"4e72329aec6688e3" "4e72329aec6688e3"
]; ];
enable = true; enable = true;
}; };
networking.extraHosts = networking.extraHosts = ''
''
192.168.194.109 planex.far 192.168.194.109 planex.far
192.168.194.210 farnsworth.far 192.168.194.210 farnsworth.far
192.168.194.24 zapp.far 192.168.194.24 zapp.far
@ -20,5 +22,4 @@
192.168.194.38 cubert.far 192.168.194.38 cubert.far
''; '';
} }

View file

@ -1,24 +1,28 @@
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
imports = config,
[ lib,
./packages.nix pkgs,
./users.nix inputs,
./locale.nix outputs,
]; ...
}: {
imports = [
./packages.nix
./users.nix
./locale.nix
];
# #
nixpkgs.config.allowUnfree = true; 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.settings.auto-optimise-store = true;
nix.optimise.automatic = true; nix.optimise.automatic = true;
nix.gc = { nix.gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 14d"; options = "--delete-older-than 14d";
}; };
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
@ -28,5 +32,4 @@
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View file

@ -1,7 +1,11 @@
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
config,
lib,
pkgs,
inputs,
outputs,
...
}: {
# Set your time zone. # Set your time zone.
time.timeZone = "America/Los_Angeles"; time.timeZone = "America/Los_Angeles";
@ -19,5 +23,4 @@
LC_TELEPHONE = "en_US.UTF-8"; LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8"; LC_TIME = "en_US.UTF-8";
}; };
} }

View file

@ -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 # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
programs.gnupg.agent = { programs.gnupg.agent = {
@ -9,7 +13,6 @@
enableSSHSupport = true; enableSSHSupport = true;
}; };
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -20,5 +23,4 @@
home-manager home-manager
yadm yadm
]; ];
} }

View file

@ -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'. # Define a user account. Don't forget to set a password with 'passwd'.
programs.zsh.enable = true; programs.zsh.enable = true;
users.users.kdb424 = { users.users.kdb424 = {
isNormalUser = true; isNormalUser = true;
description = "Kyle Brown"; description = "Kyle Brown";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = ["networkmanager" "wheel"];
shell = pkgs.zsh; shell = pkgs.zsh;
packages = with pkgs; [ packages = with pkgs; [
yadm yadm
]; ];
}; };
} }

132
flake.nix
View file

@ -12,7 +12,7 @@
# Home manager # Home manager
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
darwin = { darwin = {
url = "github:lnl7/nix-darwin"; url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -32,79 +32,85 @@
}; };
}; };
outputs = { self, nixpkgs, home-manager, ... }@inputs: outputs = {
let self,
inherit (self) outputs; nixpkgs,
forAllSystems = nixpkgs.lib.genAttrs [ home-manager,
"aarch64-linux" ...
"i686-linux" } @ inputs: let
"x86_64-linux" inherit (self) outputs;
"aarch64-darwin" forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-darwin" "aarch64-linux"
]; "i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
mkNixos = modules: nixpkgs.lib.nixosSystem { mkNixos = modules:
nixpkgs.lib.nixosSystem {
inherit modules; 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; 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; inherit modules pkgs;
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = {inherit inputs outputs;};
}; };
in in rec {
rec { # Your custom packages
# Your custom packages # Acessible through 'nix build', 'nix shell', etc
# Acessible through 'nix build', 'nix shell', etc #packages = forAllSystems (system:
#packages = forAllSystems (system: # let pkgs = nixpkgs.legacyPackages.${system};
# let pkgs = nixpkgs.legacyPackages.${system}; # in import ./pkgs { inherit pkgs; }
# in import ./pkgs { inherit pkgs; } #);
#); # Devshell for bootstrapping
# Devshell for bootstrapping # Acessible through 'nix develop' or 'nix-shell' (legacy)
# Acessible through 'nix develop' or 'nix-shell' (legacy) devShells = forAllSystems (
devShells = forAllSystems (system: system: let
let pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in import ./shell.nix { inherit pkgs; } in
); import ./shell.nix {inherit pkgs;}
);
# Your custom packages and modifications, exported as overlays # Your custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; }; overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules you might want to export # Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs # These are usually stuff you would upstream into nixpkgs
#nixosModules = import ./modules/nixos; #nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export # Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager # These are usually stuff you would upstream into home-manager
#homeManagerModules = import ./modules/home-manager; #homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint # NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname' # Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
# M1 mac mini # M1 mac mini
farnsworth = mkNixos [ ./hosts/farnsworth ]; farnsworth = mkNixos [./hosts/farnsworth];
# Laptop # Laptop
amy = mkNixos [ ./hosts/amy ]; 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
#};
}; };
}
#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
#};
};
}

View file

@ -1,18 +1,22 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
imports = config,
[ # Include the results of the hardware scan. lib,
./hardware-configuration.nix pkgs,
../../common/nixos/common.nix inputs,
../../common/networking/zerotier.nix outputs,
../../common/gui/hyprland.nix ...
../../common/editors/emacs.nix }: {
]; 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. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
@ -25,5 +29,4 @@
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; services.openssh.enable = true;
} }

View file

@ -1,36 +1,42 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") 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.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
boot.kernelParams = [ "psmouse.synaptics_intertouch=0" ]; boot.kernelParams = ["psmouse.synaptics_intertouch=0"];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/965d7442-87cd-430b-ba33-b5022a88dda3"; device = "/dev/disk/by-uuid/965d7442-87cd-430b-ba33-b5022a88dda3";
fsType = "ext4"; fsType = "ext4";
}; };
boot.initrd.luks.devices."luks-4613d281-839b-483b-bb3c-6b151a43bf68".device = "/dev/disk/by-uuid/4613d281-839b-483b-bb3c-6b151a43bf68"; boot.initrd.luks.devices."luks-4613d281-839b-483b-bb3c-6b151a43bf68".device = "/dev/disk/by-uuid/4613d281-839b-483b-bb3c-6b151a43bf68";
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/6B1C-C4A0"; device = "/dev/disk/by-uuid/6B1C-C4A0";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ { swapDevices = [
device = "/var/lib/swapfile"; {
size = 8*1024; device = "/var/lib/swapfile";
randomEncryption.enable = true; size = 8 * 1024;
} ]; randomEncryption.enable = true;
}
];
zramSwap = { zramSwap = {
enable = true; enable = true;

View file

@ -1,6 +1,4 @@
{ ... }: {...}: {
{
imports = [ imports = [
./modules/default.nix ./modules/default.nix
]; ];

View file

@ -1,5 +1,9 @@
{ config, pkgs, lib, ... }: {
let config,
pkgs,
lib,
...
}: let
pkgs' = config.hardware.asahi.pkgs; pkgs' = config.hardware.asahi.pkgs;
bootM1n1 = pkgs'.m1n1.override { bootM1n1 = pkgs'.m1n1.override {
@ -29,7 +33,7 @@ in {
boot.loader.systemd-boot.extraFiles = bootFiles; boot.loader.systemd-boot.extraFiles = bootFiles;
# ensure the installer has m1n1 in the image # 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"; system.build.m1n1 = bootFiles."m1n1/boot.bin";
}; };

View file

@ -1,5 +1,9 @@
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
imports = [ imports = [
./kernel ./kernel
./mesa ./mesa
@ -8,22 +12,21 @@
./sound ./sound
]; ];
config = config = let
let cfg = config.hardware.asahi;
cfg = config.hardware.asahi; in {
in { nixpkgs.overlays = lib.mkBefore [cfg.overlay];
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
hardware.asahi.pkgs = hardware.asahi.pkgs =
if cfg.pkgsSystem != "aarch64-linux" if cfg.pkgsSystem != "aarch64-linux"
then then
import (pkgs.path) { import (pkgs.path) {
crossSystem.system = "aarch64-linux"; crossSystem.system = "aarch64-linux";
localSystem.system = cfg.pkgsSystem; localSystem.system = cfg.pkgsSystem;
overlays = [ cfg.overlay ]; overlays = [cfg.overlay];
} }
else pkgs; else pkgs;
}; };
options.hardware.asahi = { options.hardware.asahi = {
pkgsSystem = lib.mkOption { pkgsSystem = lib.mkOption {

View file

@ -1,7 +1,10 @@
# the Asahi Linux kernel and options that must go along with it # the Asahi Linux kernel and options that must go along with it
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
config = { config = {
boot.kernelPackages = let boot.kernelPackages = let
pkgs' = config.hardware.asahi.pkgs; pkgs' = config.hardware.asahi.pkgs;

View file

@ -1,7 +1,10 @@
# the Asahi Linux edge config and options that must go along with it # 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 { config = lib.mkIf config.hardware.asahi.addEdgeKernelConfig {
boot.kernelPatches = [ boot.kernelPatches = [
{ {

View file

@ -1,37 +1,42 @@
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
config = let config = let
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver
&& config.hardware.asahi.experimentalGPUInstallMode == mode); && config.hardware.asahi.experimentalGPUInstallMode == mode);
in lib.mkMerge [ in
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver { 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 # required for GPU kernel driver
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers; hardware.asahi.addEdgeKernelConfig = true;
})
# required for GPU kernel driver (lib.mkIf (isMode "replace") {
hardware.asahi.addEdgeKernelConfig = true; # replace the Mesa linked into system packages with the Asahi version
}) # without rebuilding them to avoid rebuilding the world.
(lib.mkIf (isMode "replace") { system.replaceRuntimeDependencies = [
# replace the Mesa linked into system packages with the Asahi version {
# without rebuilding them to avoid rebuilding the world. original = pkgs.mesa;
system.replaceRuntimeDependencies = [ replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
{ 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,
(lib.mkIf (isMode "overlay") { # which requires rebuilding the world but ensures it is done faithfully
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay, # (and in a way compatible with pure evaluation)
# which requires rebuilding the world but ensures it is done faithfully nixpkgs.overlays = [
# (and in a way compatible with pure evaluation) (final: prev: {
nixpkgs.overlays = [ mesa = final.mesa-asahi-edge;
(final: prev: { })
mesa = final.mesa-asahi-edge; ];
}) })
]; ];
})
];
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption { options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@ -44,7 +49,7 @@
}; };
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption { options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
type = lib.types.enum [ "driver" "replace" "overlay" ]; type = lib.types.enum ["driver" "replace" "overlay"];
default = "replace"; default = "replace";
description = '' description = ''
Mode to use to install the experimental GPU driver into the system. Mode to use to install the experimental GPU driver into the system.

View file

@ -1,8 +1,13 @@
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
config = { config = {
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [ assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
{ assertion = config.hardware.asahi.peripheralFirmwareDirectory != null; {
assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
message = '' message = ''
Asahi peripheral firmware extraction is enabled but the firmware Asahi peripheral firmware extraction is enabled but the firmware
location appears incorrect. location appears incorrect.
@ -14,11 +19,11 @@
pkgs' = config.hardware.asahi.pkgs; pkgs' = config.hardware.asahi.pkgs;
in in
lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null) lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null)
&& config.hardware.asahi.extractPeripheralFirmware) [ && config.hardware.asahi.extractPeripheralFirmware) [
(pkgs.stdenv.mkDerivation { (pkgs.stdenv.mkDerivation {
name = "asahi-peripheral-firmware"; name = "asahi-peripheral-firmware";
nativeBuildInputs = [ pkgs'.asahi-fwextract pkgs.cpio ]; nativeBuildInputs = [pkgs'.asahi-fwextract pkgs.cpio];
buildCommand = '' buildCommand = ''
mkdir extracted mkdir extracted
@ -45,7 +50,8 @@
peripheralFirmwareDirectory = lib.mkOption { peripheralFirmwareDirectory = lib.mkOption {
type = lib.types.nullOr lib.types.path; 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 # path when the system is operating normally
/boot/asahi /boot/asahi

View file

@ -1,13 +1,16 @@
{ config, pkgs, lib, ... }:
{ {
config,
pkgs,
lib,
...
}: {
options.hardware.asahi = { options.hardware.asahi = {
setupAlsaUcm = lib.mkOption { setupAlsaUcm = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = config.sound.enable; default = config.sound.enable;
description = '' description = ''
Enable the Asahi-specific ALSA UCM2 configs in the global environment Enable the Asahi-specific ALSA UCM2 configs in the global environment
so that headphone jack input and output work properly. so that headphone jack input and output work properly.
''; '';
}; };
}; };

View file

@ -1,8 +1,8 @@
{ lib {
, fetchFromGitHub lib,
, alsa-ucm-conf }: fetchFromGitHub,
alsa-ucm-conf,
(alsa-ucm-conf.overrideAttrs (oldAttrs: rec { }: (alsa-ucm-conf.overrideAttrs (oldAttrs: rec {
version = "3"; version = "3";
src_asahi = fetchFromGitHub { src_asahi = fetchFromGitHub {
@ -12,8 +12,11 @@
rev = "v${version}"; rev = "v${version}";
hash = "sha256-TCCT0AJx0SdnTzzBaV94zuD2hrPqvk+9vTTuEQmpJjc="; hash = "sha256-TCCT0AJx0SdnTzzBaV94zuD2hrPqvk+9vTTuEQmpJjc=";
}; };
postInstall = oldAttrs.postInstall or "" + '' postInstall =
cp -r ${src_asahi}/ucm2 $out/share/alsa oldAttrs.postInstall
''; or ""
+ ''
cp -r ${src_asahi}/ucm2 $out/share/alsa
'';
})) }))

View file

@ -1,11 +1,11 @@
{ lib {
, python3 lib,
, fetchFromGitHub python3,
, gzip fetchFromGitHub,
, gnutar gzip,
, lzfse gnutar,
lzfse,
}: }:
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "asahi-fwextract"; pname = "asahi-fwextract";
version = "0.6.9"; version = "0.6.9";
@ -26,7 +26,7 @@ python3.pkgs.buildPythonApplication rec {
--replace '"xf"' '"-x", "-I", "${gzip}/bin/gzip", "-f"' --replace '"xf"' '"-x", "-I", "${gzip}/bin/gzip", "-f"'
''; '';
nativeBuildInputs = [ python3.pkgs.setuptools ]; nativeBuildInputs = [python3.pkgs.setuptools];
doCheck = false; doCheck = false;
} }

View file

@ -1,145 +1,194 @@
{ lib {
, pkgs lib,
, callPackage pkgs,
, writeShellScriptBin callPackage,
, writeText writeShellScriptBin,
, removeReferencesTo writeText,
, linuxPackagesFor removeReferencesTo,
, _4KBuild ? false linuxPackagesFor,
, withRust ? false _4KBuild ? false,
, _kernelPatches ? [ ] withRust ? false,
}: _kernelPatches ? [],
}: let
let
i = builtins.elemAt; i = builtins.elemAt;
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig # parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
# into a list of k, v tuples # into a list of k, v tuples
parseExtraConfig = config: parseExtraConfig = config: let
let lines =
lines = builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
builtins.filter (s: s != "") (lib.strings.splitString "\n" config); parseLine = line: let
parseLine = line: let t = lib.strings.splitString " " line;
t = lib.strings.splitString " " line; join = l:
join = l: builtins.foldl' (a: b: "${a} ${b}") builtins.foldl' (a: b: "${a} ${b}")
(builtins.head l) (builtins.tail l); (builtins.head l) (builtins.tail l);
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1); v =
in [ "CONFIG_${i t 0}" v ]; if (builtins.length t) > 2
in map parseLine lines; 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" # parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
# style configuration as found in a patch's extraStructuredConfig into # style configuration as found in a patch's extraStructuredConfig into
# a list of k, v tuples # a list of k, v tuples
parseExtraStructuredConfig = config: lib.attrsets.mapAttrsToList parseExtraStructuredConfig = config:
(k: v: [ "CONFIG_${k}" (v.tristate or v.freeform) ] ) config; lib.attrsets.mapAttrsToList
(k: v: ["CONFIG_${k}" (v.tristate or v.freeform)])
config;
parsePatchConfig = { extraConfig ? "", extraStructuredConfig ? {}, ... }: parsePatchConfig = {
(parseExtraConfig extraConfig) ++ extraConfig ? "",
(parseExtraStructuredConfig extraStructuredConfig); extraStructuredConfig ? {},
...
}:
(parseExtraConfig extraConfig)
++ (parseExtraStructuredConfig extraStructuredConfig);
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file # parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
# into a list of k, v tuples # into a list of k, v tuples
parseConfig = config: parseConfig = config: let
let parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")''; # get either the [ymn] option or the "foo" option; whichever matched
# get either the [ymn] option or the "foo" option; whichever matched t = l: let
t = l: let v = (i l 2); in [ (i l 0) (if v != null then v else (i l 3)) ]; v = i l 2;
lines = lib.strings.splitString "\n" config; in [
in map t (builtins.filter (l: l != null) (map parseLine lines)); (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; origConfigfile = ./config;
linux-asahi-pkg = { stdenv, lib, fetchFromGitHub, fetchpatch, linuxKernel, linux-asahi-pkg = {
rustPlatform, rustc, rustfmt, rust-bindgen, ... } @ args: stdenv,
let lib,
origConfigText = builtins.readFile origConfigfile; fetchFromGitHub,
fetchpatch,
linuxKernel,
rustPlatform,
rustc,
rustfmt,
rust-bindgen,
...
} @ args: let
origConfigText = builtins.readFile origConfigfile;
# extraConfig from all patches in order # extraConfig from all patches in order
extraConfig = extraConfig =
lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches; lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches;
# config file text for above # config file text for above
extraConfigText = let extraConfigText = let
text = k: v: if (v == "y") || (v == "m") || (v == "n") text = k: v:
then "${k}=${v}" else ''${k}="${v}"''; if (v == "y") || (v == "m") || (v == "n")
in (map (t: text (i t 0) (i t 1)) extraConfig); then "${k}=${v}"
else ''${k}="${v}"'';
in (map (t: text (i t 0) (i t 1)) extraConfig);
# final config as a text file path # final config as a text file path
configfile = if extraConfig == [] then origConfigfile else configfile =
if extraConfig == []
then origConfigfile
else
writeText "config" '' writeText "config" ''
${origConfigText} ${origConfigText}
# Patches # Patches
${lib.strings.concatStringsSep "\n" extraConfigText} ${lib.strings.concatStringsSep "\n" extraConfigText}
''; '';
# final config as an attrset # final config as an attrset
config = let config = let
makePair = t: lib.nameValuePair (i t 0) (i t 1); makePair = t: lib.nameValuePair (i t 0) (i t 1);
configList = (parseConfig origConfigText) ++ extraConfig; 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 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 { (linuxKernel.manualConfig rec {
inherit stdenv lib; inherit stdenv lib;
version = "6.5.0-asahi"; version = "6.5.0-asahi";
modDirVersion = version; modDirVersion = version;
extraMeta.branch = "6.5"; extraMeta.branch = "6.5";
src = fetchFromGitHub { src = fetchFromGitHub {
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/PKGBUILD # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/PKGBUILD
owner = "AsahiLinux"; owner = "AsahiLinux";
repo = "linux"; repo = "linux";
rev = "asahi-6.5-15"; rev = "asahi-6.5-15";
hash = "sha256-Rruk/Nrw425XerZjgDJ4PJ3c63CCycch1qz7vFxHPCE="; hash = "sha256-Rruk/Nrw425XerZjgDJ4PJ3c63CCycch1qz7vFxHPCE=";
}; };
kernelPatches = [ kernelPatches =
{ name = "rust-bindgen-version"; [
patch = ./rust-bindgen-version.patch; {
} name = "rust-bindgen-version";
] ++ lib.optionals _4KBuild [ patch = ./rust-bindgen-version.patch;
# thanks to Sven Peter }
# https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/ ]
{ name = "sven-iommu-4k"; ++ lib.optionals _4KBuild [
patch = ./sven-iommu-4k.patch; # thanks to Sven Peter
} # https://lore.kernel.org/linux-iommu/20211019163737.46269-1-sven@svenpeter.dev/
(builtins.throw "The Asahi 4K kernel patch is currently broken. Contributions to fix are welcome.") {
] ++ lib.optionals (!_4KBuild) [ name = "sven-iommu-4k";
# patch the kernel to set the default size to 16k instead of modifying patch = ./sven-iommu-4k.patch;
# 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 (builtins.throw "The Asahi 4K kernel patch is currently broken. Contributions to fix are welcome.")
# system architecture ]
{ name = "default-pagesize-16k"; ++ lib.optionals (!_4KBuild) [
patch = ./default-pagesize-16k.patch; # 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
] ++ _kernelPatches; # 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; inherit configfile config;
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then { }
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ // (args.argsOverride or {}))
rust-bindgen .overrideAttrs (old:
rustfmt if withRust
rustc then {
removeReferencesTo nativeBuildInputs =
]; (old.nativeBuildInputs or [])
# HACK: references shouldn't have been there in the first place ++ [
# TODO: remove once 23.05 is obsolete rust-bindgen
postFixup = (old.postFixup or "") + '' rustfmt
if [ -f $dev/lib/modules/${old.version}/build/vmlinux ]; then rustc
remove-references-to -t $out $dev/lib/modules/${old.version}/build/vmlinux removeReferencesTo
fi ];
remove-references-to -t $dev $out/Image # HACK: references shouldn't have been there in the first place
''; # TODO: remove once 23.05 is obsolete
RUST_LIB_SRC = rustPlatform.rustLibSrc; postFixup =
} else {}); (old.postFixup or "")
+ ''
linux-asahi = (callPackage linux-asahi-pkg { }); if [ -f $dev/lib/modules/${old.version}/build/vmlinux ]; then
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi) 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)

View file

@ -1,101 +1,108 @@
{ stdenv {
, buildPackages stdenv,
, lib buildPackages,
, fetchFromGitHub lib,
, python3 fetchFromGitHub,
, dtc python3,
, imagemagick dtc,
, isRelease ? false imagemagick,
, withTools ? true isRelease ? false,
, withChainloading ? false withTools ? true,
, rust-bin ? null withChainloading ? false,
, customLogo ? null 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 src = fetchFromGitHub {
pyenv = python3.withPackages (p: with p; [ # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/m1n1/PKGBUILD
construct owner = "AsahiLinux";
pyserial repo = "m1n1";
]); rev = "v${version}";
hash = "sha256-zPHLlhXUIX6MV2pnDkuSg4Pz8gB4YOZiaa8MuLasgPY=";
fetchSubmodules = true;
};
rustenv = rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override { makeFlags =
targets = [ "aarch64-unknown-none-softfloat" ]; ["ARCH=${stdenv.cc.targetPrefix}"]
}); ++ lib.optional isRelease "RELEASE=1"
in stdenv.mkDerivation rec { ++ lib.optional withChainloading "CHAINLOADING=1";
pname = "m1n1";
version = "1.4.2";
src = fetchFromGitHub { nativeBuildInputs =
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/m1n1/PKGBUILD [
owner = "AsahiLinux"; dtc
repo = "m1n1"; buildPackages.gcc
rev = "v${version}"; ]
hash = "sha256-zPHLlhXUIX6MV2pnDkuSg4Pz8gB4YOZiaa8MuLasgPY="; ++ lib.optional withChainloading rustenv
fetchSubmodules = true; ++ lib.optional (customLogo != null) imagemagick;
};
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ] postPatch = ''
++ lib.optional isRelease "RELEASE=1" substituteInPlace proxyclient/m1n1/asm.py \
++ lib.optional withChainloading "CHAINLOADING=1"; --replace 'aarch64-linux-gnu-' 'aarch64-unknown-linux-gnu-' \
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"'
'';
nativeBuildInputs = [ preConfigure = lib.optionalString (customLogo != null) ''
dtc pushd data &>/dev/null
buildPackages.gcc ln -fs ${customLogo} bootlogo_256.png
] ++ lib.optional withChainloading rustenv if [[ "$(magick identify bootlogo_256.png)" != 'bootlogo_256.png PNG 256x256'* ]]; then
++ lib.optional (customLogo != null) imagemagick; echo "Custom logo is not a 256x256 PNG"
exit 1
fi
postPatch = '' rm bootlogo_128.png
substituteInPlace proxyclient/m1n1/asm.py \ convert bootlogo_256.png -resize 128x128 bootlogo_128.png
--replace 'aarch64-linux-gnu-' 'aarch64-unknown-linux-gnu-' \ patchShebangs --build ./makelogo.sh
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"' ./makelogo.sh
''; popd &>/dev/null
'';
preConfigure = lib.optionalString (customLogo != null) '' installPhase =
pushd data &>/dev/null ''
ln -fs ${customLogo} bootlogo_256.png runHook preInstall
if [[ "$(magick identify bootlogo_256.png)" != 'bootlogo_256.png PNG 256x256'* ]]; then
echo "Custom logo is not a 256x256 PNG"
exit 1
fi
rm bootlogo_128.png mkdir -p $out/build
convert bootlogo_256.png -resize 128x128 bootlogo_128.png cp build/m1n1.bin $out/build
patchShebangs --build ./makelogo.sh ''
./makelogo.sh + (lib.optionalString withTools ''
popd &>/dev/null mkdir -p $out/{bin,script,toolchain-bin}
''; cp -r proxyclient $out/script
cp -r tools $out/script
installPhase = '' for toolpath in $out/script/proxyclient/tools/*.py; do
runHook preInstall 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 GCC=${buildPackages.gcc}
cp build/m1n1.bin $out/build BINUTILS=${buildPackages.binutils-unwrapped}
'' + (lib.optionalString withTools ''
mkdir -p $out/{bin,script,toolchain-bin}
cp -r proxyclient $out/script
cp -r tools $out/script
for toolpath in $out/script/proxyclient/tools/*.py; do ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
tool=$(basename $toolpath .py) ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
script=$out/bin/m1n1-$tool ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/
cat > $script <<EOF ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/
#!/bin/sh ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/
${pyenv}/bin/python $toolpath "\$@" '')
EOF + ''
chmod +x $script runHook postInstall
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
'';
}

View file

@ -1,12 +1,14 @@
{ lib {
, fetchFromGitLab lib,
, mesa }: fetchFromGitLab,
mesa,
}:
(mesa.override { (mesa.override {
galliumDrivers = [ "swrast" "asahi" ]; galliumDrivers = ["swrast" "asahi"];
vulkanDrivers = [ "swrast" ]; vulkanDrivers = ["swrast"];
enableGalliumNine = false; enableGalliumNine = false;
}).overrideAttrs (oldAttrs: { })
.overrideAttrs (oldAttrs: {
# version must be the same length (i.e. no unstable or date) # version must be the same length (i.e. no unstable or date)
# so that system.replaceRuntimeDependencies can work # so that system.replaceRuntimeDependencies can work
version = "23.3.0"; version = "23.3.0";
@ -22,7 +24,8 @@
mesonFlags = mesonFlags =
# remove flag to configure xvmc functionality as having it # remove flag to configure xvmc functionality as having it
# breaks the build because that no longer exists in Mesa 23 # 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 # we do not build any graphics drivers these features can be enabled for
"-Dgallium-va=disabled" "-Dgallium-va=disabled"
"-Dgallium-vdpau=disabled" "-Dgallium-vdpau=disabled"
@ -35,7 +38,10 @@
]; ];
# replace disk cache path patch with one tweaked slightly to apply to this version # replace disk cache path patch with one tweaked slightly to apply to this version
patches = lib.forEach oldAttrs.patches patches =
(p: if lib.hasSuffix "disk_cache-include-dri-driver-path-in-cache-key.patch" p lib.forEach oldAttrs.patches
then ./disk_cache-include-dri-driver-path-in-cache-key.patch else p); (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);
}) })

View file

@ -1,8 +1,8 @@
final: prev: { final: prev: {
linux-asahi = final.callPackage ./linux-asahi { }; linux-asahi = final.callPackage ./linux-asahi {};
m1n1 = final.callPackage ./m1n1 { }; m1n1 = final.callPackage ./m1n1 {};
uboot-asahi = final.callPackage ./uboot-asahi { }; uboot-asahi = final.callPackage ./uboot-asahi {};
asahi-fwextract = final.callPackage ./asahi-fwextract { }; asahi-fwextract = final.callPackage ./asahi-fwextract {};
mesa-asahi-edge = final.callPackage ./mesa-asahi-edge { inherit (prev) mesa; }; 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; }; alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi {inherit (prev) alsa-ucm-conf;};
} }

View file

@ -1,9 +1,9 @@
{ lib {
, fetchFromGitHub lib,
, buildUBoot fetchFromGitHub,
, m1n1 buildUBoot,
m1n1,
}: }:
(buildUBoot rec { (buildUBoot rec {
src = fetchFromGitHub { src = fetchFromGitHub {
# tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/uboot-asahi/PKGBUILD # tracking: https://github.com/AsahiLinux/PKGBUILDs/blob/main/uboot-asahi/PKGBUILD
@ -15,7 +15,7 @@
version = "2023.07.02.asahi3-1"; version = "2023.07.02.asahi3-1";
defconfig = "apple_m1_defconfig"; defconfig = "apple_m1_defconfig";
extraMeta.platforms = [ "aarch64-linux" ]; extraMeta.platforms = ["aarch64-linux"];
filesToInstall = [ filesToInstall = [
"u-boot-nodtb.bin.gz" "u-boot-nodtb.bin.gz"
"m1n1-u-boot.bin" "m1n1-u-boot.bin"
@ -27,9 +27,10 @@
CONFIG_VIDEO_FONT_SUN12X22=n CONFIG_VIDEO_FONT_SUN12X22=n
CONFIG_VIDEO_FONT_16X32=y CONFIG_VIDEO_FONT_16X32=y
''; '';
}).overrideAttrs (o: { })
.overrideAttrs (o: {
# nixos's downstream patches are not applicable # nixos's downstream patches are not applicable
patches = [ patches = [
]; ];
# flag somehow breaks DTC compilation so we remove it # flag somehow breaks DTC compilation so we remove it

View file

@ -1,19 +1,23 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, inputs, outputs, ... }:
{ {
imports = config,
[ # Include the results of the hardware scan. lib,
./hardware-configuration.nix pkgs,
../../common/nixos/common.nix inputs,
../../common/networking/zerotier.nix outputs,
../../common/editors/emacs.nix ...
# Include the necessary packages and configuration for Apple Silicon support. }: {
inputs.apple-silicon.nixosModules.apple-silicon-support 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. # Specify path to peripheral firmware files.
hardware.asahi.peripheralFirmwareDirectory = ./firmware; hardware.asahi.peripheralFirmwareDirectory = ./firmware;
@ -27,11 +31,10 @@
boot.loader.efi.canTouchEfiVariables = false; boot.loader.efi.canTouchEfiVariables = false;
networking.hostName = "farnsworth"; # Define your hostname. 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: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; services.openssh.enable = true;
} }

View file

@ -1,33 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
]; pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "usb_storage" ]; boot.initrd.availableKernelModules = ["xhci_pci" "usb_storage"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ ]; boot.kernelModules = [];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/7d847b27-80ca-4f25-b4f9-8c0425b449b4"; device = "/dev/disk/by-uuid/7d847b27-80ca-4f25-b4f9-8c0425b449b4";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/FC2B-A077"; device = "/dev/disk/by-uuid/FC2B-A077";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ { swapDevices = [
device = "/var/lib/swapfile"; {
size = 8*1024; device = "/var/lib/swapfile";
randomEncryption.enable = true; size = 8 * 1024;
} ]; randomEncryption.enable = true;
}
];
zramSwap = { zramSwap = {
enable = true; enable = true;

View file

@ -1,8 +1,9 @@
# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file # 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 # 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 in
import (fetchTarball { import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
sha256 = lock.narHash; sha256 = lock.narHash;
}) })

View file

@ -1,11 +1,10 @@
# This file defines overlays # This file defines overlays
{ inputs, ... }: {inputs, ...}: {
{
# This one brings our custom packages from the 'pkgs' directory # This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: { additions = final: _prev: {
# nest everything under a namespace that's not likely to collide # nest everything under a namespace that's not likely to collide
# with anything in nixpkgs # with anything in nixpkgs
local-pkgs = import ../pkgs { pkgs = final; }; local-pkgs = import ../pkgs {pkgs = final;};
}; };
# This one contains whatever you want to overlay # This one contains whatever you want to overlay

View file

@ -1,10 +1,9 @@
# Shell for bootstrapping flake-enabled nix and home-manager # Shell for bootstrapping flake-enabled nix and home-manager
# You can enter it through 'nix develop' or (legacy) 'nix-shell' # You can enter it through 'nix develop' or (legacy) 'nix-shell'
{pkgs ? (import ./nixpkgs.nix) {}}: {
{ pkgs ? (import ./nixpkgs.nix) { } }: {
default = pkgs.mkShell { default = pkgs.mkShell {
# Enable experimental features without having to specify the argument # Enable experimental features without having to specify the argument
NIX_CONFIG = "experimental-features = nix-command flakes"; NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [ nix home-manager git just ]; nativeBuildInputs = with pkgs; [nix home-manager git just];
}; };
} }