From 7f8c32c8295610ec7e5b8e387ea52cfa88250496 Mon Sep 17 00:00:00 2001 From: Linnnus Date: Sun, 23 Mar 2025 22:05:01 +0000 Subject: hosts/ali: Init --- hosts/ali/configuration.nix | 46 ++++++++++++++++++++++++ hosts/ali/desktop-environment/default.nix | 25 +++++++++++++ hosts/ali/desktop-environment/input.nix | 10 ++++++ hosts/ali/desktop-environment/window-manager.nix | 38 ++++++++++++++++++++ hosts/ali/hardware-configuration.nix | 35 ++++++++++++++++++ hosts/ali/wireless-networking/default.nix | 5 +++ 6 files changed, 159 insertions(+) create mode 100644 hosts/ali/configuration.nix create mode 100644 hosts/ali/desktop-environment/default.nix create mode 100644 hosts/ali/desktop-environment/input.nix create mode 100644 hosts/ali/desktop-environment/window-manager.nix create mode 100644 hosts/ali/hardware-configuration.nix create mode 100644 hosts/ali/wireless-networking/default.nix (limited to 'hosts/ali') diff --git a/hosts/ali/configuration.nix b/hosts/ali/configuration.nix new file mode 100644 index 0000000..6b69f3f --- /dev/null +++ b/hosts/ali/configuration.nix @@ -0,0 +1,46 @@ +{ + config, + lib, + pkgs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + + ../../shared/nixos/common-nix-settings + ../../shared/nixos/common-shell-settings + ../../shared/nixos-and-darwin/common-hm-settings + ../../shared/nixos/danish + + ./wireless-networking + ./desktop-environment + ]; + + boot.loader.grub = { + # Use the GRUB 2 boot loader. + enable = true; + + # Install grub on the main HDD. + device = "/dev/sda"; + }; + + # Create the main user. + users.users.linus = { + isNormalUser = true; + hashedPassword = "$y$j9T$UmZES4WC8FWrjBvdazq2e/$rzneAKZeySwSVKiSZJfXC.fciiQdGqxB5uyRaPQ6OF."; + extraGroups = ["wheel"]; + }; + users.mutableUsers = false; + + home-manager.users.linus = { + imports = [ + ../../shared/home-manager/development-minimal + ../../shared/home-manager/nix + ../../shared/home-manager/C + ]; + home.stateVersion = "24.11"; + }; + + system.stateVersion = "24.11"; +} diff --git a/hosts/ali/desktop-environment/default.nix b/hosts/ali/desktop-environment/default.nix new file mode 100644 index 0000000..ce9e3bd --- /dev/null +++ b/hosts/ali/desktop-environment/default.nix @@ -0,0 +1,25 @@ +# This module configures a desktop environment specific to this host. +{pkgs,...}: +{ + imports = [ + ./window-manager.nix + ./input.nix + ]; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + + # TODO: We should be able to add "intel" driver? + videoDrivers = ["fbdev"]; + }; + + + # Enable sound. + # hardware.pulseaudio.enable = true; + # OR + # services.pipewire = { + # enable = true; + # pulse.enable = true; + # }; +} diff --git a/hosts/ali/desktop-environment/input.nix b/hosts/ali/desktop-environment/input.nix new file mode 100644 index 0000000..63cddca --- /dev/null +++ b/hosts/ali/desktop-environment/input.nix @@ -0,0 +1,10 @@ +{ + # Configure keymap in X11 + services.xserver.xkb.layout = "dk"; + services.xserver.xkb.options = "caps:escape"; + + console.useXkbConfig = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; +} diff --git a/hosts/ali/desktop-environment/window-manager.nix b/hosts/ali/desktop-environment/window-manager.nix new file mode 100644 index 0000000..d36fc14 --- /dev/null +++ b/hosts/ali/desktop-environment/window-manager.nix @@ -0,0 +1,38 @@ +{pkgs, ...}: { + services.xserver.windowManager.dwm.enable = true; + + # FIXME: Deduplicate this with omar's config (noting the difference in BAT0 vs BAT1). + # Show battery and clock in status bar. This is a background daemon which + # updates the root window, which DWM uses for status. + systemd.user.services.dwm-battery = { + description = "Battery status update"; + partOf = ["graphical-session.target"]; + wantedBy = ["graphical-session.target"]; + + serviceConfig.ExecStart = pkgs.writeShellScript "dwm-battery" '' + while true; do + echo -n "$(date +%H:%M) - "; + + # See: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power + case "$(cat /sys/class/power_supply/BAT1/status)" in + Charging) echo -n "🔋 " ;; + Discharging) echo -n "🪫 " ;; + "Not charging") echo -n "🪫 " ;; + Full) echo -n "🔋 " ;; + Unknown) echo -n "? " ;; + ""|*) echo -n "?? " ;; + esac + + echo -n "$(cat /sys/class/power_supply/BAT1/capacity)%" + + echo + sleep 5 + done | ${pkgs.dwm-setstatus}/bin/dwm-setstatus + ''; + }; + + environment.systemPackages = with pkgs; [ + st + dmenu + ]; +} diff --git a/hosts/ali/hardware-configuration.nix b/hosts/ali/hardware-configuration.nix new file mode 100644 index 0000000..468071b --- /dev/null +++ b/hosts/ali/hardware-configuration.nix @@ -0,0 +1,35 @@ +# 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 = [ "uhci_hcd" "ehci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3a77d4b4-911f-4df8-9eb1-373431e5056d"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/eede6131-76dc-4072-943c-8eecb84a0cbd"; } + ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp9s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/ali/wireless-networking/default.nix b/hosts/ali/wireless-networking/default.nix new file mode 100644 index 0000000..09f072c --- /dev/null +++ b/hosts/ali/wireless-networking/default.nix @@ -0,0 +1,5 @@ +# This module configures wireless networking using WPA. +{...}: { + # Enables wireless support via wpa_supplicant. + networking.wireless.enable = true; +} -- cgit v1.2.3