[Asahi] Add basic config.

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
jmug
2025-06-01 20:55:24 -07:00
parent fb9c0c4bd4
commit 4ad29acdc1
9 changed files with 403 additions and 24 deletions
+176
View File
@@ -0,0 +1,176 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config,
lib,
pkgs,
apple-silicon,
ghostty,
...
}:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
apple-silicon.nixosModules.apple-silicon-support
# Sops and other stuff.
../common/core
];
# 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 = "asahi-nix"; # Define your hostname.
networking.wireless = {
enable = true;
secretsFile = config.sops.secrets."wireless.env".path;
networks = {
"UG_LivingRoom_5G" = {
pskRaw = "ext:home_psk";
};
};
};
hardware.asahi = {
peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true;
experimentalGPUInstallMode = "overlay";
};
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# 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";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# };
# This doesn't seem to be doing anything in hyprland because it configure libinput directly.
# I'll leave it here just in case, but doesn't seem necessary.
services.libinput = {
enable = true;
};
# Define a user account. Don't forget to set a password with passwd.
# users.users.alice = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [
# tree
# ];
# };
users.users.jmug = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
git
];
shell = pkgs.zsh;
};
programs.zsh.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
};
services.keyd = {
enable = true;
keyboards.colemakdhm = {
ids = [ "05ac:0351:6f083222" ];
settings = {
main = {
e = "f";
r = "p";
t = "b";
y = "j";
u = "l";
i = "u";
o = "y";
p = ";";
s = "r";
d = "s";
f = "t";
h = "m";
j = "n";
k = "e";
l = "i";
";" = "o";
v = "d";
b = "v";
n = "k";
m = "h";
capslock = "leftcontrol";
};
};
};
};
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
environment.systemPackages = with pkgs; [
keyd
kitty
htop
# Terminal
ghostty.packages.aarch64-linux.default
];
fonts = {
fontDir.enable = true;
packages = with pkgs; [
nerd-fonts.bigblue-terminal
nerd-fonts.fira-code
];
};
programs.hyprland = {
enable = true;
xwayland.enable = true;
};
# This is not really enabling X11, bad naming.
services.xserver = {
enable = true;
displayManager.gdm = {
enable = true;
wayland = true;
};
};
# USB devices.
services.devmon.enable = true;
services.gvfs.enable = true;
services.udisks2.enable = true;
system.stateVersion = "25.05"; # Don't change!!!
}
Binary file not shown.
Binary file not shown.
+39
View File
@@ -0,0 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "usb_storage" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b5800f37-1df2-4d6c-b2c7-7c274d56e938";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/547D-181B";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/e4138eb3-f8cf-436f-9a0f-3c67d3095582"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}
+87
View File
@@ -0,0 +1,87 @@
{ lib, config, pkgs, ...} :
let
pathToKeys = ../common/keys/yubi;
yubiKeys =
lib.lists.forEach (builtins.attrNames (builtins.readDir pathToKeys))
(key: lib.substring 0 (lib.stringLength key - lib.stringLength ".pub") key); # Remove .pub suffix.
yubikeyPublicKeyEntries = lib.attrsets.mergeAttrsList (
lib.lists.map
(key: { ".ssh/${key}.pub".source = "${pathToKeys}/${key}.pub"; })
yubiKeys
);
in
{
imports = [
../../home-modules/nvim.nix
../../home-modules/zsh.nix
../../home-modules/git.nix
../../home-modules/lazygit.nix
../../home-modules/starship.nix
../../home-modules/ghostty-config.nix
../../home-modules/sops.nix
];
home = {
username = "jmug";
homeDirectory = "/home/jmug";
packages = with pkgs; [
# Secret management.
age
sops
];
file = {} // yubikeyPublicKeyEntries;
stateVersion = "25.05"; # Do not change!!!
};
programs.ssh = {
enable = true;
addKeysToAgent = "yes";
matchBlocks = {
"git" = {
host = "github.com";
user = "git";
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
"/home/jmug/.ssh/id_jmug" # Fallback key with passphrase.
];
};
"forgejo" = {
host = "code.jmug.me";
user = "forgejo";
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
"/home/jmug/.ssh/id_jmug" # Fallback key with passphrase.
];
};
wsl = {
user = "jmug";
hostname = "192.168.10.241";
port = 69;
forwardAgent = true;
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
];
};
ws = {
user = "jmug";
hostname = "98.59.213.212";
port = 69;
forwardAgent = true;
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
];
};
};
};
programs.zsh.shellAliases = {
# TODO: Interpolate the name of the host here.
nrsw = "sudo nixos-rebuild switch --flake /home/jmug/nixos#asahi"; # parametrize this as home dir.
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}