Added udev Rules for FOSSASIA/led-name-badge-ls32, Added aarch64 Cross-Compilation Feature

This commit is contained in:
kB01 2026-01-03 20:26:14 +01:00
parent 6170421c0f
commit a6f52135c9
No known key found for this signature in database
5 changed files with 193 additions and 0 deletions

View file

@ -0,0 +1,71 @@
{ config, lib, pkgs, ... }:
{
imports = [
#./mobile-nixos-branding.nix
#./plasma-mobile.nix
];
# Users
users.users.kb = {
isNormalUser = true;
# Numeric pin makes it **possible** to input on the lockscreen.
password = "1234"; # INSECURE!!!
home = "/home/kb";
extraGroups = [
"dialout"
"feedbackd"
"networkmanager"
"video"
"wheel"
];
};
users.users.root.password = "nixos"; # INSECURE!!!
# Automatically login as defaultUserName.
services.displayManager.autoLogin = {
user = "kb";
};
# Desktop
services.displayManager.autoLogin.enable = true;
services.displayManager.defaultSession = "plasma-mobile";
services.xserver = {
enable = true;
desktopManager.plasma5.mobile.enable = true;
displayManager.lightdm = {
enable = true;
# Workaround for autologin only working at first launch.
# A logout or session crashing will show the login screen otherwise.
extraSeatDefaults = ''
session-cleanup-script=${pkgs.procps}/bin/pkill -P1 -fx ${pkgs.lightdm}/sbin/lightdm
'';
};
};
services.libinput.enable = true;
# Audio
services.pipewire.enable = lib.mkDefault true;
services.pulseaudio.enable = lib.mkDefault false;
# Networking
networking.hostName = "Ohybke";
networking.networkmanager.enable = true;
networking.networkmanager.unmanaged = [ "rndis0" "usb0" ];
networking.wireless.enable = false;
# Bluetooth
hardware.bluetooth.enable = true;
# Mobile Configuration
mobile.boot.stage-1.networking.enable = lib.mkDefault true;
mobile.boot.stage-1.kernel.useStrictKernelConfig = lib.mkDefault true;
mobile.beautification = {
silentBoot = lib.mkDefault true;
splash = lib.mkDefault true;
};
powerManagement.enable = true;
# SSH Server
services.openssh.enable = true;
}

View file

@ -0,0 +1,78 @@
#
# This configuration serves to force Mobile NixOS branding in the
# Plasma Mobile environment at first boot.
#
# This is **not** an example for end-user-centric configuration.
#
{ config, pkgs, ... }:
let
# This script will run *only once*, even if changed.
# https://develop.kde.org/docs/plasma/scripting/#update-scripts
# This will not work through userSetupScript, it seems that plasma mobile on
# first initialization forcibly resets some of the configurations.
# Running last (ZZZ) ensures it can do whatever initialization it needs to do.
plamoInitialDefaults = pkgs.writeTextDir "share/plasma/shells/org.kde.plasma.phoneshell/contents/updates/ZZZ-Mobile-NixOS-initial-defaults.js" ''
var allDesktops = desktops();
for (i=0; i<allDesktops.length; i++) {
d = allDesktops[i];
d.wallpaperPlugin = "org.kde.image";
d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
d.writeConfig("Image", "file://${wallpaper}")
}
'';
# Those configs are found in the file named as `--file`, with
# `--group` being [like][these].
userSetupScript = pkgs.writeScript "userInitialConfiguration" ''
#!${pkgs.runtimeShell}
${pkgs.libsForQt5.kconfig}/bin/kwriteconfig5 \
--file kscreenlockerrc \
--group Greeter \
--group Wallpaper \
--group org.kde.image \
--group General \
--key Image "file://${wallpaper}"
'';
# Why copy them all?
# Because otherwise the wallpaper picker will default to /nix/store as a path
# and this could get messy with the amazing amount of files there are in there.
# Why copy only pngs?
# Rendering of `svg` is hard! Not that it's costly in cpu time, but that the
# rendering might not be as expected depending on what renders it.
# The SVGs in that directory are used as an authoring format files, not files
# to be used as they are. They need to be pre-rendered.
wallpapers = pkgs.runCommand "wallpapers" {} ''
mkdir -p $out/
cp ${../../artwork/wallpapers}/*.png $out/
'';
wallpaper="${wallpapers}/mobile-nixos-19.09.png";
# Used to run an ugly activation script.
defaultUserName = "alice";
in
{
environment.systemPackages = [
plamoInitialDefaults
];
# Force some initial configuration
system.activationScripts.userInitialConfiguration = let
homeDir = config.users.users.${defaultUserName}.home;
in ''
echo ":: Mobile NixOS initial configuration..."
if [ ! -e ${homeDir}/.config ]; then
echo "Assuming first boot!"
echo "Creating home dir"
mkdir -p ${homeDir}
chown ${defaultUserName} ${homeDir}
echo "Configuring things"
${pkgs.sudo}/bin/sudo -u "${defaultUserName}" "${userSetupScript}"
else
echo "Assuming any other boring normal boot..."
echo "Doing nothing..."
fi
'';
}

View file

@ -0,0 +1,37 @@
#
# Minimum config used to enable Plasma Mobile.
#
{ config, lib, pkgs, ... }:
{
mobile.beautification = {
silentBoot = lib.mkDefault true;
splash = lib.mkDefault true;
};
services.xserver = {
enable = true;
desktopManager.plasma5.mobile.enable = true;
displayManager.lightdm = {
enable = true;
# Workaround for autologin only working at first launch.
# A logout or session crashing will show the login screen otherwise.
extraSeatDefaults = ''
session-cleanup-script=${pkgs.procps}/bin/pkill -P1 -fx ${pkgs.lightdm}/sbin/lightdm
'';
};
};
hardware.bluetooth.enable = true;
services.pipewire.enable = lib.mkDefault true;
services.pulseaudio.enable = lib.mkDefault false;
networking.networkmanager.enable = true;
networking.wireless.enable = false;
powerManagement.enable = true;
services.libinput.enable = true;
services.displayManager.defaultSession = "plasma-mobile";
services.displayManager.autoLogin.enable = true;
}

View file

@ -82,6 +82,11 @@
sudo.u2fAuth = true;
swaylock.u2fAuth = true;
};
services.udev.extraRules = ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5020", MODE="0666"
# FIXME: the following line is not sufficient for pyhidapi.
KERNEL=="hidraw*", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5020", ATTRS{busnum}=="1", MODE="0666"
'';
# Printing
services.printing.enable = true;

View file

@ -18,6 +18,8 @@ in {
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.forceImportRoot = false;
networking.hostId = "60dbcc20";
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# Boot Process
boot.loader.systemd-boot.enable = true;