2022-10-16 21:55:37 +00:00
|
|
|
|
# Edit this configuration file to define what should be installed on
|
|
|
|
|
# your system. Help is available in the configuration.nix(5) man page
|
|
|
|
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
|
|
|
|
2022-11-05 15:38:22 +00:00
|
|
|
|
{ config, pkgs, lib, ... }:
|
2022-10-16 21:55:37 +00:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
imports =
|
|
|
|
|
[
|
|
|
|
|
# Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
# Fonts
|
|
|
|
|
../modules/personal/fonts
|
|
|
|
|
# Encrypted DNS
|
|
|
|
|
../modules/services/edns
|
2023-11-26 14:49:09 +00:00
|
|
|
|
# Override base mesa
|
|
|
|
|
({ ... }: { nixpkgs.overlays = lib.mkBefore [ (final: prev: { mesa = prev.mesa.override { enableOpenCL = true; meson = final.unstable.meson; }; }) ]; })
|
2022-10-16 21:55:37 +00:00
|
|
|
|
];
|
|
|
|
|
|
2023-09-20 08:07:37 +00:00
|
|
|
|
# time.timeZone = lib.mkForce "Asia/Ho_Chi_Minh";
|
2023-08-23 02:32:30 +00:00
|
|
|
|
services.xserver.desktopManager.plasma5.enable = true;
|
2023-08-10 04:55:23 +00:00
|
|
|
|
|
|
|
|
|
|
2022-11-04 09:54:44 +00:00
|
|
|
|
# Asahi kernel configuration
|
2023-02-25 20:43:29 +00:00
|
|
|
|
hardware.asahi = {
|
|
|
|
|
peripheralFirmwareDirectory = ./firmware;
|
|
|
|
|
use4KPages = false;
|
|
|
|
|
withRust = true;
|
|
|
|
|
addEdgeKernelConfig = true;
|
|
|
|
|
useExperimentalGPUDriver = true;
|
|
|
|
|
experimentalGPUInstallMode = "overlay";
|
|
|
|
|
};
|
2023-11-26 14:49:09 +00:00
|
|
|
|
# Override mesa
|
|
|
|
|
nixpkgs.overlays = lib.mkAfter [
|
|
|
|
|
(final: prev: {
|
|
|
|
|
mesa-asahi-edge = prev.mesa-asahi-edge.overrideAttrs (attrs: {
|
|
|
|
|
version = "24.0.0";
|
|
|
|
|
# buildInputs = attrs.buildInputs ++ (with pkgslw; [ libclc cmake (spirv-llvm-translator.override { inherit (llvmPackages_15) llvm; }) ]);
|
|
|
|
|
# nativeBuildInputs = attrs.nativeBuildInputs ++ (with pkgs; [ pkgs.unstable.spirv-llvm-translator ]);
|
|
|
|
|
src = final.fetchFromGitLab {
|
|
|
|
|
# latest release
|
|
|
|
|
domain = "gitlab.freedesktop.org";
|
|
|
|
|
owner = "asahi";
|
|
|
|
|
repo = "mesa";
|
|
|
|
|
rev = "asahi-20231121";
|
|
|
|
|
hash = "sha256-IcKKe1RA8sCaUfWK71ELzF15YaBS3DjoYhNMIWiQ5Jw=";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
patches = lib.forEach attrs.patches (p:
|
|
|
|
|
if lib.hasSuffix "opencl.patch" p
|
|
|
|
|
then ./mesa-asahi-edge/opencl.patch else p);
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
];
|
2023-11-05 12:09:34 +00:00
|
|
|
|
## Additional mesa-related packages
|
|
|
|
|
environment.systemPackages = with pkgs; [ SDL2 ];
|
2022-10-17 08:25:38 +00:00
|
|
|
|
|
2022-11-08 11:31:58 +00:00
|
|
|
|
# Power Management
|
|
|
|
|
services.upower = {
|
|
|
|
|
enable = true;
|
|
|
|
|
criticalPowerAction = "PowerOff";
|
|
|
|
|
|
|
|
|
|
usePercentageForPolicy = true;
|
|
|
|
|
percentageCritical = 3;
|
|
|
|
|
percentageLow = 10;
|
|
|
|
|
};
|
2022-11-25 13:04:03 +00:00
|
|
|
|
services.logind.lidSwitch = "suspend";
|
2022-11-08 11:31:58 +00:00
|
|
|
|
|
2023-03-01 15:58:01 +00:00
|
|
|
|
# Printing
|
2023-04-02 15:35:59 +00:00
|
|
|
|
services.printing.drivers = with pkgs; [ epfl-cups-drivers ];
|
2022-10-16 21:55:37 +00:00
|
|
|
|
|
|
|
|
|
# Enable touchpad support (enabled default in most desktopManager).
|
2024-08-02 16:27:48 +00:00
|
|
|
|
services.libinput.enable = true;
|
2022-10-17 08:25:38 +00:00
|
|
|
|
# Keyboard
|
|
|
|
|
services.input-remapper.enable = true;
|
2023-06-07 08:48:29 +00:00
|
|
|
|
services.input-remapper.serviceWantedBy = [ "multi-user.target" ];
|
2022-10-17 08:25:38 +00:00
|
|
|
|
hardware.uinput.enable = true;
|
2022-10-16 21:55:37 +00:00
|
|
|
|
|
|
|
|
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
2023-04-02 15:35:59 +00:00
|
|
|
|
common.linux.username = "nki";
|
2022-10-21 11:17:07 +00:00
|
|
|
|
|
2022-10-17 15:32:12 +00:00
|
|
|
|
# Enable sway on login.
|
|
|
|
|
environment.loginShellInit = ''
|
|
|
|
|
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
|
|
|
|
|
exec sway
|
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
|
2023-04-02 15:35:59 +00:00
|
|
|
|
# Networking
|
|
|
|
|
common.linux.networking = {
|
|
|
|
|
hostname = "kagami-air-m1";
|
|
|
|
|
networks."10-wired".match = "enp*";
|
|
|
|
|
networks."20-wireless".match = "wlan*";
|
|
|
|
|
dnsServers = [ "127.0.0.1" ];
|
2022-10-16 21:55:37 +00:00
|
|
|
|
};
|
|
|
|
|
nki.services.edns.enable = true;
|
|
|
|
|
nki.services.edns.ipv6 = true;
|
|
|
|
|
|
2022-10-17 10:59:22 +00:00
|
|
|
|
# Secrets
|
|
|
|
|
sops.defaultSopsFile = ./secrets.yaml;
|
|
|
|
|
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
|
|
|
|
|
|
|
|
|
## tinc
|
|
|
|
|
sops.secrets."tinc/ed25519-private-key" = { };
|
|
|
|
|
services.my-tinc = {
|
|
|
|
|
enable = true;
|
2022-10-17 11:29:36 +00:00
|
|
|
|
hostName = "macbooknix";
|
2022-10-17 10:59:22 +00:00
|
|
|
|
ed25519PrivateKey = config.sops.secrets."tinc/ed25519-private-key".path;
|
|
|
|
|
bindPort = 6565;
|
|
|
|
|
};
|
|
|
|
|
|
2022-10-17 13:58:13 +00:00
|
|
|
|
services.dbus.packages = with pkgs; [ gcr ];
|
|
|
|
|
|
2022-10-21 12:16:06 +00:00
|
|
|
|
# Power Management
|
|
|
|
|
powerManagement = {
|
|
|
|
|
enable = true;
|
2022-11-24 15:35:12 +00:00
|
|
|
|
# powerDownCommands = ''
|
|
|
|
|
# /run/current-system/sw/bin/rmmod brcmfmac # Disable wifi
|
|
|
|
|
# /run/current-system/sw/bin/rmmod hci_bcm4377 # Disable bluetooth
|
|
|
|
|
# '';
|
|
|
|
|
# resumeCommands = ''
|
|
|
|
|
# /run/current-system/sw/bin/modprobe brcmfmac # Enable wifi
|
|
|
|
|
# /run/current-system/sw/bin/modprobe hci_bcm4377 # Enable bluetooth
|
|
|
|
|
# /run/current-system/sw/bin/systemctl restart iwd
|
|
|
|
|
# /run/current-system/sw/bin/systemctl restart bluetooth
|
|
|
|
|
# '';
|
2022-10-21 12:16:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-10-16 21:55:37 +00:00
|
|
|
|
# Open ports in the firewall.
|
|
|
|
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
|
|
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
|
|
|
# Or disable the firewall altogether.
|
|
|
|
|
# networking.firewall.enable = false;
|
|
|
|
|
|
|
|
|
|
# Copy the NixOS configuration file and link it from the resulting system
|
|
|
|
|
# (/run/current-system/configuration.nix). This is useful in case you
|
|
|
|
|
# accidentally delete configuration.nix.
|
|
|
|
|
# system.copySystemConfiguration = true;
|
|
|
|
|
|
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
|
|
|
system.stateVersion = "22.05"; # Did you read the comment?
|
|
|
|
|
}
|
|
|
|
|
|