From 5606369d4a89bdec814c27fe34ef7ef1210e1aa6 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Sun, 16 Feb 2025 20:56:14 +0200 Subject: [PATCH] eldrid --- hosts/eldrid/configuration.nix | 77 +++++++ hosts/eldrid/hardware-conf.nix | 201 ++++++++++++++++++ hosts/eldrid/programs.nix | 17 ++ hosts/eldrid/stylix.nix | 50 +++++ hosts/eldrid/users.nix | 15 ++ hosts/eldrid/users/user/flatpak.nix | 110 ++++++++++ .../eldrid/users/user/home-configuration.nix | 15 ++ hosts/eldrid/users/user/programs.nix | 58 +++++ hosts/sarien/configuration.nix | 1 + modules/home/desktop/hyprland/default.nix | 2 + 10 files changed, 546 insertions(+) create mode 100644 hosts/eldrid/configuration.nix create mode 100755 hosts/eldrid/hardware-conf.nix create mode 100644 hosts/eldrid/programs.nix create mode 100644 hosts/eldrid/stylix.nix create mode 100644 hosts/eldrid/users.nix create mode 100644 hosts/eldrid/users/user/flatpak.nix create mode 100644 hosts/eldrid/users/user/home-configuration.nix create mode 100644 hosts/eldrid/users/user/programs.nix diff --git a/hosts/eldrid/configuration.nix b/hosts/eldrid/configuration.nix new file mode 100644 index 0000000..d3c9b7f --- /dev/null +++ b/hosts/eldrid/configuration.nix @@ -0,0 +1,77 @@ +# device-specific setup +{ + pkgs, + inputs, + ... +}: { + imports = with inputs; [ + chaotic.nixosModules.default + lix.nixosModules.default + self.nixosModules.desktop + self.nixosModules.system + ./hardware-conf.nix + ./programs.nix + ./stylix.nix + ./users.nix + ]; + + desktop = { + hyprland.enable = true; + }; + + nix.settings.experimental-features = ["nix-command" "flakes"]; + system.stateVersion = "25.05"; + + time.timeZone = "Europe/Kyiv"; + locale.ukrainian.enable = true; + + networking = { + networkmanager.enable = true; + hostName = "eldrid"; + # required for syncthing + firewall = { + allowedTCPPorts = [22000]; + allowedUDPPorts = [21027 22000]; + }; + }; + + boot = { + # kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = pkgs.linuxPackages_cachyos; + plymouth.enable = true; + loader.efi.canTouchEfiVariables = true; + loader.systemd-boot = { + enable = true; + consoleMode = "auto"; + }; + }; + + console = { + earlySetup = true; + packages = [pkgs.terminus_font]; + font = "${pkgs.terminus_font}/share/consolefonts/ter-c18n.psf.gz"; + }; + + services = { + power-profiles-daemon.enable = true; + flatpak.enable = true; + fstrim.enable = true; + openssh.enable = true; + }; + services.scx = { + enable = true; + scheduler = "scx_flash"; + }; + + security.basic.enable = true; + + virtual = { + libvirt.enable = true; + podman.enable = false; + }; + + wireless.bluetooth.enableBlueman = true; + + opentabletdriver.enable = false; + qmk-vial.enable = true; +} diff --git a/hosts/eldrid/hardware-conf.nix b/hosts/eldrid/hardware-conf.nix new file mode 100755 index 0000000..f963dca --- /dev/null +++ b/hosts/eldrid/hardware-conf.nix @@ -0,0 +1,201 @@ +{ + config, + lib, + pkgs, + # modulesPath, + ... +}: let + cb-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs { + wttsrc = pkgs.fetchFromGitHub { + owner = "WeirdTreeThing"; + repo = "chromebook-ucm-conf"; + rev = "b6ce2a7"; + hash = "sha256-QRUKHd3RQmg1tnZU8KCW0AmDtfw/daOJ/H3XU5qWTCc="; + }; + postInstall = '' + cp -R $wttsrc/common/* $out/share/alsa/ucm2/common + cp -R $wttsrc/codecs/* $out/share/alsa/ucm2/codecs + cp -R $wttsrc/platforms/* $out/share/alsa/ucm2/platforms + cp -R $wttsrc/sof-rt5682 $out/share/alsa/ucm2/conf.d + cp -R $wttsrc/sof-cs42l42 $out/share/alsa/ucm2/conf.d + ''; + }; +in { + boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" "xe" "i915"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e"; + fsType = "btrfs"; + options = ["subvol=@nixos,compress=zstd"]; + }; + + boot.initrd.luks.devices."luks".device = "/dev/disk/by-uuid/cbd7d98e-745b-4828-b868-42881bad353d"; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e"; + fsType = "btrfs"; + options = ["subvol=@home,compress=zstd"]; + }; + + fileSystems."/var/lib/flatpak" = { + device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e"; + fsType = "btrfs"; + options = ["subvol=@flatpak,compress=zstd"]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/D38C-AA51"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; + fileSystems."/swap" = { + device = "/dev/disk/by-uuid/fc3d843d-54c6-4b2f-ac56-77f81600745e"; + fsType = "btrfs"; + options = ["subvol=@swap,compress=zstd"]; + }; + swapDevices = [ + { + device = "/swap/swapfile"; + size = 8 * 1024; # eight gigs + } + ]; + + wireless = { + wifi.enable = true; + bluetooth.enable = true; + }; + + networking.useDHCP = lib.mkDefault true; + + # intel ax201 wifi card firmware + hardware.enableRedistributableFirmware = true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + # physically broken touchscreen + services.udev.extraRules = "ACTION==\"add|change\", KERNELS==\"input[0-9]*\", SUBSYSTEMS==\"input\", ATTRS{id/vendor}==\"27c6\", ATTRS{id/product}==\"0e84\", ENV{LIBINPUT_IGNORE_DEVICE}=\"1\""; + services.keyd = { + enable = true; + keyboards.internal = { + ids = [ + "k:0001:0001" + "k:18d1:5044" + "k:18d1:5052" + "k:0000:0000" + "k:18d1:5050" + "k:18d1:504c" + "k:18d1:503c" + "k:18d1:5030" + "k:18d1:503d" + "k:18d1:505b" + "k:18d1:5057" + "k:18d1:502b" + "k:18d1:5061" + ]; + settings = { + main = { + f1 = "back"; + f2 = "forward"; + f3 = "refresh"; + f4 = "f11"; + f5 = "scale"; + f6 = "brightnessdown"; + f7 = "brightnessup"; + f8 = "mute"; + f9 = "volumedown"; + f10 = "volumeup"; + back = "back"; + forward = "forward"; + refresh = "refresh"; + zoom = "f11"; + scale = "scale"; + brightnessdown = "brightnessdown"; + brightnessup = "brightnessup"; + mute = "mute"; + volumedown = "volumedown"; + volumeup = "volumeup"; + sleep = "coffee"; + a = "lettermod(alt, a, 200, 150)"; + s = "lettermod(meta, s, 200, 150)"; + d = "lettermod(control, d, 200, 150)"; + f = "lettermod(shift, f, 200, 150)"; + j = "lettermod(shift, j, 200, 150)"; + k = "lettermod(control, k, 200, 150)"; + l = "lettermod(meta, l, 200, 150)"; + ";" = "lettermod(alt, ;, 200, 150)"; + }; + meta = { + f1 = "f1"; + f2 = "f2"; + f3 = "f3"; + f4 = "f4"; + f5 = "f5"; + f6 = "f6"; + f7 = "f7"; + f8 = "f8"; + f9 = "f9"; + f10 = "f10"; + back = "f1"; + forward = "f2"; + refresh = "f3"; + zoom = "f4"; + scale = "f5"; + brightnessdown = "f6"; + brightnessup = "f7"; + mute = "f8"; + volumedown = "f9"; + volumeup = "f10"; + sleep = "f12"; + }; + alt = { + backspace = "delete"; + meta = "capslock"; + brightnessdown = "kbdillumdown"; + brightnessup = "kbdillumup"; + f6 = "kbdillumdown"; + f7 = "kbdillumup"; + }; + control = { + f5 = "print"; + scale = "print"; + }; + controlalt = { + backspace = "C-A-delete"; + }; + }; + }; + }; + + system.replaceDependencies.replacements = [ + { + original = pkgs.alsa-ucm-conf; + replacement = cb-ucm-conf; + } + ]; + + services.pipewire.wireplumber.configPackages = [ + (pkgs.writeTextDir "share/wireplumber/main.lua.d/51-increase-headroom.lua" '' + rule = { + matches = { + { + { "node.name", "matches", "alsa_output.*" }, + }, + }, + apply_properties = { + ["api.alsa.headroom"] = 4096, + }, + } + + table.insert(alsa_monitor.rules,rule) + '') + ]; + boot = { + extraModprobeConfig = '' + options snd-intel-dspcfg dsp_driver=3 + ''; + }; +} diff --git a/hosts/eldrid/programs.nix b/hosts/eldrid/programs.nix new file mode 100644 index 0000000..3abc859 --- /dev/null +++ b/hosts/eldrid/programs.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + programs.neovim = { + enable = false; + viAlias = true; + vimAlias = true; + }; + programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 7d --keep 3"; + flake = "/home/user/.config/nixos"; + }; + environment.systemPackages = with pkgs; [ + helix + nushell + ]; +} diff --git a/hosts/eldrid/stylix.nix b/hosts/eldrid/stylix.nix new file mode 100644 index 0000000..1546c18 --- /dev/null +++ b/hosts/eldrid/stylix.nix @@ -0,0 +1,50 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [ + inputs.stylix.nixosModules.stylix + ]; + environment.systemPackages = with pkgs; [ + #papirus-icon-theme + nerd-fonts.iosevka + ]; + stylix = { + enable = true; + base16Scheme = "${pkgs.base16-schemes}/share/themes/helios.yaml"; + polarity = "dark"; + cursor = { + package = pkgs.google-cursor; + name = "GoogleDot-Blue"; + size = 24; + }; + image = ../../wallpapers/wallhaven-d5qlwj.jpg; + opacity.terminal = 0.9; + fonts = { + sizes = { + applications = 13; + desktop = 14; + popups = 13; + terminal = 15; + }; + serif = { + package = pkgs.nerd-fonts.iosevka; + name = "Iosevka Nerd Font Propo"; + }; + sansSerif = { + package = pkgs.nerd-fonts.iosevka; + name = "Iosevka Nerd Font Propo"; + }; + monospace = { + package = pkgs.nerd-fonts.iosevka; + name = "Iosevka Nerd Font Mono"; + }; + + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + }; + }; +} diff --git a/hosts/eldrid/users.nix b/hosts/eldrid/users.nix new file mode 100644 index 0000000..18d4cb4 --- /dev/null +++ b/hosts/eldrid/users.nix @@ -0,0 +1,15 @@ +{pkgs, ...}: { + nix.settings.trusted-users = ["user"]; + users.users = { + user = { + isNormalUser = true; + extraGroups = ["wheel" "video" "libvirtd" "dialout"]; + shell = pkgs.nushell; + }; + # work = { + # isNormalUser = true; + # extraGroups = ["video"]; + # shell = pkgs.nushell; + # }; + }; +} diff --git a/hosts/eldrid/users/user/flatpak.nix b/hosts/eldrid/users/user/flatpak.nix new file mode 100644 index 0000000..23f31e6 --- /dev/null +++ b/hosts/eldrid/users/user/flatpak.nix @@ -0,0 +1,110 @@ +{inputs, ...}: { + imports = [ + inputs.nix-flatpak.homeManagerModules.nix-flatpak + ]; + services.flatpak = { + enable = true; + remotes = [ + { + name = "flathub"; + location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; + } + { + name = "hero-persson"; + location = "https://hero-persson.github.io/unmojang-flatpak/index.flatpakrepo"; + } + ]; + packages = [ + # misc + "io.github.zen_browser.zen" + "net.mullvad.MullvadBrowser" + "com.obsproject.Studio" + "com.bitwarden.desktop" + "com.github.tchx84.Flatseal" + "org.qbittorrent.qBittorrent" + + # "com.transmissionbt.Transmission" + "com.usebottles.bottles" + "com.logseq.Logseq" + "io.github.martchus.syncthingtray" + + # chatting + "org.signal.Signal" + "im.riot.Riot" + "org.telegram.desktop" + "io.github.spacingbat3.webcord" + "org.mozilla.Thunderbird" + + # media + "org.atheme.audacious" + "io.freetubeapp.FreeTube" + #"io.github.celluloid_player.Celluloid" + # "io.mpv.Mpv" + + # gaming + #"com.github._0negal.Viper" + "net.lutris.Lutris" + "com.heroicgameslauncher.hgl" + { + appId = "org.unmojang.FjordLauncher"; + origin = "hero-persson"; + } + "org.freedesktop.Platform.VulkanLayer.MangoHud//24.08" + "org.freedesktop.Platform.VulkanLayer.gamescope//24.08" + ]; + overrides = { + "global" = { + # Force Wayland by default + Context = { + sockets = ["wayland" "!x11" "!fallback-x11"]; + filesystems = [ + "xdg-run/pipewire-0" + "xdg-config/gtk-3.0:ro" + "xdg-config/gtk-4.0:ro" + # "~/.local/share/fonts:ro" + "~/.local/share/icons:ro" + # "~/.nix-profile/share/icons:ro" + # "~/.nix-profile/share/fonts:ro" + "/nix/store:ro" + ]; + }; + Environment = { + XCURSOR_PATH = "/run/host/user-share/icons:/run/host/share/icons"; + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + #GTK_THEME = "adw-gtk3"; + }; + }; + "io.github.martchus.syncthingtray".Context.filesystems = ["/storage/games/heroic/Factorio/game/saves"]; + "org.octave.Octave".Context.sockets = ["x11"]; + "org.octave.Octave".Environment = {QT_QPA_PLATFORM = "xcb";}; + "com.valvesoftware.Steam" = { + Context = { + sockets = ["x11" "wayland"]; + filesystems = ["/storage/games/steam"]; + }; + Environment = { + STEAM_FORCE_DESKTOPUI_SCALING = "1.3"; + }; + }; + "org.signal.Signal" = { + Environment = { + SIGNAL_PASSWORD_STORE = "gnome-libsecret"; + }; + }; + "net.lutris.Lutris".Context = { + sockets = ["x11" "wayland"]; + filesystems = ["/storage/games/lutris" "~/games/lutris"]; + }; + "com.heroicgameslauncher.hgl".Context = { + sockets = ["x11" "wayland"]; + filesystems = ["/storage/games/heroic" "~/games/heroic"]; + }; + "com.usebottles.Bottles" = { + Context = { + sockets = ["x11" "wayland"]; + filesystems = ["/home/user/docs/nure/tex-template/assets/BridgeKSG"]; + }; + }; + }; + }; +} diff --git a/hosts/eldrid/users/user/home-configuration.nix b/hosts/eldrid/users/user/home-configuration.nix new file mode 100644 index 0000000..0811d9d --- /dev/null +++ b/hosts/eldrid/users/user/home-configuration.nix @@ -0,0 +1,15 @@ +{inputs, ...}: { + imports = with inputs; [ + self.homeModules.desktop + self.homeModules.programs + ./programs.nix + ./flatpak.nix + ]; + desktop.hyprland.enable = true; + home = { + stateVersion = "25.05"; + sessionPath = [ + "$HOME/.local/bin" + ]; + }; +} diff --git a/hosts/eldrid/users/user/programs.nix b/hosts/eldrid/users/user/programs.nix new file mode 100644 index 0000000..fcc38f6 --- /dev/null +++ b/hosts/eldrid/users/user/programs.nix @@ -0,0 +1,58 @@ +{pkgs, ...}: { + shell = { + nushell.enable = true; + oh-my-posh.enable = true; + }; + + console.yazi.enable = true; + + programs = { + bat.enable = true; + btop = { + enable = true; + settings.update_ms = 200; + }; + eza.enable = true; + fd.enable = true; + fzf.enable = true; + gitui.enable = true; + git = { + enable = true; + delta.enable = true; + signing.format = "ssh"; + aliases = { + cl = "clone"; + co = "checkout"; + pom = "push origin main"; + }; + }; + ripgrep.enable = true; + }; + + terminal = { + ghostty.enable = true; + kitty.enable = true; + }; + + editor = { + helix.enable = true; + neve.enable = true; + }; + + home.packages = with pkgs; [ + alejandra # nix formatter + flatpak # flatpak cli + trashy # trash cli + procs # ps in rust + dust # du in rust + fend # calc in rust + tree # tree util + rbw # bitwarden cli in rust + pinentry-qt # pinentry for rbw + zip # zip util + vial # qmk keyboard configuring app + unzip # unzip util + waycheck # check wayland protocols + virt-manager # libvirt gui + ]; +} diff --git a/hosts/sarien/configuration.nix b/hosts/sarien/configuration.nix index 84f6b65..12eaa33 100644 --- a/hosts/sarien/configuration.nix +++ b/hosts/sarien/configuration.nix @@ -6,6 +6,7 @@ }: { imports = with inputs; [ chaotic.nixosModules.default + lix.nixosModules.default self.nixosModules.desktop self.nixosModules.system ./hardware-conf.nix diff --git a/modules/home/desktop/hyprland/default.nix b/modules/home/desktop/hyprland/default.nix index 1a4a23b..3b407b1 100644 --- a/modules/home/desktop/hyprland/default.nix +++ b/modules/home/desktop/hyprland/default.nix @@ -331,6 +331,8 @@ in { ", XF86MonBrightnessDown, exec, brightnessctl s 5%-" "ALT, XF86MonBrightnessUp, exec, brightnessctl s 5%+ -d ${keyboard}::kbd_backlight" "ALT, XF86MonBrightnessDown, exec, brightnessctl s 5%- -d ${keyboard}::kbd_backlight" + ", XF86KbdBrightnessUp, exec, brightnessctl s 5%+ -d ${keyboard}::kbd_backlight" + ", XF86KbdBrightnessDown, exec, brightnessctl s 5%- -d ${keyboard}::kbd_backlight" ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" ];