From b7ef804b1d92d409b55c955fcfbaec8ceb62063a Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 5 Sep 2024 12:42:01 +0700 Subject: m --- hosts/cloud/sortug/configuration.nix | 3 +- hosts/local/gnome.nix | 137 ++++++++++++++++++++++++++ hosts/local/i3.nix | 17 ++-- hosts/local/master/configuration.nix | 6 +- hosts/local/master/hardware-configuration.nix | 12 +-- hosts/local/master/keyboard.nix | 44 +++++++++ hosts/local/master/oldhw.nix | 41 ++++++++ hosts/local/master/rapoo.kbd | 102 +++++++++++++++++++ hosts/local/nvidia.nix | 9 +- hosts/unfree.nix | 2 +- 10 files changed, 354 insertions(+), 19 deletions(-) create mode 100644 hosts/local/gnome.nix create mode 100644 hosts/local/master/keyboard.nix create mode 100644 hosts/local/master/oldhw.nix create mode 100644 hosts/local/master/rapoo.kbd (limited to 'hosts') diff --git a/hosts/cloud/sortug/configuration.nix b/hosts/cloud/sortug/configuration.nix index d409f83..d7d5394 100644 --- a/hosts/cloud/sortug/configuration.nix +++ b/hosts/cloud/sortug/configuration.nix @@ -9,7 +9,7 @@ ./hardware-configuration.nix (modulesPath + "/installer/scan/not-detected.nix") ../../base.nix - ../../users.nix + ../users.nix ../../server.nix ../packages.nix ./gitea.nix @@ -66,6 +66,7 @@ enable = true; domains = ["2001:4860:4860::8888" "2001:4860:4860::8844"]; }; + services.tailscale.enable = true; # networking.firewall = { # enable = true; diff --git a/hosts/local/gnome.nix b/hosts/local/gnome.nix new file mode 100644 index 0000000..9459392 --- /dev/null +++ b/hosts/local/gnome.nix @@ -0,0 +1,137 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + pkgs, + ... +}: { + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "us"; + xkb.variant = ""; + }; + # japanese input + + i18n = { + inputMethod = { + type = "fcitx5"; + fcitx5.addons = with pkgs; [fcitx5-mozc]; + }; + }; + + environment.sessionVariables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; + + environment.systemPackages = with pkgs; [ + polybar + rofi + # screenshots + flameshot + shutter + maim + + kitty + alacritty + signal-desktop + tdesktop + brave + gimp + vlc + thunderbird + kmail + firefox + chromium + pavucontrol + # icons + polkit_gnome + gnome-themes-extra + gtk-engine-murrine + gtk_engines + gsettings-desktop-schemas + lxappearance + adwaita-qt + adwaita-icon-theme + xfce.thunar + libreoffice + qbittorrent + zathura + # + libcamera # pipewire seems to want this + easyeffects + # games! + ryujinx + ]; + services.flatpak.enable = true; + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + + fonts = { + enableDefaultPackages = true; + fontconfig = { + defaultFonts.emoji = ["Noto Color Emoji"]; + defaultFonts.monospace = ["Hack" "Sarasa Mono SC"]; + defaultFonts.sansSerif = ["DejaVu Sans"]; + defaultFonts.serif = ["DejaVu Serif" "Source Han Serif SC"]; + }; + packages = with pkgs; [ + # fira-code + # fira + # cooper-hewitt + # ibm-plex + # jetbrains-mono + # iosevka + # spleen + # fira-code-symbols + # powerline-fonts + # nerdfonts + # arphic-ukai + # arphic-uming + # dejavu_fonts + # font-awesome + # inconsolata # monospaced + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-extra + # powerline-fonts + source-han-sans-japanese + # source-han-sans-korean + # source-han-sans-simplified-chinese + # source-han-sans-traditional-chinese + # source-sans-pro + # ubuntu_font_family + # wqy_microhei + # wqy_zenhei + ]; + }; + +} diff --git a/hosts/local/i3.nix b/hosts/local/i3.nix index 522dc83..492acda 100644 --- a/hosts/local/i3.nix +++ b/hosts/local/i3.nix @@ -26,12 +26,14 @@ }; environment.systemPackages = with pkgs; [ + polybar rofi # screenshots flameshot shutter maim + kitty alacritty signal-desktop tdesktop @@ -59,15 +61,18 @@ # libcamera # pipewire seems to want this easyeffects + # games! + ryujinx ]; + services.flatpak.enable = true; # cjk input - i18n = { - inputMethod = { - type = "fcitx5"; - fcitx5.addons = with pkgs; [fcitx5-rime fcitx5-mozc]; - }; - }; + # i18n = { + # inputMethod = { + # type = "fcitx5"; + # fcitx5.addons = with pkgs; [fcitx5-rime fcitx5-mozc]; + # }; + # }; fonts = { enableDefaultPackages = true; diff --git a/hosts/local/master/configuration.nix b/hosts/local/master/configuration.nix index 19708b8..c137835 100644 --- a/hosts/local/master/configuration.nix +++ b/hosts/local/master/configuration.nix @@ -7,9 +7,11 @@ ../../base.nix ../../linux.nix ../../unfree.nix - ../../android.nix - ../i3.nix + #../../android.nix + # ../i3.nix + ../gnome.nix ../nvidia.nix + ./keyboard.nix ]; # Use the systemd-boot EFI boot loader. diff --git a/hosts/local/master/hardware-configuration.nix b/hosts/local/master/hardware-configuration.nix index fc5597c..6e2ed9f 100644 --- a/hosts/local/master/hardware-configuration.nix +++ b/hosts/local/master/hardware-configuration.nix @@ -14,17 +14,18 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/13b360be-0528-4690-b7ab-80c89033c5b7"; + { device = "/dev/disk/by-uuid/3f1343f2-1ba3-4c57-b95e-bb808d3dffd3"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/92AC-1484"; + { device = "/dev/disk/by-uuid/C676-FD24"; fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; }; swapDevices = - [ { device = "/dev/disk/by-uuid/0b5d123f-3832-4aa2-b486-c64ed476fcf9"; } + [ { device = "/dev/disk/by-uuid/e34d7981-458b-462a-b551-007bce4f40f9"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking @@ -32,9 +33,8 @@ # 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.docker0.useDHCP = lib.mkDefault true; - # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.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/local/master/keyboard.nix b/hosts/local/master/keyboard.nix new file mode 100644 index 0000000..0aa0687 --- /dev/null +++ b/hosts/local/master/keyboard.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +{ + services.logind.extraConfig = '' + # don’t shutdown when power button is short-pressed + HandlePowerKey=ignore + ''; + +# config file keeps getting rewritten but I don't know by who + # i18n.inputMethod = { + # enabled = "fcitx5"; + # fcitx5.addons = with pkgs; [ + # fcitx5-mozc + # # mozc-ut is better, wat do + # fcitx5-gtk + # libsForQt5.fcitx5-qt + # fcitx5-lua + # fcitx5-configtool + # fcitx5-rime + # ]; + # }; + environment.variables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + FCITX_SOCKET = "default"; + }; + + + #kmonad + services.kmonad ={ + enable = true; + + keyboards.internal = { + device = "/dev/input/by-id/usb-RAPOO_Rapoo_2.4G_Wireless_Device-if02-event-kbd"; + config = builtins.readFile ./rapoo.kbd; + + # defcfg = { + # enable = true; + # fallthrough = true; + # }; + }; + }; +} diff --git a/hosts/local/master/oldhw.nix b/hosts/local/master/oldhw.nix new file mode 100644 index 0000000..fc5597c --- /dev/null +++ b/hosts/local/master/oldhw.nix @@ -0,0 +1,41 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/13b360be-0528-4690-b7ab-80c89033c5b7"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/92AC-1484"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/0b5d123f-3832-4aa2-b486-c64ed476fcf9"; } + ]; + + # 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.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/local/master/rapoo.kbd b/hosts/local/master/rapoo.kbd new file mode 100644 index 0000000..e117f2f --- /dev/null +++ b/hosts/local/master/rapoo.kbd @@ -0,0 +1,102 @@ +;; one liner comments ';;' +#| Multiline + comments |# + +(defcfg ;; For linux & by-id lists pluggable devices +;; If a key is not bound/left_empty(_) then it will fall back to the previous +;; layer's binding if not then default. +fallthrough true +;; To run system commands. You MIGHT face issues with tiling window managers due to command helpers. +;; allow-cmd true +;; use 'ls /dev/input/by-id/' for detachable keyboards and +;; 'ls /dev/input/by-path/' for builtin keyboards location' +;; input (device-file "/dev/input/event3") +input (device-file "/dev/input/by-id/usb-RAPOO_Rapoo_2.4G_Wireless_Device-if02-event-kbd") +;; Not sure what this does. Please check the docs. +output (uinput-sink "My KMonad output") +) + +;; This is the real representation of your actual keyboard. We haven't started +;; customizing layouts yet. +(defsrc + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + ` 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + caps a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft up + lctl lmet lalt spc ralt rctl left down right +) +;; Aliases + +(defalias +;; Layer toggles +sym (layer-toggle syms) +sym2 (layer-toggle syms2) +cords (sticky-key 1000 (layer-toggle mods)) +;; +hrt (layer-switch homerowmods) +back (layer-switch qwerty) + +;; Homerow keys +a (tap-hold-next-release 280 a lctl) +s (tap-hold-next-release 280 s lalt) +d (tap-hold-next-release 280 d lmet) +f (tap-hold-next-release 280 f lsft) +;; +j (tap-hold-next-release 280 j rsft) +k (tap-hold-next-release 280 k lmet) +l (tap-hold-next-release 280 l lalt) +semi (tap-hold-next-release 280 ; rctl) + +;; button to launch brave browser +;; veeb (cmd-button "brave") +;; ssf (sticky-key 500 (layer-toggle rshift)) +;; rsf (layer-toggle rshift) +) + +;; The first custom layer is the one that gets activated when kmonad is started +(deflayer qwerty ;; The default layer that'd be read when you launch kmonad + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + ` 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + esc a s d f g h j k l ; ' ret + @sym z x c v b n m , . / rsft up + lctl lmet @sym spc @cords @hrt left down right +) +(deflayer homerowmods + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + ` 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + esc @a @s @d @f g h @j @k @l @semi ' ret + @sym z x c v b n m , . / rsft up + lctl lmet @sym spc lalt @back left down right +) +(deflayer mods + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 + ` 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] h + esc lctl lalt lmet lsft g h rsft rmet ralt rctl ' ret + @sym z x c v b n m , . / rsft up + lctl lmet @sym spc lalt @back left down right +) + +;; A layer dedicated to symbols +(deflayer syms + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ up _ _ ! @ # $ % _ _ _ + _ _ left down right @sym2 ' ^ & - = _ ret + _ _ _ _ _ _ \( [ { < \ _ _ + _ _ _ _ _ _ _ _ _ +) + + +;; More symbols +(deflayer syms2 + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ ` ~ * \_ + _ ret + _ _ _ _ _ _ \) ] } > | _ _ + _ _ _ _ _ _ _ _ _ +) diff --git a/hosts/local/nvidia.nix b/hosts/local/nvidia.nix index 74d5f5d..84958a5 100644 --- a/hosts/local/nvidia.nix +++ b/hosts/local/nvidia.nix @@ -1,15 +1,18 @@ -{pkgs, ...}: { +{config, pkgs, ...}: { boot.kernelModules = ["nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm"]; # boot.kernelPackages = lib.mkForce unfreePkgs.linuxKernel.packages.linux_xanmod_latest; boot.kernelParams = ["video=HDMI-A-1:1920x1080"]; - # hardware.opengl = { + hardware.opengl = { # package = (pkgs.mesa.override { galliumDrivers = [ "i915" "swrast" ]; }).drivers; - # }; + enable = true; + }; + services.xserver = { videoDrivers = ["nvidia"]; }; hardware.nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.stable; modesetting.enable = true; powerManagement.enable = true; open = true; diff --git a/hosts/unfree.nix b/hosts/unfree.nix index 8a74ba9..79fecb1 100644 --- a/hosts/unfree.nix +++ b/hosts/unfree.nix @@ -11,7 +11,7 @@ vscode # fonts corefonts - symbola + # symbola ]; # fucking vscode requires this for github copilot -- cgit v1.2.3