diff options
author | Linnnus <[email protected]> | 2025-03-23 22:05:01 +0000 |
---|---|---|
committer | Linnnus <[email protected]> | 2025-03-23 22:05:01 +0000 |
commit | 7f8c32c8295610ec7e5b8e387ea52cfa88250496 (patch) | |
tree | c1ce2d9c30b4597b199df1baa0f889b737444d16 | |
parent | 94743c25a092fa9aa19182542b2d2026c6f88b1e (diff) |
hosts/ali: Init
-rw-r--r-- | flake.lock | 30 | ||||
-rw-r--r-- | flake.nix | 11 | ||||
-rw-r--r-- | hosts/ali/configuration.nix | 46 | ||||
-rw-r--r-- | hosts/ali/desktop-environment/default.nix | 25 | ||||
-rw-r--r-- | hosts/ali/desktop-environment/input.nix | 10 | ||||
-rw-r--r-- | hosts/ali/desktop-environment/window-manager.nix | 38 | ||||
-rw-r--r-- | hosts/ali/hardware-configuration.nix | 35 | ||||
-rw-r--r-- | hosts/ali/wireless-networking/default.nix | 5 |
8 files changed, 185 insertions, 15 deletions
@@ -151,11 +151,11 @@ ] }, "locked": { - "lastModified": 1739757849, - "narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=", + "lastModified": 1742655702, + "narHash": "sha256-jbqlw4sPArFtNtA1s3kLg7/A4fzP4GLk9bGbtUJg0JQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe", + "rev": "0948aeedc296f964140d9429223c7e4a0702a1ff", "type": "github" }, "original": { @@ -172,11 +172,11 @@ ] }, "locked": { - "lastModified": 1739553546, - "narHash": "sha256-L4ou3xfOr17EAe836djRoQ7auVkYOREMtiQa82wVGqU=", + "lastModified": 1741126078, + "narHash": "sha256-ng0a4cIq3c9E3iGKomlwqKzVYs2RLOzQho2U1Mc2sqU=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "353846417f985e74fdc060555f17939e4472ea2c", + "rev": "c172f50b55b087f8e7801631de977461603bb976", "type": "github" }, "original": { @@ -188,11 +188,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1740865531, - "narHash": "sha256-h00vGIh/jxcGl8aWdfnVRD74KuLpyY3mZgMFMy7iKIc=", + "lastModified": 1742512142, + "narHash": "sha256-8XfURTDxOm6+33swQJu/hx6xw1Tznl8vJJN5HwVqckg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5ef6c425980847c78a80d759abc476e941a9bf42", + "rev": "7105ae3957700a9646cc4b766f5815b23ed0c682", "type": "github" }, "original": { @@ -204,11 +204,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1740828860, - "narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=", + "lastModified": 1742422364, + "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "303bd8071377433a2d8f76e684ec773d70c5b642", + "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc", "type": "github" }, "original": { @@ -227,11 +227,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1741023554, - "narHash": "sha256-6VKOyyt4OFe4kkplEMOHKF/KLDsihZasUzBX8f5wNsM=", + "lastModified": 1742751914, + "narHash": "sha256-G//YHkdXeW8I8SjhANbTFgmAaUvb0n2qeLcs+KKsQdE=", "owner": "nix-community", "repo": "NUR", - "rev": "ead8ecbe5be1312af49859f269764421132de223", + "rev": "57e0d726d3d7b3543ab743eadd09aad608e1aa6e", "type": "github" }, "original": { @@ -105,6 +105,17 @@ ] ++ builtins.attrValues (import ./modules/nixos); }; + ali = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + [ + {_module.args = args;} + home-manager.nixosModules.home-manager + agenix.nixosModules.default + ./hosts/ali/configuration.nix + ] + ++ builtins.attrValues (import ./modules/nixos); + }; }; # Formatter to be run when `nix fmt` is executed. 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.<interface>.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; +} |