Refactor/flake dedup and wsl input (#3)
* fix: configure docker for EDaaS WSL VDI
Enable rootful docker with the Docker Desktop proxy patch, add emmathorpe to the docker group, disable resolvconf and enable nix-ld.
* feat: flesh out work module and pin claude-code to nixpkgs unstable
Migrate git config to the settings option, fix the signing key path and email, add argo-rollouts/google-cloud-sdk and other tooling, and enable go. claude-code is sourced from the nixpkgs-unstable overlay.
* chore: update personal git, delta and editor config
Move git config to the settings option, switch to the standalone programs.delta module with git integration, add commitizen, and treat Jenkinsfiles as groovy.
* refactor: dedupe flake with mkHost and add nixos-wsl flake input
Extract a shared mkHost helper to remove duplicated home-manager scaffolding, add nixos-wsl as a flake input so the EDaaS host builds without --impure, source claude-code via a nixpkgs-unstable overlay, and expose a nixfmt formatter output.
* style: format nix files with nixfmt
* refactor: migrate to stable nixpkgs 26.05 and track upstream asahi flake
Pin nixpkgs to nixos-26.05 and home-manager to release-26.05; claude-code stays bleeding-edge via the nixpkgs-unstable overlay.
Centralize allowUnfree and experimental-features in mkHost and pin nix.registry/nixPath to the flake nixpkgs.
Replace the vendored apple-silicon-support module with the nixos-apple-silicon flake input, dropping ~8.8k lines of vendored code.
Fix stable-induced package renames: neofetch -> fastfetch, noto-fonts-emoji -> noto-fonts-color-emoji.
* refactor: adopt flake-parts with host table and scoped unfree
Wrap outputs in flake-parts.lib.mkFlake, replacing forAllSystems boilerplate with systems + perSystem. Drop the unused self argument.
Collapse the three mkHost calls into a hosts attrset mapped with lib.mapAttrs; adding a machine is now a single table entry.
Replace blanket allowUnfree with an allowUnfreePredicate allowlist (claude-code, lens). Add devShells.default (nixfmt, nil, git) and a checks.formatting nixfmt --check gate.
* docs(flake): annotate inputs, mkHost, host table and perSystem
Explanatory comments only; no eval change (drvPath identical).
* refactor(home): split home-manager into focused modules; clarify desktop scope
Break the home.nix monolith into emmathorpe/home/{default,shell,git,editor,desktop}.nix. The host table now composes desktop.nix onto graphical hosts only, so element-desktop, the Sway session vars and cursor theme are no longer installed on the headless WSL host.
Consolidate chat apps: legcord moves from user.nix (system) into the home desktop module alongside element-desktop. The tty1 'exec sway' autostart moves into desktop.nix so it never runs on headless hosts.
Desktop functionality: add xdg.portal (wlr + gtk) in swaywm.nix to enable screen sharing and native file pickers for Element and Firefox under wlroots.
* feat(desktop): declarative Sway config with idle-lock, notifications and bar
Add emmathorpe/home/sway.nix managing wayland.windowManager.sway (package = null, reusing the system Sway wrapper) plus swaylock, swayidle, dunst and an i3status-rust bar. home-manager's systemd integration wires sway-session.target so the swayidle/dunst user services start with the session.
swayidle locks after 5 min, powers outputs off after 10, and locks before sleep. Media/brightness keys use wpctl (pipewire) and brightnessctl; the launcher is sway-launcher-desktop in a floating foot window; keyboard is set to dvorak to match the console.
Move swaylock/swayidle/dunst/i3status-rust out of the system programs.sway extraPackages (now home-managed). Add security.pam.services.swaylock on the MBP host so the lock screen can authenticate (X1 already had it with fingerprint auth).
---------
Co-authored-by: Emma Thorpe <emma.thorpe@citrix.com>
This commit is contained in:
@@ -1 +1,4 @@
|
||||
system/modules/firmware/*
|
||||
|
||||
# vim swap files
|
||||
*.swp
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
{ config, pkgs, inputs, lib, ... }:
|
||||
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
enableVteIntegration = true;
|
||||
autosuggestion.enable = true;
|
||||
historySubstringSearch.enable = true;
|
||||
history.append = true;
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [ "git" "man" "history-substring-search" ];
|
||||
theme = "robbyrussell";
|
||||
};
|
||||
syntaxHighlighting.enable = true;
|
||||
initContent = lib.mkOrder 1500 ''
|
||||
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
exec sway
|
||||
fi
|
||||
if [ "$SSH_CLIENT" ] || [ "$SSH_TTY" ]; then
|
||||
export PS1=%M\ $PS1
|
||||
fi
|
||||
'';
|
||||
envExtra = ''
|
||||
alias cls=clear
|
||||
'';
|
||||
};
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
reverseSplit = true;
|
||||
terminal = "tmux-direct";
|
||||
newSession = true;
|
||||
keyMode = "vi";
|
||||
historyLimit = 50000;
|
||||
mouse = true;
|
||||
extraConfig = ''
|
||||
# Set pane navigation
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
'';
|
||||
};
|
||||
home.stateVersion = "25.05";
|
||||
home.pointerCursor = {
|
||||
gtk.enable = true;
|
||||
x11 = {
|
||||
enable = true;
|
||||
defaultCursor = "Adwaita";
|
||||
};
|
||||
package = pkgs.adwaita-icon-theme;
|
||||
name = "Adwaita";
|
||||
size = 24;
|
||||
};
|
||||
home.packages = [
|
||||
pkgs.element-desktop
|
||||
pkgs.commitizen
|
||||
];
|
||||
home.sessionVariables = {
|
||||
MOZ_USE_XINPUT2 = "1";
|
||||
# only needed for Sway
|
||||
XDG_CURRENT_DESKTOP = "sway";
|
||||
};
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
plugins = with pkgs.vimPlugins; [ nerdtree ale vim-fugitive vim-indent-guides ];
|
||||
settings = {
|
||||
expandtab = false;
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
};
|
||||
extraConfig = ''
|
||||
let g:indent_guides_enable_on_vim_startup = 1
|
||||
if v:version < 802
|
||||
packadd! peaksea
|
||||
endif
|
||||
syntax enable
|
||||
colorscheme peaksea
|
||||
set termguicolors
|
||||
set background=dark
|
||||
au BufNewFile,BufRead *Jenkinsfile setf groovy
|
||||
'';
|
||||
};
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
settings = {
|
||||
user.name = "Emma Thorpe";
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.delta = {
|
||||
enable = true;
|
||||
enableGitIntegration = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# Base home-manager profile, shared by every host (graphical or headless).
|
||||
# Graphical hosts additionally import ./desktop.nix; the work host imports
|
||||
# ../../system/modules/work/default.nix. See the host table in flake.nix.
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./shell.nix
|
||||
./git.nix
|
||||
./editor.nix
|
||||
];
|
||||
|
||||
home.stateVersion = "25.05";
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
# Graphical desktop layer: GUI apps, Wayland session env, cursor theme, and the
|
||||
# tty1 Sway autostart. Imported only on hosts that run Sway (MBP, X1); never
|
||||
# pulled onto the headless WSL host.
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./sway.nix
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
pkgs.element-desktop
|
||||
pkgs.legcord
|
||||
#pkgs.plex-desktop
|
||||
#pkgs.plexamp
|
||||
];
|
||||
|
||||
home.sessionVariables = {
|
||||
MOZ_USE_XINPUT2 = "1";
|
||||
XDG_CURRENT_DESKTOP = "sway";
|
||||
};
|
||||
|
||||
home.pointerCursor = {
|
||||
gtk.enable = true;
|
||||
x11 = {
|
||||
enable = true;
|
||||
defaultCursor = "Adwaita";
|
||||
};
|
||||
package = pkgs.adwaita-icon-theme;
|
||||
name = "Adwaita";
|
||||
size = 24;
|
||||
};
|
||||
|
||||
# Start Sway automatically on the first virtual terminal.
|
||||
programs.zsh.initContent = lib.mkOrder 1500 ''
|
||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
exec sway
|
||||
fi
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Editor: vim as the default $EDITOR. Wanted on every host.
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
nerdtree
|
||||
ale
|
||||
vim-fugitive
|
||||
vim-indent-guides
|
||||
];
|
||||
settings = {
|
||||
expandtab = false;
|
||||
tabstop = 2;
|
||||
shiftwidth = 2;
|
||||
};
|
||||
extraConfig = ''
|
||||
let g:indent_guides_enable_on_vim_startup = 1
|
||||
if v:version < 802
|
||||
packadd! peaksea
|
||||
endif
|
||||
syntax enable
|
||||
colorscheme peaksea
|
||||
set termguicolors
|
||||
set background=dark
|
||||
au BufNewFile,BufRead *Jenkinsfile setf groovy
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# Version control: git + delta pager + commitizen. The work host layers
|
||||
# commit signing and an email override on top (see work/default.nix).
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.commitizen
|
||||
];
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
settings = {
|
||||
user.name = "Emma Thorpe";
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.delta = {
|
||||
enable = true;
|
||||
enableGitIntegration = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# Interactive shell: zsh + tmux. Wanted on every host.
|
||||
{ lib, ... }:
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
enableVteIntegration = true;
|
||||
autosuggestion.enable = true;
|
||||
historySubstringSearch.enable = true;
|
||||
history.append = true;
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
"git"
|
||||
"man"
|
||||
"history-substring-search"
|
||||
];
|
||||
theme = "robbyrussell";
|
||||
};
|
||||
syntaxHighlighting.enable = true;
|
||||
# Prefix the prompt with the hostname over SSH. The graphical autostart
|
||||
# (exec sway on tty1) lives in ./desktop.nix so it never runs on headless
|
||||
# hosts.
|
||||
initContent = lib.mkOrder 1500 ''
|
||||
if [ "$SSH_CLIENT" ] || [ "$SSH_TTY" ]; then
|
||||
export PS1="%M $PS1"
|
||||
fi
|
||||
'';
|
||||
envExtra = ''
|
||||
alias cls=clear
|
||||
'';
|
||||
};
|
||||
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
reverseSplit = true;
|
||||
terminal = "tmux-direct";
|
||||
newSession = true;
|
||||
keyMode = "vi";
|
||||
historyLimit = 50000;
|
||||
mouse = true;
|
||||
extraConfig = ''
|
||||
# Alt+Arrow pane navigation
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
# Declarative Sway window manager, status bar, lock, idle and notifications.
|
||||
# Imported via ./desktop.nix, so only graphical hosts get it.
|
||||
#
|
||||
# The compositor binary, PAM and polkit integration come from the system-level
|
||||
# programs.sway (see ../swaywm.nix); package = null below reuses it instead of
|
||||
# pulling a second Sway. home-manager owns the user config (~/.config/sway) and
|
||||
# wires the systemd user session (sway-session.target), which is what lets the
|
||||
# swayidle/dunst user services start with the desktop.
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
package = null;
|
||||
# `sway --validate` needs a real package; skip it since package = null.
|
||||
checkConfig = false;
|
||||
config = rec {
|
||||
modifier = "Mod4";
|
||||
terminal = "${pkgs.foot}/bin/foot";
|
||||
# Launcher: sway-launcher-desktop running inside a floating foot window.
|
||||
menu = "${pkgs.foot}/bin/foot --app-id=launcher ${pkgs.sway-launcher-desktop}/bin/sway-launcher-desktop";
|
||||
|
||||
input."type:keyboard".xkb_layout = "dvorak";
|
||||
|
||||
window.commands = [
|
||||
{
|
||||
criteria.app_id = "launcher";
|
||||
command = "floating enable, resize set 800 500";
|
||||
}
|
||||
];
|
||||
|
||||
bars = [
|
||||
{
|
||||
position = "top";
|
||||
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
|
||||
fonts = {
|
||||
names = [
|
||||
"Noto Sans"
|
||||
"Font Awesome 6 Free"
|
||||
];
|
||||
size = 11.0;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
keybindings = lib.mkOptionDefault {
|
||||
"${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -f";
|
||||
"Print" = "exec ${pkgs.grim}/bin/grim ~/screenshot-$(date +%F-%H%M%S).png";
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
||||
"XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
|
||||
"XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
|
||||
"XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.swaylock = {
|
||||
enable = true;
|
||||
settings = {
|
||||
color = "1e1e2e";
|
||||
indicator-radius = 100;
|
||||
indicator-thickness = 7;
|
||||
show-failed-attempts = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Lock on idle, turn screens off shortly after, and lock before sleep.
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${pkgs.swaylock}/bin/swaylock -f";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${pkgs.sway}/bin/swaymsg 'output * power off'";
|
||||
resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * power on'";
|
||||
}
|
||||
];
|
||||
events = {
|
||||
before-sleep = "${pkgs.swaylock}/bin/swaylock -f";
|
||||
lock = "${pkgs.swaylock}/bin/swaylock -f";
|
||||
};
|
||||
};
|
||||
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
settings = {
|
||||
global = {
|
||||
font = "Noto Sans 11";
|
||||
frame_color = "#89b4fa";
|
||||
separator_color = "frame";
|
||||
offset = "10x10";
|
||||
corner_radius = 5;
|
||||
};
|
||||
urgency_critical = {
|
||||
frame_color = "#fab387";
|
||||
timeout = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.i3status-rust = {
|
||||
enable = true;
|
||||
bars.default = {
|
||||
theme = "gruvbox-dark";
|
||||
icons = "awesome6";
|
||||
blocks = [
|
||||
{
|
||||
block = "disk_space";
|
||||
path = "/";
|
||||
format = " $icon $available ";
|
||||
}
|
||||
{
|
||||
block = "memory";
|
||||
format = " $icon $mem_used_percents ";
|
||||
}
|
||||
{
|
||||
block = "cpu";
|
||||
interval = 2;
|
||||
}
|
||||
{ block = "sound"; }
|
||||
{ block = "battery"; }
|
||||
{
|
||||
block = "time";
|
||||
interval = 5;
|
||||
format = " $timestamp.datetime(f:'%a %d/%m %R') ";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
+26
-3
@@ -1,4 +1,10 @@
|
||||
{ config, lib, options, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.features.swayDesktop;
|
||||
@@ -24,12 +30,29 @@ in
|
||||
export WINIT_UNIX_BACKEND=x11
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
'';
|
||||
extraPackages = with pkgs; [ brightnessctl foot grim swayidle swaylock i3status-rust sway-launcher-desktop dunst pavucontrol ];
|
||||
# Core Wayland utilities. The lock screen, idle daemon, status bar and
|
||||
# notification daemon are configured per-user in home/sway.nix.
|
||||
extraPackages = with pkgs; [
|
||||
brightnessctl
|
||||
foot
|
||||
grim
|
||||
sway-launcher-desktop
|
||||
pavucontrol
|
||||
];
|
||||
};
|
||||
fonts.packages = with pkgs; [
|
||||
noto-fonts
|
||||
noto-fonts-emoji
|
||||
noto-fonts-color-emoji
|
||||
font-awesome
|
||||
];
|
||||
|
||||
# Desktop portals: enables screen sharing (wlroots) and native file pickers
|
||||
# for Wayland apps such as Element and Firefox.
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
||||
config.common.default = "*";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
+11
-7
@@ -1,4 +1,10 @@
|
||||
{ config, pkgs, inputs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
@@ -6,13 +12,11 @@
|
||||
isNormalUser = true;
|
||||
home = "/home/emmathorpe";
|
||||
description = "Emma Thorpe";
|
||||
extraGroups = [ "wheel" "docker" ];
|
||||
shell = pkgs.zsh;
|
||||
packages = lib.mkIf (config.features.swayDesktop.enable == true) [
|
||||
pkgs.legcord
|
||||
#pkgs.plex-desktop
|
||||
#pkgs.plexamp
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"docker"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
programs.firefox = lib.mkIf (config.features.swayDesktop.enable == true) {
|
||||
enable = true;
|
||||
|
||||
Generated
+104
-7
@@ -1,5 +1,56 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"locked": {
|
||||
"lastModified": 1761640442,
|
||||
"narHash": "sha256-AtrEP6Jmdvrqiv4x2xa5mrtaIp3OEe8uBYCDZDS+hu8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"rev": "4a56054d8ffc173222d09dad23adf4ba946c8884",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778716662,
|
||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -7,31 +58,74 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1780099287,
|
||||
"narHash": "sha256-efIPwVGtIWIjWcznhaop6XN6HxnOL8800hF6CBNvlqQ=",
|
||||
"lastModified": 1780361225,
|
||||
"narHash": "sha256-wnV9ttf4fPWNonBIQmvlrSlNpQYgx5HgWWd007mwIFA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "7d8127d308c3fb9664f7e643eec944be74ebb37d",
|
||||
"rev": "e28654b71096e08c019d4861ca26acb646f583d8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-26.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-apple-silicon": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1780294707,
|
||||
"narHash": "sha256-KZiF/wah9A9N+Pn6t8mScqF0fxLVs+n53/6/IsuqcHM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-apple-silicon",
|
||||
"rev": "7f4b33118d9d2db87b5ce1ad5152bb727a63e340",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-apple-silicon",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1780169171,
|
||||
"narHash": "sha256-3HBYDfBgZ+ph52HS6Ks/bMMwuh2uONIT72sZ1CtLE/s=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "998b2821c30b2938637230916904ceb8757c79e8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779560665,
|
||||
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
|
||||
"lastModified": 1780203844,
|
||||
"narHash": "sha256-K5sT4jTpGs15ADhviMKNBH38REpPf5Q6mM1+N6cArVE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
|
||||
"rev": "b51242d7d43689db2f3be91bd05d5b24fbb469c4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "nixos-26.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
@@ -53,7 +147,10 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"home-manager": "home-manager",
|
||||
"nixos-apple-silicon": "nixos-apple-silicon",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
}
|
||||
|
||||
@@ -2,59 +2,172 @@
|
||||
description = "NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
# Pinned stable channel; the single source of truth for every host.
|
||||
nixpkgs.url = "nixpkgs/nixos-26.05";
|
||||
# Bleeding-edge channel, used only to pull individual packages via overlay.
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
# Home-manager release matched to the stable nixpkgs; `follows` keeps a single nixpkgs eval.
|
||||
home-manager.url = "github:nix-community/home-manager/release-26.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# WSL module for the EDaaS host; flake input avoids the impure <nixos-wsl> NIX_PATH lookup.
|
||||
nixos-wsl.url = "github:nix-community/NixOS-WSL";
|
||||
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Apple Silicon (Asahi) support for the MacBook host.
|
||||
nixos-apple-silicon.url = "github:nix-community/nixos-apple-silicon";
|
||||
nixos-apple-silicon.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Provides mkFlake: the systems/perSystem scaffolding used below.
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, home-manager, ... }: {
|
||||
nixosConfigurations.emmathorpe-mbp = nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./system/machine/MBP-Asahi/configuration.nix
|
||||
./emmathorpe/user.nix
|
||||
./emmathorpe/swaywm.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.emmathorpe = import ./emmathorpe/home.nix;
|
||||
}
|
||||
outputs =
|
||||
inputs@{
|
||||
flake-parts,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
home-manager,
|
||||
nixos-wsl,
|
||||
nixos-apple-silicon,
|
||||
...
|
||||
}:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } (
|
||||
{ lib, ... }:
|
||||
let
|
||||
# claude-code tracks nixpkgs-unstable regardless of the pinned nixpkgs.
|
||||
overlays = [
|
||||
(final: prev: {
|
||||
claude-code =
|
||||
(import nixpkgs-unstable {
|
||||
inherit (prev.stdenv.hostPlatform) system;
|
||||
config.allowUnfree = true;
|
||||
}).claude-code;
|
||||
})
|
||||
];
|
||||
};
|
||||
nixosConfigurations.emmathorpe-x1c = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./system/machine/X1/configuration.nix
|
||||
./emmathorpe/user.nix
|
||||
./emmathorpe/swaywm.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.emmathorpe = import ./emmathorpe/home.nix;
|
||||
}
|
||||
|
||||
# Unfree packages permitted to be built (replaces blanket allowUnfree).
|
||||
unfreePackages = [
|
||||
"claude-code"
|
||||
"lens"
|
||||
"lens-desktop"
|
||||
];
|
||||
};
|
||||
nixosConfigurations.emmathorpe-edaas = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./system/machine/EDaaS/configuration.nix
|
||||
|
||||
# Shared scaffolding for every host: common user, overlays, home-manager.
|
||||
baseModules = [
|
||||
./emmathorpe/user.nix
|
||||
./emmathorpe/swaywm.nix
|
||||
{
|
||||
nixpkgs.overlays = overlays;
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) unfreePackages;
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
# Make `nix shell nixpkgs#...` and <nixpkgs> use the pinned nixpkgs.
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
||||
}
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
}
|
||||
];
|
||||
|
||||
home-manager.users.emmathorpe.imports = [ ./emmathorpe/home.nix ./system/modules/work/default.nix ];
|
||||
# mkHost :: { system, modules } -> nixosSystem
|
||||
# Builds one machine by appending its host-specific modules to the shared
|
||||
# baseModules. `inputs` is threaded into specialArgs so any module can
|
||||
# reach the flake inputs (e.g. the work module uses inputs for claude-code).
|
||||
mkHost =
|
||||
{ system, modules }:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = baseModules ++ modules;
|
||||
};
|
||||
|
||||
# Host table — declarative registry of every machine. To add a host:
|
||||
# give it a name, its `system`, and the list of machine-specific modules.
|
||||
# mapAttrs below turns each entry into a nixosConfiguration of the same name.
|
||||
hosts = {
|
||||
emmathorpe-mbp = {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
./system/machine/MBP-Asahi/configuration.nix
|
||||
nixos-apple-silicon.nixosModules.default
|
||||
./emmathorpe/swaywm.nix
|
||||
{
|
||||
home-manager.users.emmathorpe.imports = [
|
||||
./emmathorpe/home
|
||||
./emmathorpe/home/desktop.nix
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
emmathorpe-x1c = {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./system/machine/X1/configuration.nix
|
||||
./emmathorpe/swaywm.nix
|
||||
{
|
||||
home-manager.users.emmathorpe.imports = [
|
||||
./emmathorpe/home
|
||||
./emmathorpe/home/desktop.nix
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
emmathorpe-edaas = {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./system/machine/EDaaS/configuration.nix
|
||||
nixos-wsl.nixosModules.default
|
||||
./emmathorpe/swaywm.nix
|
||||
{
|
||||
home-manager.users.emmathorpe.imports = [
|
||||
./emmathorpe/home
|
||||
./system/modules/work/default.nix
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
# perSystem is evaluated once per entry in `systems`; `pkgs` is the
|
||||
# nixpkgs instance for that system. Outputs here become per-system
|
||||
# attrsets automatically (e.g. devShells.<system>.default).
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# `nix fmt` formatter for the repo.
|
||||
formatter = pkgs.nixfmt;
|
||||
|
||||
# `nix develop` shell with the tooling needed to hack on this flake.
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
nixfmt
|
||||
nil
|
||||
git
|
||||
];
|
||||
};
|
||||
|
||||
checks.formatting =
|
||||
pkgs.runCommandLocal "check-formatting" { nativeBuildInputs = [ pkgs.nixfmt ]; }
|
||||
''
|
||||
# Generated hardware-configuration.nix files are excluded.
|
||||
nixfmt --check $(find ${./.} -name '*.nix' -not -name 'hardware-configuration.nix') && touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
# Realise the host table: each `hosts` entry becomes a nixosConfiguration.
|
||||
flake.nixosConfigurations = lib.mapAttrs (_name: mkHost) hosts;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
# NixOS-WSL specific options are documented on the NixOS-WSL repository:
|
||||
# https://github.com/nix-community/NixOS-WSL
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
# include NixOS-WSL modules
|
||||
<nixos-wsl/modules>
|
||||
];
|
||||
|
||||
|
||||
wsl = {
|
||||
enable = true;
|
||||
@@ -45,9 +45,7 @@
|
||||
## patch the script
|
||||
systemd.services.docker-desktop-proxy.script = lib.mkForce ''${config.wsl.wslConf.automount.root}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.wslConf.automount.root}/wsl/docker-desktop "C:\Program Files\Docker\Docker\resources"'';
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
features.swayDesktop.enable = false;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
programs.nix-ld.enable = true;
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
|
||||
@@ -2,21 +2,23 @@
|
||||
# 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, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../modules/apple-silicon-support
|
||||
];
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
networking.hostName = "Emma-Asahi"; # Define your hostname.
|
||||
# Pick only one of the below networking options.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
@@ -46,7 +48,9 @@
|
||||
# services.xserver.enable = true;
|
||||
|
||||
features.swayDesktop.enable = true;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Allow swaylock to authenticate (no fingerprint reader on this machine).
|
||||
security.pam.services.swaylock = { };
|
||||
|
||||
# Specify path to peripheral firmware files.
|
||||
hardware.asahi.peripheralFirmwareDirectory = ../../modules/firmware;
|
||||
@@ -94,8 +98,6 @@
|
||||
iptables
|
||||
];
|
||||
|
||||
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
@@ -140,4 +142,3 @@
|
||||
system.stateVersion = "25.05"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
# 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, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
@@ -42,9 +47,6 @@
|
||||
# Enable the X11 windowing system.
|
||||
# services.xserver.enable = true;
|
||||
|
||||
|
||||
|
||||
|
||||
# Configure keymap in X11
|
||||
# services.xserver.xkb.layout = "us";
|
||||
# services.xserver.xkb.options = "eurosign:e,caps:escape";
|
||||
@@ -72,17 +74,13 @@
|
||||
# ];
|
||||
# };
|
||||
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
neofetch
|
||||
fastfetch
|
||||
# wget
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
@@ -127,7 +125,6 @@
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "24.11"; # Did you read the comment?
|
||||
|
||||
|
||||
# TODO: Move to fprint security module to import anywhere
|
||||
services.fprintd.enable = true;
|
||||
security.pam.services.swaylock = {
|
||||
@@ -135,4 +132,3 @@
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./modules/default.nix
|
||||
];
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
pkgs' = config.hardware.asahi.pkgs;
|
||||
|
||||
bootM1n1 = pkgs'.m1n1.override {
|
||||
isRelease = true;
|
||||
withTools = false;
|
||||
customLogo = config.boot.m1n1CustomLogo;
|
||||
};
|
||||
|
||||
bootUBoot = pkgs'.uboot-asahi.override {
|
||||
m1n1 = bootM1n1;
|
||||
};
|
||||
|
||||
bootFiles = {
|
||||
"m1n1/boot.bin" = pkgs.runCommand "boot.bin" {} ''
|
||||
cat ${bootM1n1}/build/m1n1.bin > $out
|
||||
cat ${config.boot.kernelPackages.kernel}/dtbs/apple/*.dtb >> $out
|
||||
cat ${bootUBoot}/u-boot-nodtb.bin.gz >> $out
|
||||
if [ -n "${config.boot.m1n1ExtraOptions}" ]; then
|
||||
echo '${config.boot.m1n1ExtraOptions}' >> $out
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in {
|
||||
config = lib.mkIf config.hardware.asahi.enable {
|
||||
# install m1n1 with the boot loader
|
||||
boot.loader.grub.extraFiles = bootFiles;
|
||||
boot.loader.systemd-boot.extraFiles = bootFiles;
|
||||
|
||||
# ensure the installer has m1n1 in the image
|
||||
system.extraDependencies = lib.mkForce [ bootM1n1 bootUBoot ];
|
||||
system.build.m1n1 = bootFiles."m1n1/boot.bin";
|
||||
};
|
||||
|
||||
options.boot = {
|
||||
m1n1ExtraOptions = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Append extra options to the m1n1 boot binary. Might be useful for fixing
|
||||
display problems on Mac minis.
|
||||
https://github.com/AsahiLinux/m1n1/issues/159
|
||||
'';
|
||||
};
|
||||
|
||||
m1n1CustomLogo = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Custom logo to build into m1n1. The path must point to a 256x256 PNG.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./kernel
|
||||
./mesa
|
||||
./peripheral-firmware
|
||||
./boot-m1n1
|
||||
./sound
|
||||
];
|
||||
|
||||
config = let
|
||||
cfg = config.hardware.asahi;
|
||||
in lib.mkIf cfg.enable {
|
||||
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
|
||||
|
||||
# patch systemd-boot to boot in Apple Silicon UEFI environment.
|
||||
# This regression only appeared in systemd 256.7.
|
||||
# see https://github.com/NixOS/nixpkgs/pull/355290
|
||||
# and https://github.com/systemd/systemd/issues/35026
|
||||
systemd.package = let
|
||||
systemdBroken = (pkgs.systemd.version == "256.7");
|
||||
|
||||
systemdPatched = pkgs.systemd.overrideAttrs (old: {
|
||||
patches = let
|
||||
oldPatches = (old.patches or []);
|
||||
# not sure why there are non-paths in there but oh well
|
||||
patchNames = (builtins.map (p: if ((builtins.typeOf p) == "path") then builtins.baseNameOf p else "") oldPatches);
|
||||
fixName = "0019-Revert-boot-Make-initrd_prepare-semantically-equival.patch";
|
||||
alreadyPatched = builtins.elem fixName patchNames;
|
||||
in oldPatches ++ lib.optionals (!alreadyPatched) [
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/125e99477b0ac0a54b7cddc6c5a704821a3074c7/pkgs/os-specific/linux/systemd/${fixName}";
|
||||
hash = "sha256-UW3DZiaykQUUNcGA5UFxN+/wgNSW3ufxDDCZ7emD16o=";
|
||||
})
|
||||
];
|
||||
});
|
||||
in if systemdBroken then systemdPatched else pkgs.systemd;
|
||||
|
||||
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 = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable the basic Asahi Linux components, such as kernel and boot setup.
|
||||
'';
|
||||
};
|
||||
|
||||
pkgsSystem = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "aarch64-linux";
|
||||
description = ''
|
||||
System architecture that should be used to build the major Asahi
|
||||
packages, if not the default aarch64-linux. This allows installing from
|
||||
a cross-built ISO without rebuilding them during installation.
|
||||
'';
|
||||
};
|
||||
|
||||
pkgs = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
description = ''
|
||||
Package set used to build the major Asahi packages. Defaults to the
|
||||
ambient set if not cross-built, otherwise re-imports the ambient set
|
||||
with the system defined by `hardware.asahi.pkgsSystem`.
|
||||
'';
|
||||
};
|
||||
|
||||
overlay = lib.mkOption {
|
||||
type = lib.mkOptionType {
|
||||
name = "nixpkgs-overlay";
|
||||
description = "nixpkgs overlay";
|
||||
check = lib.isFunction;
|
||||
merge = lib.mergeOneOption;
|
||||
};
|
||||
default = import ../packages/overlay.nix;
|
||||
defaultText = "overlay provided with the module";
|
||||
description = ''
|
||||
The nixpkgs overlay for asahi packages.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
# the Asahi Linux kernel and options that must go along with it
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config = lib.mkIf config.hardware.asahi.enable {
|
||||
boot.kernelPackages = let
|
||||
pkgs' = config.hardware.asahi.pkgs;
|
||||
in
|
||||
pkgs'.linux-asahi.override {
|
||||
_kernelPatches = config.boot.kernelPatches;
|
||||
withRust = config.hardware.asahi.withRust;
|
||||
};
|
||||
|
||||
# we definitely want to use CONFIG_ENERGY_MODEL, and
|
||||
# schedutil is a prerequisite for using it
|
||||
# source: https://www.kernel.org/doc/html/latest/scheduler/sched-energy.html
|
||||
powerManagement.cpuFreqGovernor = lib.mkOverride 800 "schedutil";
|
||||
|
||||
boot.initrd.includeDefaultModules = false;
|
||||
boot.initrd.availableKernelModules = [
|
||||
# list of initrd modules stolen from
|
||||
# https://github.com/AsahiLinux/asahi-scripts/blob/f461f080a1d2575ae4b82879b5624360db3cff8c/initcpio/install/asahi
|
||||
"apple-mailbox"
|
||||
"nvme_apple"
|
||||
"pinctrl-apple-gpio"
|
||||
"macsmc"
|
||||
"macsmc-rtkit"
|
||||
"i2c-pasemi-platform"
|
||||
"tps6598x"
|
||||
"apple-dart"
|
||||
"dwc3"
|
||||
"dwc3-of-simple"
|
||||
"xhci-pci"
|
||||
"pcie-apple"
|
||||
"gpio_macsmc"
|
||||
"phy-apple-atc"
|
||||
"nvmem_apple_efuses"
|
||||
"spi-apple"
|
||||
"spi-hid-apple"
|
||||
"spi-hid-apple-of"
|
||||
"rtc-macsmc"
|
||||
"simple-mfd-spmi"
|
||||
"spmi-apple-controller"
|
||||
"nvmem_spmi_mfd"
|
||||
"apple-dockchannel"
|
||||
"dockchannel-hid"
|
||||
"apple-rtkit-helper"
|
||||
|
||||
# additional stuff necessary to boot off USB for the installer
|
||||
# and if the initrd (i.e. stage 1) goes wrong
|
||||
"usb-storage"
|
||||
"xhci-plat-hcd"
|
||||
"usbhid"
|
||||
"hid_generic"
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
"earlycon"
|
||||
"console=ttySAC0,115200n8"
|
||||
"console=tty0"
|
||||
"boot.shell_on_fail"
|
||||
# Apple's SSDs are slow (~dozens of ms) at processing flush requests which
|
||||
# slows down programs that make a lot of fsync calls. This parameter sets
|
||||
# a delay in ms before actually flushing so that such requests can be
|
||||
# coalesced. Be warned that increasing this parameter above zero (default
|
||||
# is 1000) has the potential, though admittedly unlikely, risk of
|
||||
# UNBOUNDED data corruption in case of power loss!!!! Don't even think
|
||||
# about it on desktops!!
|
||||
"nvme_apple.flush_interval=0"
|
||||
];
|
||||
|
||||
# U-Boot does not support EFI variables
|
||||
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
|
||||
|
||||
# U-Boot does not support switching console mode
|
||||
boot.loader.systemd-boot.consoleMode = "0";
|
||||
|
||||
# GRUB has to be installed as removable if the user chooses to use it
|
||||
boot.loader.grub = lib.mkDefault {
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
device = "nodev";
|
||||
};
|
||||
|
||||
# autosuspend was enabled as safe for the PCI SD card reader
|
||||
# "Genesys Logic, Inc GL9755 SD Host Controller [17a0:9755] (rev 01)"
|
||||
# by recent systemd versions, but this has a "negative interaction"
|
||||
# with our kernel/SoC and causes random boot hangs. disable it!
|
||||
services.udev.extraHwdb = ''
|
||||
pci:v000017A0d00009755*
|
||||
ID_AUTOSUSPEND=0
|
||||
'';
|
||||
};
|
||||
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule [ "hardware" "asahi" "addEdgeKernelConfig" ]
|
||||
"All edge kernel config options are now the default.")
|
||||
];
|
||||
|
||||
options.hardware.asahi.withRust = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Build the Asahi Linux kernel with Rust support.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
{ options, config, pkgs, lib, ... }:
|
||||
{
|
||||
config = let
|
||||
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver
|
||||
&& config.hardware.asahi.experimentalGPUInstallMode == mode);
|
||||
in lib.mkIf config.hardware.asahi.enable (lib.mkMerge [
|
||||
{
|
||||
# required for proper DRM setup even without GPU driver
|
||||
services.xserver.config = ''
|
||||
Section "OutputClass"
|
||||
Identifier "appledrm"
|
||||
MatchDriver "apple"
|
||||
Driver "modesetting"
|
||||
Option "PrimaryGPU" "true"
|
||||
EndSection
|
||||
'';
|
||||
}
|
||||
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
|
||||
# install the Asahi Mesa version
|
||||
hardware.graphics.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
|
||||
# required for in-kernel GPU driver
|
||||
hardware.asahi.withRust = true;
|
||||
})
|
||||
]);
|
||||
|
||||
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Use the experimental Asahi Mesa GPU driver.
|
||||
|
||||
Do not report issues using this driver under NixOS to the Asahi project.
|
||||
'';
|
||||
};
|
||||
|
||||
# hopefully no longer used, should be deprecated eventually
|
||||
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
|
||||
type = lib.types.enum [ "driver" "replace" "overlay" ];
|
||||
default = "replace";
|
||||
description = ''
|
||||
Mode to use to install the experimental GPU driver into the system.
|
||||
|
||||
driver: install only as a driver, do not replace system Mesa.
|
||||
Causes issues with certain programs like Plasma Wayland.
|
||||
|
||||
replace (default): use replaceRuntimeDependencies to replace system Mesa with Asahi Mesa.
|
||||
Does not work in pure evaluation context (i.e. in flakes by default).
|
||||
|
||||
overlay: overlay system Mesa with Asahi Mesa
|
||||
Requires rebuilding the world.
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config = lib.mkIf config.hardware.asahi.enable {
|
||||
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
|
||||
{ assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
|
||||
message = ''
|
||||
Asahi peripheral firmware extraction is enabled but the firmware
|
||||
location appears incorrect.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
hardware.firmware = let
|
||||
pkgs' = config.hardware.asahi.pkgs;
|
||||
in
|
||||
lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null)
|
||||
&& config.hardware.asahi.extractPeripheralFirmware) [
|
||||
(pkgs.stdenv.mkDerivation {
|
||||
name = "asahi-peripheral-firmware";
|
||||
|
||||
nativeBuildInputs = [ pkgs'.asahi-fwextract pkgs.cpio ];
|
||||
|
||||
buildCommand = ''
|
||||
mkdir extracted
|
||||
asahi-fwextract ${config.hardware.asahi.peripheralFirmwareDirectory} extracted
|
||||
|
||||
mkdir -p $out/lib/firmware
|
||||
cat extracted/firmware.cpio | cpio -id --quiet --no-absolute-filenames
|
||||
mv vendorfw/* $out/lib/firmware
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
options.hardware.asahi = {
|
||||
extractPeripheralFirmware = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Automatically extract the non-free non-redistributable peripheral
|
||||
firmware necessary for features like Wi-Fi.
|
||||
'';
|
||||
};
|
||||
|
||||
peripheralFirmwareDirectory = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
|
||||
default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null
|
||||
[
|
||||
# path when the system is operating normally
|
||||
/boot/asahi
|
||||
# path when the system is mounted in the installer
|
||||
/mnt/boot/asahi
|
||||
];
|
||||
|
||||
description = ''
|
||||
Path to the directory containing the non-free non-redistributable
|
||||
peripheral firmware necessary for features like Wi-Fi. Ordinarily, this
|
||||
will automatically point to the appropriate location on the ESP. Flake
|
||||
users and those interested in maximum purity will want to copy those
|
||||
files elsewhere and specify this manually.
|
||||
|
||||
Currently, this consists of the files `all-firmware.tar.gz` and
|
||||
`kernelcache*`. The official Asahi Linux installer places these files
|
||||
in the `asahi` directory of the EFI system partition when creating it.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
{ config, options, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
options.hardware.asahi = {
|
||||
setupAsahiSound = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.hardware.asahi.enable;
|
||||
description = ''
|
||||
Set up the Asahi DSP components so that the speakers and headphone jack
|
||||
work properly and safely.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.hardware.asahi;
|
||||
|
||||
asahi-audio = pkgs.asahi-audio; # the asahi-audio we use
|
||||
|
||||
lsp-plugins = pkgs.lsp-plugins;
|
||||
|
||||
lsp-plugins-is-safe = (pkgs.lib.versionAtLeast lsp-plugins.version "1.2.14");
|
||||
|
||||
lv2Path = lib.makeSearchPath "lib/lv2" [ lsp-plugins pkgs.bankstown-lv2 ];
|
||||
in lib.mkIf (cfg.setupAsahiSound && cfg.enable) (lib.mkMerge [
|
||||
{
|
||||
# can't be used by Asahi sound infrastructure
|
||||
services.pulseaudio.enable = false;
|
||||
# enable pipewire to run real-time and avoid audible glitches
|
||||
security.rtkit.enable = true;
|
||||
# set up pipewire with the supported capabilities (instead of pulseaudio)
|
||||
# and asahi-audio configs and plugins
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
pulse.enable = true;
|
||||
|
||||
configPackages = [ asahi-audio ];
|
||||
extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ];
|
||||
|
||||
wireplumber = {
|
||||
enable = true;
|
||||
|
||||
configPackages = [ asahi-audio ];
|
||||
extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ];
|
||||
};
|
||||
};
|
||||
|
||||
# set up enivronment so that UCM configs are used as well
|
||||
environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2";
|
||||
systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2;
|
||||
systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2;
|
||||
|
||||
# enable speakersafetyd to protect speakers
|
||||
systemd.packages = lib.mkAssert lsp-plugins-is-safe
|
||||
"lsp-plugins is unpatched/outdated and speakers cannot be safely enabled"
|
||||
[ pkgs.speakersafetyd ];
|
||||
services.udev.packages = [ pkgs.speakersafetyd ];
|
||||
|
||||
# asahi-sound requires wireplumber 0.5.2 or above
|
||||
# https://github.com/AsahiLinux/asahi-audio/commit/29ec1056c18193ffa09a990b1b61ed273e97fee6
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.versionAtLeast pkgs.wireplumber.version "0.5.2";
|
||||
message = "wireplumber >= 0.5.2 is required for sound with nixos-apple-silicon.";
|
||||
}
|
||||
];
|
||||
}
|
||||
]);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, alsa-ucm-conf
|
||||
}:
|
||||
|
||||
(alsa-ucm-conf.overrideAttrs (oldAttrs: let
|
||||
versionAsahi = "5";
|
||||
|
||||
srcAsahi = fetchFromGitHub {
|
||||
# tracking: https://src.fedoraproject.org/rpms/alsa-ucm-asahi
|
||||
owner = "AsahiLinux";
|
||||
repo = "alsa-ucm-conf-asahi";
|
||||
rev = "v${versionAsahi}";
|
||||
hash = "sha256-daUNz5oUrPfSMO0Tqq/WbtiLHMOtPeQQlI+juGrhTxw=";
|
||||
};
|
||||
in {
|
||||
name = "${oldAttrs.pname}-${oldAttrs.version}-asahi-${versionAsahi}";
|
||||
|
||||
postInstall = oldAttrs.postInstall or "" + ''
|
||||
cp -r ${srcAsahi}/ucm2 $out/share/alsa
|
||||
'';
|
||||
}))
|
||||
@@ -1,37 +0,0 @@
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "asahi-audio";
|
||||
# tracking: https://src.fedoraproject.org/rpms/asahi-audio
|
||||
version = "2.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "AsahiLinux";
|
||||
repo = "asahi-audio";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-u+Ef2vA/EQ3b5wsCNPOGEPUk/Vah0mS71gDVhCLBq+g=";
|
||||
};
|
||||
|
||||
preBuild = ''
|
||||
export PREFIX=$out
|
||||
|
||||
readarray -t configs < <(\
|
||||
find . \
|
||||
-name '*.conf' -or \
|
||||
-name '*.json' -or \
|
||||
-name '*.lua'
|
||||
)
|
||||
|
||||
substituteInPlace "''${configs[@]}" --replace \
|
||||
"/usr/share/asahi-audio" \
|
||||
"$out/asahi-audio"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# no need to link the asahi-audio dir globally
|
||||
mv $out/share/asahi-audio $out
|
||||
'';
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{ lib
|
||||
, python3
|
||||
, fetchFromGitHub
|
||||
, gzip
|
||||
, gnutar
|
||||
, lzfse
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "asahi-fwextract";
|
||||
version = "0.7.8";
|
||||
|
||||
# tracking version: https://packages.fedoraproject.org/pkgs/asahi-installer/python3-asahi_firmware/
|
||||
src = fetchFromGitHub {
|
||||
owner = "AsahiLinux";
|
||||
repo = "asahi-installer";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-UmgHWKIRbcg9PK44YPPM4tyuEDC0+ANKO3Mzc4N9RHo=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace asahi_firmware/img4.py \
|
||||
--replace 'liblzfse.so' '${lzfse}/lib/liblzfse.so'
|
||||
substituteInPlace asahi_firmware/update.py \
|
||||
--replace '"tar"' '"${gnutar}/bin/tar"' \
|
||||
--replace '"xf"' '"-x", "-I", "${gzip}/bin/gzip", "-f"'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ python3.pkgs.setuptools ];
|
||||
|
||||
doCheck = false;
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
From 0fcdbacd8b06c24f5761a0cf9cb0c43cad05c19b Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Watson <twatson52@icloud.com>
|
||||
Date: Mon, 26 Feb 2024 19:51:12 -0600
|
||||
Subject: [PATCH] fs/fcntl: accept more values as F_DUPFD_CLOEXEC args
|
||||
|
||||
libwebrtc doesn't pass anything as the arg to this function so the
|
||||
minimum fd ends up as random garbage. If it's bigger than the maximum
|
||||
fd, which is likely, then the duplication fails, and libwebrtc breaks.
|
||||
|
||||
The previous patch (081abc5fa701738699705a6c0a41c824df77cb37) rejects
|
||||
args >= 1024 (the default soft max fd) and instead subtitutes a minimum
|
||||
fd of 0 to allow such requests to succeed.
|
||||
|
||||
However, gnulib's test suite can pass the following values and expects
|
||||
them to fail; this patch prevents those from succeeding:
|
||||
* -1 (hard-coded)
|
||||
* 1024 (`ulimit -n` value by default)
|
||||
* 1048576 (`ulimit -n` value in Nix build sandbox)
|
||||
|
||||
Hopefully the garbage values libwebrtc passes do not match very often.
|
||||
---
|
||||
fs/fcntl.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/fcntl.c b/fs/fcntl.c
|
||||
index f18f87419445..65a6861476ec 100644
|
||||
--- a/fs/fcntl.c
|
||||
+++ b/fs/fcntl.c
|
||||
@@ -326,7 +326,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
|
||||
err = f_dupfd(argi, filp, 0);
|
||||
break;
|
||||
case F_DUPFD_CLOEXEC:
|
||||
- if (arg >= 1024)
|
||||
+ if ((arg > 1024) && (argi != 1048576) && (argi != -1))
|
||||
argi = 0; /* Lol libwebrtc */
|
||||
err = f_dupfd(argi, filp, O_CLOEXEC);
|
||||
break;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,122 +0,0 @@
|
||||
{ lib
|
||||
, pkgs
|
||||
, callPackage
|
||||
, writeShellScriptBin
|
||||
, writeText
|
||||
, linuxPackagesFor
|
||||
, 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;
|
||||
|
||||
# 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;
|
||||
|
||||
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));
|
||||
|
||||
origConfigfile = ./config;
|
||||
|
||||
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);
|
||||
|
||||
# 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
|
||||
configAttrs = 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;
|
||||
|
||||
version = "6.13.5-asahi";
|
||||
modDirVersion = version;
|
||||
extraMeta.branch = "6.13";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification)
|
||||
owner = "AsahiLinux";
|
||||
repo = "linux";
|
||||
rev = "asahi-6.13.5-4";
|
||||
hash = "sha256-/IOYOLLR9XOdCPcYN3txtEzvoY2HZQ7MpgOdNACwfJc=";
|
||||
};
|
||||
|
||||
kernelPatches = [
|
||||
{ name = "coreutils-fix";
|
||||
patch = ./0001-fs-fcntl-accept-more-values-as-F_DUPFD_CLOEXEC-args.patch;
|
||||
}
|
||||
] ++ _kernelPatches;
|
||||
|
||||
inherit configfile;
|
||||
# hide Rust support from the nixpkgs infra to avoid it re-adding the rust packages.
|
||||
# we can't use it until it's in stable and until we've evaluated the cross-compilation impact.
|
||||
config = configAttrs // { "CONFIG_RUST" = "n"; };
|
||||
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
||||
rust-bindgen
|
||||
rustfmt
|
||||
rustc
|
||||
];
|
||||
RUST_LIB_SRC = rustPlatform.rustLibSrc;
|
||||
} else {});
|
||||
|
||||
linux-asahi = (callPackage linux-asahi-pkg { });
|
||||
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
{ 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
|
||||
]);
|
||||
|
||||
rustenv = rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
|
||||
targets = [ "aarch64-unknown-none-softfloat" ];
|
||||
});
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "m1n1";
|
||||
version = "1.4.21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://src.fedoraproject.org/rpms/m1n1
|
||||
owner = "AsahiLinux";
|
||||
repo = "m1n1";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-PEjTaSwcsV8PzM9a3rDWMYXGX9FlrM0oeElrP5HYRPg=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ]
|
||||
++ lib.optional isRelease "RELEASE=1"
|
||||
++ lib.optional withChainloading "CHAINLOADING=1";
|
||||
|
||||
nativeBuildInputs = [
|
||||
dtc
|
||||
buildPackages.gcc
|
||||
] ++ lib.optional withChainloading rustenv
|
||||
++ lib.optional (customLogo != null) imagemagick;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace proxyclient/m1n1/asm.py \
|
||||
--replace 'aarch64-linux-gnu-' 'aarch64-unknown-linux-gnu-' \
|
||||
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"'
|
||||
'';
|
||||
|
||||
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
|
||||
|
||||
rm bootlogo_128.png
|
||||
convert bootlogo_256.png -resize 128x128 bootlogo_128.png
|
||||
patchShebangs --build ./makelogo.sh
|
||||
./makelogo.sh
|
||||
popd &>/dev/null
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
'';
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
{ lib
|
||||
, fetchFromGitLab
|
||||
, mesa
|
||||
}:
|
||||
|
||||
(mesa.override {
|
||||
galliumDrivers = [ "softpipe" "llvmpipe" "asahi" ];
|
||||
vulkanDrivers = [ "swrast" "asahi" ];
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
version = "25.1.0-asahi";
|
||||
src = fetchFromGitLab {
|
||||
# tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi
|
||||
domain = "gitlab.freedesktop.org";
|
||||
owner = "asahi";
|
||||
repo = "mesa";
|
||||
rev = "asahi-20250221";
|
||||
hash = "sha256-xt49IaylZYoH3LxYu6Uxd+qRrqQfjI6FDeAD8MLeWP8=";
|
||||
};
|
||||
|
||||
mesonFlags =
|
||||
let
|
||||
badFlags = [
|
||||
"-Dinstall-mesa-clc"
|
||||
"-Dopencl-spirv"
|
||||
"-Dgallium-nine"
|
||||
];
|
||||
isBadFlagList = f: builtins.map (b: lib.hasPrefix b f) badFlags;
|
||||
isGoodFlag = f: !(builtins.foldl' (x: y: x || y) false (isBadFlagList f));
|
||||
in
|
||||
(builtins.filter isGoodFlag oldAttrs.mesonFlags) ++ [
|
||||
# we do not build any graphics drivers these features can be enabled for
|
||||
"-Dgallium-va=disabled"
|
||||
"-Dgallium-vdpau=disabled"
|
||||
"-Dgallium-xa=disabled"
|
||||
];
|
||||
|
||||
# replace patches with ones tweaked slightly to apply to this version
|
||||
patches = [
|
||||
./opencl.patch
|
||||
];
|
||||
|
||||
postInstall = (oldAttrs.postInstall or "") + ''
|
||||
# we don't build anything to go in this output but it needs to exist
|
||||
touch $spirv2dxil
|
||||
touch $cross_tools
|
||||
'';
|
||||
})
|
||||
@@ -1,54 +0,0 @@
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 07991a6..4c875b9 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -1900,7 +1900,7 @@ endif
|
||||
|
||||
dep_clang = null_dep
|
||||
if with_clc or with_gallium_clover
|
||||
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
|
||||
+ llvm_libdir = get_option('clang-libdir')
|
||||
|
||||
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
|
||||
|
||||
diff --git a/meson.options b/meson.options
|
||||
index 84e0f20..38ea92c 100644
|
||||
--- a/meson.options
|
||||
+++ b/meson.options
|
||||
@@ -795,3 +795,10 @@ option(
|
||||
value : false,
|
||||
description : 'Install the drivers internal shader compilers (if needed for cross builds).'
|
||||
)
|
||||
+
|
||||
+option(
|
||||
+ 'clang-libdir',
|
||||
+ type : 'string',
|
||||
+ value : '',
|
||||
+ description : 'Locations to search for clang libraries.'
|
||||
+)
|
||||
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
|
||||
index ab2c835..a59e88e 100644
|
||||
--- a/src/gallium/targets/opencl/meson.build
|
||||
+++ b/src/gallium/targets/opencl/meson.build
|
||||
@@ -56,7 +56,7 @@ if with_opencl_icd
|
||||
configuration : _config,
|
||||
input : 'mesa.icd.in',
|
||||
output : 'mesa.icd',
|
||||
- install : true,
|
||||
+ install : false,
|
||||
install_tag : 'runtime',
|
||||
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
|
||||
)
|
||||
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
|
||||
index 2b214ad..7f91939 100644
|
||||
--- a/src/gallium/targets/rusticl/meson.build
|
||||
+++ b/src/gallium/targets/rusticl/meson.build
|
||||
@@ -64,7 +64,7 @@ configure_file(
|
||||
configuration : _config,
|
||||
input : 'rusticl.icd.in',
|
||||
output : 'rusticl.icd',
|
||||
- install : true,
|
||||
+ install : false,
|
||||
install_tag : 'runtime',
|
||||
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
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 { };
|
||||
alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi { inherit (prev) alsa-ucm-conf; };
|
||||
asahi-audio = final.callPackage ./asahi-audio { };
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, buildUBoot
|
||||
, m1n1
|
||||
}:
|
||||
|
||||
(buildUBoot rec {
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://pagure.io/fedora-asahi/uboot-tools/commits/main
|
||||
owner = "AsahiLinux";
|
||||
repo = "u-boot";
|
||||
rev = "asahi-v2024.10-1";
|
||||
hash = "sha256-gtXt+BglBdEKW7j3U2x2QeKGeDH1FdmAMPXk+ntkROo=";
|
||||
};
|
||||
version = "2024.10-1-asahi";
|
||||
|
||||
defconfig = "apple_m1_defconfig";
|
||||
extraMeta.platforms = [ "aarch64-linux" ];
|
||||
filesToInstall = [
|
||||
"u-boot-nodtb.bin.gz"
|
||||
"m1n1-u-boot.bin"
|
||||
];
|
||||
extraConfig = ''
|
||||
CONFIG_IDENT_STRING=" ${version}"
|
||||
CONFIG_VIDEO_FONT_4X6=n
|
||||
CONFIG_VIDEO_FONT_8X16=n
|
||||
CONFIG_VIDEO_FONT_SUN12X22=n
|
||||
CONFIG_VIDEO_FONT_16X32=y
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
'';
|
||||
}).overrideAttrs (o: {
|
||||
# nixos's downstream patches are not applicable
|
||||
patches = [
|
||||
];
|
||||
|
||||
# DTC= flag somehow breaks DTC compilation so we remove it
|
||||
makeFlags = builtins.filter (s: (!(lib.strings.hasPrefix "DTC=" s))) o.makeFlags;
|
||||
|
||||
preInstall = ''
|
||||
# compress so that m1n1 knows U-Boot's size and can find things after it
|
||||
gzip -n u-boot-nodtb.bin
|
||||
cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin
|
||||
'';
|
||||
})
|
||||
@@ -1,11 +1,11 @@
|
||||
{ config, pkgs, inputs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
unstable = import inputs.nixpkgs-unstable {
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.git = {
|
||||
settings = {
|
||||
@@ -37,7 +37,7 @@ in
|
||||
pkgs.automake
|
||||
pkgs.pkg-config
|
||||
pkgs.wget
|
||||
unstable.claude-code
|
||||
pkgs.claude-code
|
||||
pkgs.google-cloud-sdk
|
||||
];
|
||||
home.shellAliases = {
|
||||
|
||||
Reference in New Issue
Block a user