diff --git a/.gitignore b/.gitignore index 29f4f2fa..8e01a766 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ result result/ +secrets/ .DS_Store diff --git a/Makefile b/Makefile index cb8a1140..ae059ad5 100644 --- a/Makefile +++ b/Makefile @@ -11,16 +11,16 @@ ############################################################################ i3: - nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo + nixos-rebuild switch --flake .#y9000k2021h_i3 --use-remote-sudo hypr: - nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo + nixos-rebuild switch --flake .#y9000k2021h_hyprland --use-remote-sudo i3-debug: - nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo --show-trace --verbose + nixos-rebuild switch --flake .#y9000k2021h_i3 --use-remote-sudo --show-trace --verbose hypr-debug: - nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo --show-trace --verbose + nixos-rebuild switch --flake .#y9000k2021h_hyprland --use-remote-sudo --show-trace --verbose up: nix flake update diff --git a/flake.lock b/flake.lock index 50e47be0..6415c224 100644 --- a/flake.lock +++ b/flake.lock @@ -441,18 +441,18 @@ "mysecrets": { "flake": false, "locked": { - "lastModified": 1692380165, - "narHash": "sha256-+vas7ICp7rl9mN2wPIRFkMsTyoDcMM62CV/+BT1rVY0=", + "lastModified": 1692196956, + "narHash": "sha256-QWnps45O1iDaTh8dpkmXftOfsygsMrNWnYCvbc3Re2I=", "ref": "refs/heads/main", - "rev": "3ef4106d1b2432a68704e90449a04615c5e7ebaa", + "rev": "e5caca7318f8b9cfac6f12879b6884f8896b91d6", "shallow": true, "type": "git", - "url": "ssh://git@github.com/ryan4yin/nix-secrets.git" + "url": "ssh://git@github.com/DataEraserC/nix-secrets.git" }, "original": { "shallow": true, "type": "git", - "url": "ssh://git@github.com/ryan4yin/nix-secrets.git" + "url": "ssh://git@github.com/DataEraserC/nix-secrets.git" } }, "nix-darwin": { @@ -618,11 +618,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1692264070, - "narHash": "sha256-WepAkIL2UcHOj7JJiaFS/vxrA9lklQHv8p+xGL+7oQ0=", + "lastModified": 1692356644, + "narHash": "sha256-AYkPFT+CbCVSBmh0WwIzPpwhEJ4Yy3A7JZvUkGJIg5o=", "owner": "nixos", "repo": "nixpkgs", - "rev": "42c25608aa2ad4e5d3716d8d63c606063513ba33", + "rev": "8ecc900b2f695d74dea35a92f8a9f9b32c8ea33d", "type": "github" }, "original": { @@ -782,6 +782,21 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1692455181, + "narHash": "sha256-XL4dXONV2sxtmYiIy9nGkAsI8L57SPbzrzSZp4yk+m4=", + "owner": "nix-community", + "repo": "NUR", + "rev": "37f30106cbd37398a53973fdc78a9fed152fc28b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "nur-ryan4yin": { "inputs": { "nixpkgs": "nixpkgs_8" @@ -842,6 +857,7 @@ "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-wayland": "nixpkgs-wayland", + "nur": "nur", "nur-ryan4yin": "nur-ryan4yin", "nushell-scripts": "nushell-scripts", "wallpapers": "wallpapers" @@ -904,15 +920,15 @@ "wallpapers": { "flake": false, "locked": { - "lastModified": 1690773162, - "narHash": "sha256-cZOvcRB+PwDA8vvcqHeB7oAK0Eabz9LSMUXwS39Ivco=", - "owner": "ryan4yin", + "lastModified": 1691774731, + "narHash": "sha256-fqRdn4204bJ8xF7APpAD3/J2Vr04/w4myFiHmugbym8=", + "owner": "Program-Learning", "repo": "wallpapers", - "rev": "515e4546b34adbfe7d62d2dbb3b51b8b8ff45716", + "rev": "7028f2fc3dd83a4ac486ad5aa0cdb0fc4eaddc58", "type": "github" }, "original": { - "owner": "ryan4yin", + "owner": "Program-Learning", "repo": "wallpapers", "type": "github" } diff --git a/flake.nix b/flake.nix index a6358e4e..20c7eb5d 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,7 @@ # The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function. outputs = inputs @ { self, + nur, nixpkgs, nixpkgs-unstable, nix-darwin, @@ -24,9 +25,9 @@ nixos-rk3588, ... }: let - username = "ryan"; - userfullname = "Ryan Yin"; - useremail = "xiaoyin_c@qq.com"; + username = "nixos"; + userfullname = "DataEraserC"; + useremail = "102341238+DataEraserC@users.noreply.github.com"; x64_system = "x86_64-linux"; x64_darwin = "x86_64-darwin"; @@ -38,6 +39,24 @@ macosSystem = import ./lib/macosSystem.nix; colemnaSystem = import ./lib/colmenaSystem.nix; + # y9000k2021h + idol_y9000k2021h_modules_i3 = { + nixos-modules = [ + ./hosts/idols/y9000k2021h + ./modules/nixos/i3.nix + inputs.nur.nixosModules.nur + ]; + home-module = import ./home/linux/desktop-i3.nix; + }; + idol_y9000k2021h_modules_hyprland = { + nixos-modules = [ + ./hosts/idols/y9000k2021h + ./modules/nixos/hyprland.nix + inputs.nur.nixosModules.nur + ]; + home-module = import ./home/linux/desktop-hyprland.nix; + }; + # 星野 アイ, Hoshino Ai idol_ai_modules_i3 = { nixos-modules = [ @@ -127,7 +146,14 @@ system = x64_system; specialArgs = x64_specialArgs; }; + stable_args = base_args // {inherit nixpkgs nur;}; + unstable_args = base_args // {nixpkgs = nixpkgs-unstable;inherit nur;}; in { + # y9000k2021h with i3 window manager + y9000k2021h_i3 = nixosSystem (idol_y9000k2021h_modules_i3 // stable_args); + # y9000k2021h with hyprland compositor + y9000k2021h_hyprland = nixosSystem (idol_y9000k2021h_modules_hyprland // stable_args); + # ai with i3 window manager ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args); # ai with hyprland compositor @@ -218,6 +244,8 @@ packages."${x64_system}" = # genAttrs returns an attribute set with the given keys and values(host => image). nixpkgs.lib.genAttrs [ + "y9000k2021h_i3" + "y9000k2021h_hyprland" "ai_i3" "ai_hyprland" ] ( @@ -280,6 +308,9 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # NUR package source + nur.url = "github:nix-community/NUR"; + # for macos nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin"; nix-darwin = { @@ -334,13 +365,14 @@ # my private secrets, it's a private repository, you need to replace it with your own. # use ssh protocol to authenticate via ssh-agent/ssh-key, and shallow clone to save time mysecrets = { - url = "git+ssh://git@github.com/ryan4yin/nix-secrets.git?shallow=1"; + url = "git+ssh://git@github.com/DataEraserC/nix-secrets.git?shallow=1"; flake = false; }; # my wallpapers wallpapers = { - url = "github:ryan4yin/wallpapers"; + url = "github:Program-Learning/wallpapers"; + # url = "git+file:////home/nixos/Documents/code/wallpapers?shallow=1"; flake = false; }; diff --git a/home/base/desktop/development.nix b/home/base/desktop/development.nix index 082b0783..ccd374ed 100644 --- a/home/base/desktop/development.nix +++ b/home/base/desktop/development.nix @@ -44,6 +44,7 @@ bfg-repo-cleaner # remove large files from git history k6 # load testing tool mitmproxy # http/https proxy tool + tcpdump protobuf # protocol buffer compiler ]; diff --git a/home/linux/desktop/creative.nix b/home/linux/desktop/creative.nix index 57425345..d3a50bb7 100644 --- a/home/linux/desktop/creative.nix +++ b/home/linux/desktop/creative.nix @@ -14,6 +14,34 @@ programs = { # live streaming - obs-studio.enable = true; + obs-studio = { + enable = true; + plugins = with pkgs; [ + # screen capture + obs-studio-plugins.wlrobs + # obs-studio-plugins.obs-ndi + obs-studio-plugins.obs-vaapi + obs-studio-plugins.obs-nvfbc + obs-studio-plugins.obs-teleport + # obs-studio-plugins.obs-hyperion + obs-studio-plugins.droidcam-obs + obs-studio-plugins.obs-vkcapture + obs-studio-plugins.obs-gstreamer + obs-studio-plugins.obs-3d-effect + obs-studio-plugins.input-overlay + obs-studio-plugins.obs-multi-rtmp + obs-studio-plugins.obs-source-clone + obs-studio-plugins.obs-shaderfilter + obs-studio-plugins.obs-source-record + obs-studio-plugins.obs-livesplit-one + obs-studio-plugins.looking-glass-obs + obs-studio-plugins.obs-vintage-filter + obs-studio-plugins.obs-command-source + obs-studio-plugins.obs-move-transition + obs-studio-plugins.obs-backgroundremoval + obs-studio-plugins.advanced-scene-switcher + obs-studio-plugins.obs-pipewire-audio-capture + ]; + }; }; } diff --git a/home/linux/desktop/custom-addon.nix b/home/linux/desktop/custom-addon.nix new file mode 100644 index 00000000..27782acb --- /dev/null +++ b/home/linux/desktop/custom-addon.nix @@ -0,0 +1,183 @@ +{ + config, + pkgs, + pkgs-unstable, + ... +}: { + home.packages = with pkgs; + # nixpkgs here + [ + warp + cloudflare-warp + glib + calcurse + #haskell + ghc + # nur-no-pkgs.repos.YisuiMilena.hmcl-bin + minecraft + # prismlauncher + # nur-no-pkgs.repos.xddxdd.wine-wechat + # nur-no-pkgs.repos.linyinfeng.wemeet + protonup-qt + appimage-run + # vim-like browser + vimb + # Netease music + yesplaymusic + clash-verge + sing-box + # Office + onlyoffice-bin + libreoffice + # math software + # geogebra6 + # communication apps + tdesktop + # video software + vlc + # file manager + gnome.nautilus + # download manager + motrix + wine64Packages.stagingFull + winetricks + onscripter-en + # playonlinux + # bottles + # bottles-unwrapped + lutris + # lutris-unwrapped + # remote control + wayvnc + # dunst + # pipewire + wireplumber + tofi + eww-wayland + rofi-wayland + polkit-kde-agent + qt6.qtwayland + # wayland + # wayland-scanner + # wayland-utils + # egl-wayland + # wayland-protocols + # glfw-wayland + wev + # libsForQt5.qt5.qtwayland + # xdg-desktop-portal-hyprland + linuxKernel.packages.linux_6_1.v4l2loopback + libsForQt5.polkit-kde-agent + brightnessctl + # kitty-themes + + adwaita-qt + adwaita-qt6 + lxde.lxsession # lxpolkit + # polkit_gnome + # deepin.dde-polkit-agent + hyprpicker + swappy + bluez + sysfsutils + jq + wlroots + # catppuccin-kvantum + # htop + vim # file editor + dolphin # file browser + postman + artha + iw + file + coreutils + openssl + gitRepo + # python310 python310.pkgs.pip pipenv + nodejs + # php mysql80 apacheHttpd nginxShibboleth # PHP + php + php81Packages.composer + nixfmt + fuse + ntfs3g + foot # terminal + fish # shell + scrcpy + jadx + meld + distrobox + darling-dmg + dash + unrar-wrapper + # python2Full + inotify-tools + python311Packages.gpustat + vmware-workstation + + #-- remote control + # turbovnc + xrdp + libvncserver + gnome.gnome-remote-desktop + gnome.gnome-clocks + # wayvnc + novnc + # usb flashing + ventoy + # achieve/file managers + xarchiver mate.engrampa gnome.file-roller ark ranger + # Graphical application to analyse disk usage in any GNOME environment + baobab + # vaapi + gst_all_1.gst-vaapi + # payload-dumper + payload-dumper-go + # sshfs + sftpman + # edge browser + microsoft-edge + # sql + mysql80 + sqliteman + + # pkg required by nix-shell + pkgconfig + ncurses6 + # ncurses5 + pkgsCross.aarch64-multiplatform.stdenv.cc + pkgsCross.arm-embedded.stdenv.cc + clang15Stdenv + pkgsLLVM.crossLibcStdenv + glibc + libcxx + zlib + ninja + ] + # nixpkgs-unstable + ++ (with pkgs-unstable;[ + fastfetch + ]) + # nur packages here + ++ (with pkgs.nur.repos; [ + YisuiMilena.hmcl-bin + linyinfeng.wemeet + linyinfeng.icalingua-plus-plus + linyinfeng.matrix-wechat + xddxdd.wechat-uos + xddxdd.dingtalk + xddxdd.bilibili + xddxdd.onepush + xddxdd.grasscutter + ataraxiasjel.waydroid-script + arti5an.mount-zip + aleksana.go-musicfox + # aleksana.fastfetch + alexnortung.pkgs.papermc-1_18_x + + ]); + + # Custom Desktop Shortcuts + home.file.".local/share/applications/io.github.msojocs.wechat_devtools.desktop".source = ./shortcuts/io.github.msojocs.wechat_devtools.desktop; + # home.file.".local/share/applications/code_ime.desktop".source = ./shortcuts/code_ime.desktop; +} diff --git a/home/linux/desktop/default.nix b/home/linux/desktop/default.nix index 3bb8b9ba..5765f1fc 100644 --- a/home/linux/desktop/default.nix +++ b/home/linux/desktop/default.nix @@ -7,6 +7,7 @@ ./ssh.nix ./wallpaper.nix ./xdg.nix + ./custom-addon.nix ]; home.packages = with pkgs; [ diff --git a/home/linux/desktop/shortcuts/code_ime.desktop b/home/linux/desktop/shortcuts/code_ime.desktop new file mode 100644 index 00000000..27237731 --- /dev/null +++ b/home/linux/desktop/shortcuts/code_ime.desktop @@ -0,0 +1,19 @@ +[Desktop Entry] +Actions=new-empty-window +Categories=Utility;TextEditor;Development;IDE +Comment=Code Editing. Redefined. +Exec=code --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime %F +GenericName=Text Editor +Icon=code +Keywords=vscode +MimeType=text/plain;inode/directory +Name=Visual Studio Code on Wayland With Fcitx5 +StartupNotify=true +StartupWMClass=Code +Type=Application +Version=1.4 + +[Desktop Action new-empty-window] +Exec=code --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime --new-window %F +Icon=code +Name=New Empty Window diff --git a/home/linux/desktop/shortcuts/io.github.msojocs.wechat_devtools.desktop b/home/linux/desktop/shortcuts/io.github.msojocs.wechat_devtools.desktop new file mode 100644 index 00000000..02ad554a --- /dev/null +++ b/home/linux/desktop/shortcuts/io.github.msojocs.wechat_devtools.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Name=WeChat Dev Tools +Name[zh_CN]=微信开发者工具 +Comment=The development tools for wechat projects +Comment[zh_CN]=提供微信开发相关项目的开发IDE支持 +Categories=Development;WebDevelopment;IDE; +Exec=appimage-run ~/Apps/Appimages/WeChat_Dev_Tools_v1.06.2306020-1_x86_64_linux.AppImage +Icon=wechat-devtools +Type=Application +Terminal=false +StartupWMClass=wechat_devtools +Actions= +MimeType=x-scheme-handler/wechatide +X-AppImage-Version=v1.06.2306020-1 diff --git a/home/linux/desktop/wallpaper.nix b/home/linux/desktop/wallpaper.nix index 12ea1458..8531e8ed 100644 --- a/home/linux/desktop/wallpaper.nix +++ b/home/linux/desktop/wallpaper.nix @@ -7,4 +7,8 @@ source = "${wallpapers}/wallpaper_random.py"; executable = true; }; + home.file.".local/bin/default_wall" = { + source = "${wallpapers}/default_wall.py"; + executable = true; + }; } diff --git a/home/linux/fcitx5/.pam_environment b/home/linux/fcitx5/.pam_environment new file mode 100644 index 00000000..fdc72a85 --- /dev/null +++ b/home/linux/fcitx5/.pam_environment @@ -0,0 +1,3 @@ +GTK_IM_MODULE DEFAULT=fcitx +QT_IM_MODULE DEFAULT=fcitx +XMODIFIERS DEFAULT=@im=fcitx diff --git a/home/linux/fcitx5/profile b/home/linux/fcitx5/profile index ca43a79c..dd3ec0a2 100644 --- a/home/linux/fcitx5/profile +++ b/home/linux/fcitx5/profile @@ -1,3 +1,23 @@ +[Groups/1] +# Group Name +Name=Default +# Layout +Default Layout=us +# Default Input Method +DefaultIM=pinyin + +[Groups/1/Items/0] +# Name +Name=keyboard-us +# Layout +Layout= + +[Groups/1/Items/1] +# Name +Name=pinyin +# Layout +Layout= + [Groups/0] # Group Name Name=Other @@ -13,5 +33,6 @@ Name=rime Layout= [GroupOrder] +1=Default 0=Other diff --git a/home/linux/hyprland/hypr-conf/hyprland.conf b/home/linux/hyprland/hypr-conf/hyprland.conf index b90f103f..6d590fc5 100644 --- a/home/linux/hyprland/hypr-conf/hyprland.conf +++ b/home/linux/hyprland/hypr-conf/hyprland.conf @@ -26,6 +26,10 @@ input { kb_rules= follow_mouse=1 natural_scroll=0 + touchpad { + natural_scroll = 1 + } + force_no_accel=0 # repeat_rate= # repeat_delay= @@ -69,10 +73,10 @@ decoration { #-- Animations ---------------------------------------------------- animations { enabled=1 - animation=windows,1,8,default,popin 80% - animation=fadeOut,1,8,default - animation=fadeIn,1,8,default - animation=workspaces,1,8,default + animation=windows,1,3,default,popin 80% + animation=fadeOut,1,3,default + animation=fadeIn,1,3,default + animation=workspaces,1,3,default #animation=workspaces,1,6,overshot } @@ -88,6 +92,7 @@ windowrule=float,xfce-polkit|kvantummanager|qt5ct windowrule=float,feh|imv|Gpicview|Gimp|nomacs windowrule=float,VirtualBox Manager|qemu|Qemu-system-x86_64 windowrule=float,xfce4-appfinder +windowrule=float,wemeet windowrule=float,foot-full windowrule=move 0 0,foot-full @@ -99,6 +104,7 @@ windowrule=size 100% 100%,wlogout windowrule=animation slide,wlogout #-- Keybindings ---------------------------------------------------- +$mainMod = SUPER $term = kitty $app_launcher = ~/.config/hypr/scripts/menu $volume = ~/.config/hypr/scripts/volume @@ -107,7 +113,8 @@ $screenshot = ~/.config/hypr/scripts/screenshot $lockscreen = ~/.config/hypr/scripts/lockscreen $wlogout = ~/.config/hypr/scripts/wlogout $colorpicker = ~/.config/hypr/scripts/colorpicker -$files = thunar +$files = nautilus +$editor = code # vscode $browser = firefox # -- Terminal -- @@ -221,3 +228,8 @@ exec-once = xrdb -merge ~/.Xresources # env = GDK_SCALE,2 env = XCURSOR_SIZE,48 env = XCURSOR_THEME,"Bibata-Modern-Ice" + +#-- brightnessctl +bind = , XF86MonBrightnessDown, exec, brightnessctl set -d intel_backlight 5%- +bind = , XF86MonBrightnessUp, exec, brightnessctl set -d intel_backlight 5%+ +bind = SUPER, E, exec, $files \ No newline at end of file diff --git a/home/linux/hyprland/hypr-conf/scripts/cpugovernor b/home/linux/hyprland/hypr-conf/scripts/cpugovernor new file mode 100755 index 00000000..4e640ba0 --- /dev/null +++ b/home/linux/hyprland/hypr-conf/scripts/cpugovernor @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) +echo '{"text": "perf", "alt": "'$GOV'", "class": "'$GOV'", "tooltip": "Governor '$GOV'"}' diff --git a/home/linux/hyprland/hypr-conf/scripts/startup b/home/linux/hyprland/hypr-conf/scripts/startup index 6888d599..bd8ddf57 100755 --- a/home/linux/hyprland/hypr-conf/scripts/startup +++ b/home/linux/hyprland/hypr-conf/scripts/startup @@ -18,6 +18,20 @@ swaybg --output '*' --mode fill --image ~/.config/wallpapers/default_wallpaper & # Lauch statusbar (waybar) ~/.config/hypr/scripts/statusbar & +# ~/.config/hypr/scripts/statusbar_debug & # Start mpd exec mpd & + +# Start wayvnc +exec wayvnc & + +# Start clash-verge +exec clash-verge & + +# Start lxpolkit +exec lxpolkit & + +# Start swayidle +# exec swayidle -w timeout 1800 'systemctl suspend' resume 'hyprctl dispatch dpms on' timeout 120 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock' +exec swayidle -w timeout 120 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock' diff --git a/home/linux/hyprland/hypr-conf/scripts/statusbar_debug b/home/linux/hyprland/hypr-conf/scripts/statusbar_debug new file mode 100755 index 00000000..79a1655c --- /dev/null +++ b/home/linux/hyprland/hypr-conf/scripts/statusbar_debug @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +## launch waybar with alt config + +CONFIG="$HOME/.config/hypr/waybar/config.jsonc" +STYLE="$HOME/.config/hypr/waybar/style.css" + +kill $(pgrep waybar) +while true; do + if [[ ! $(pidof waybar) ]]; then + waybar --bar main-bar --log-level error --config ${CONFIG} --style ${STYLE} + fi + inotifywait -e create,modify $CONFIG $STYLE + kill $(pgrep waybar) +done \ No newline at end of file diff --git a/home/linux/hyprland/hypr-conf/waybar/config.jsonc b/home/linux/hyprland/hypr-conf/waybar/config.jsonc index ce2e95d8..993084d7 100644 --- a/home/linux/hyprland/hypr-conf/waybar/config.jsonc +++ b/home/linux/hyprland/hypr-conf/waybar/config.jsonc @@ -11,13 +11,15 @@ "custom/playerctl" ], "modules-right": [ - "mpd", + // "mpd", "pulseaudio", "backlight", + "battery", "memory", "cpu", "network", "clock", + "idle_inhibitor", "custom/powermenu", "tray" ], @@ -25,18 +27,7 @@ "format": "{icon}", "on-click": "activate", "format-icons": { - "1": "", - "2": "", - "3": "", - "4": "", - "5": "", - "6": "", - "7": "", - "8": "", - "9": "", - "10": "〇", - "focused": "", - "default": "" + "focused": "" } }, @@ -46,11 +37,15 @@ "rotate": 0, "tooltip-format": "{:%B %Y}\n{calendar}", "format": " {:%H:%M}", - "format-alt": " {:%a %b %d, %G}" + "format-alt": " {:%a %b %d, %G}", + "on-double-click": "kitty sh -c calcurse", + "on-click-right": "gnome-clocks" }, "cpu": { "format": "\udb80\udf5b {usage}%", - "interval": 1 + "interval": 1, + "on-click-middle": "kitty sh -c btop", + "on-click-right": "kitty sh -c btop" }, "custom/launcher": { "format": "\uf313 ", @@ -77,7 +72,9 @@ "interval": 1, "states": { "warning": 85 - } + }, + "on-click-middle": "kitty sh -c btop", + "on-click-right": "kitty sh -c btop" }, "mpd": { "interval": 2, @@ -122,9 +119,11 @@ "format-linked": " {ifname} (No IP)", "format-disconnected": "睊 Disconnected", "format-disabled": "睊 Disabled", - "format-alt": " {bandwidthUpBits} |  {bandwidthDownBits}", + "format-alt": " {bandwidthUpBytes} |  {bandwidthDownBytes}", "tooltip-format": " {ifname} via {gwaddr}", - }, + "on-click-middle": "nmtui", + "on-click-right": "nm-connection-editor" + }, "pulseaudio": { //"format": "{volume}% {icon} {format_source}", "format": "{icon} {volume}%", @@ -150,7 +149,7 @@ // Commands to execute on events "on-click": "amixer set Master toggle", "on-click-right": "pavucontrol", - "smooth-scrolling-threshold": 1, + "smooth-scrolling-threshold": 1 }, "temperature": { "format": "\uf2c9 {temperatureC}\u00b0C", @@ -159,5 +158,58 @@ "tray": { "icon-size": 15, "spacing": 5 + }, + "backlight": { + "format": "{icon} {percent}%", + "format-icons": [ + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "battery": { + "bat": "BAT0", + "adapter": "ADP0", + "interval": 60, + "states": { + "warning": 30, + "critical": 15 + }, + "max-length": 20, + "format": "{icon} {capacity}%", + "format-warning": "{icon} {capacity}%", + "format-critical": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-plugged": " {capacity}%", + "format-alt": "{icon} {time}", + "format-full": " {capacity}%", + "format-icons": [ + " ", + " ", + " ", + " ", + " " + ] } + // "custom/cpugovernor": { + // "format": "{icon}", + // "interval": "1", + // "return-type": "json", + // "exec": "$HOME/.config/hypr/scripts/cpugovernor", + // "min-length": 2, + // "format-icons": { + // "performance": "󰓅", + // "powersave": "", + // "userspace": "", + // "ondemand": "", + // "conservative": "", + // "schedutil": "󰻠" + // } + // } } diff --git a/home/linux/hyprland/hypr-conf/waybar/style.css b/home/linux/hyprland/hypr-conf/waybar/style.css index cb5e2d5e..cb7e602d 100644 --- a/home/linux/hyprland/hypr-conf/waybar/style.css +++ b/home/linux/hyprland/hypr-conf/waybar/style.css @@ -78,6 +78,7 @@ tooltip label { #pulseaudio, #network, #battery, +#custom-cpugovernor, #custom-powermenu { padding-left: 10px; padding-right: 10px; @@ -97,9 +98,28 @@ tooltip label { #clock { color: rgb(217, 224, 238); } -/* #idle_inhibitor { - color: rgb(221, 182, 242); - }*/ + +#battery { + color: rgb(126, 186, 244);; +} +#battery.charging, +#battery.full, +#battery.plugged { + color: #26a65b; +} +#battery.critical:not(.charging) { + color: #f53c3c; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#idle_inhibitor { + color: rgb(221, 182, 242); + padding-right: 8px; +} #custom-wall { color: #33ccff; } diff --git a/home/linux/hyprland/wayland-apps.nix b/home/linux/hyprland/wayland-apps.nix index 947ab898..cdfe4c11 100644 --- a/home/linux/hyprland/wayland-apps.nix +++ b/home/linux/hyprland/wayland-apps.nix @@ -8,9 +8,11 @@ commandLineArgs = [ # make it use GTK_IM_MODULE if it runs with Gtk4, so fcitx5 can work with it. # (only supported by chromium/chrome at this time, not electron) - "--gtk-version=4" + "--gtk-version=5" + "--enable-features=UseOzonePlatform" + "--ozone-platform=wayland" # make it use text-input-v1, which works for kwin 5.27 and weston - # "--enable-wayland-ime" + "--enable-wayland-ime" # enable hardware acceleration - vulkan api # "--enable-features=Vulkan" @@ -22,5 +24,23 @@ enableGnomeExtensions = false; package = pkgs.firefox-wayland; # firefox with wayland support }; + + vscode = { + enable = true; + # use the stable version + package = pkgs.vscode.override { + commandLineArgs = [ + # make it use text-input-v1, which works for kwin 5.27 and weston + # "--enable-features=UseOzonePlatform" + # "--ozone-platform=wayland" + # "--enable-wayland-ime" + # "--enable-features=UseOzonePlatform" + # "--ozone-platform=x11" + ]; + }; + + # let vscode sync and update its configuration & extensions across devices, using github account. + # userSettings = {}; + }; }; } diff --git a/hosts/idols/y9000k2021h/cifs-mount.nix b/hosts/idols/y9000k2021h/cifs-mount.nix new file mode 100644 index 00000000..d40a0313 --- /dev/null +++ b/hosts/idols/y9000k2021h/cifs-mount.nix @@ -0,0 +1,16 @@ +{ + config, + pkgs, + + username, + ... +}: { + # mount a smb/cifs share + fileSystems."/home/${username}/SMB-Downloads" = { + device = "//192.168.5.194/Downloads"; + fsType = "cifs"; + options = [ + "vers=3.0,uid=1000,gid=100,dir_mode=0755,file_mode=0755,mfsymlinks,credentials=${config.age.secrets.smb-credentials.path},nofail" + ]; + }; +} diff --git a/hosts/idols/y9000k2021h/default.nix b/hosts/idols/y9000k2021h/default.nix new file mode 100644 index 00000000..dfbef2e3 --- /dev/null +++ b/hosts/idols/y9000k2021h/default.nix @@ -0,0 +1,110 @@ +{config, ...} @ args: +############################################################# +# +# y9000k2021h - my main computer, with NixOS + i7-11800H + RTX 3060 Mobile / Max-Q GPU, for gaming & daily use. +# +############################################################# +{ + imports = [ + # ./cifs-mount.nix + # Include the results of the hardware scan. + ./hardware-configuration.nix + + ../../../modules/nixos/fhs-fonts.nix + ../../../modules/nixos/libvirt.nix + ../../../modules/nixos/core-desktop.nix + ../../../modules/nixos/remote-building.nix + ../../../modules/nixos/user-group.nix + + ../../../secrets/nixos.nix + + ../../../modules/nixos/custom-addon.nix + ]; + + nixpkgs.overlays = import ../../../overlays args; + + # Enable binfmt emulation of aarch64-linux, this is required for cross compilation. + boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"]; + # supported fil systems, so we can mount any removable disks with these filesystems + boot.supportedFilesystems = [ + "ext4" + "btrfs" + "xfs" + #"zfs" + "ntfs" + "fat" + "vfat" + "exfat" + "cifs" # mount windows share + ]; + + # Bootloader. + boot.loader = { + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; # ← use the same mount point here. + }; + systemd-boot.enable = true; + }; + + networking = { + hostName = "y9000k2021h"; + wireless.enable = false; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # proxy.default = "http://user:password@proxy:port/"; + # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + networkmanager.enable = true; + + enableIPv6 = false; # disable ipv6 + interfaces.wlp0s20f3 = { + useDHCP = false; + ipv4.addresses = [ + { + address = "192.168.2.120"; + prefixLength = 24; + } + ]; + }; + defaultGateway = "192.168.2.1"; + nameservers = [ + "119.29.29.29" # DNSPod + "223.5.5.5" # AliDNS + ]; + }; + + # virtualisation.docker.storageDriver = "btrfs"; + + # for Nvidia GPU + services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default + hardware.nvidia = { + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + + # Modesetting is needed for most Wayland compositors + modesetting.enable = true; + # Use the open source version of the kernel module + # Only available on driver 515.43.04+ + open = false; + + powerManagement.enable = true; + }; + virtualisation.docker.enableNvidia = true; # for nvidia-docker + + hardware.opengl = { + enable = true; + # if hardware.opengl.driSupport is enabled, mesa is installed and provides Vulkan for supported hardware. + driSupport = true; + # needed by nvidia-docker + driSupport32Bit = true; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.11"; # Did you read the comment? +} diff --git a/hosts/idols/y9000k2021h/hardware-configuration.nix b/hosts/idols/y9000k2021h/hardware-configuration.nix new file mode 100644 index 00000000..2f860a17 --- /dev/null +++ b/hosts/idols/y9000k2021h/hardware-configuration.nix @@ -0,0 +1,58 @@ +# 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.extraModulePackages = with config.boot.kernelPackages; + [ v4l2loopback.out ]; + # Set initial kernel module settings + boot.extraModprobeConfig = '' + # exclusive_caps: Skype, Zoom, Teams etc. will only show device when actually streaming + # card_label: Name of virtual camera, how it'll show up in Skype, Zoom, Teams + # https://github.com/umlaeute/v4l2loopback + options v4l2loopback exclusive_caps=1 card_label="Virtual Camera" + ''; + boot.initrd.kernelModules = []; + boot.kernelModules = [ + # kvm + "kvm-intel" + # Virtual Camera + "v4l2loopback" + # Virtual Microphone, built-in + "snd-aloop" + ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/7bd1f58c-482d-4c70-bba8-a3aa216eaef6"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/DBEB-5479"; + fsType = "vfat"; + }; + + swapDevices = [{device = "/dev/disk/by-uuid/49e5a291-fc25-4d0e-84dd-9e30369a9a5f";}]; + + # 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.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/lib/nixosSystem.nix b/lib/nixosSystem.nix index 0cdc157e..9cd0d667 100644 --- a/lib/nixosSystem.nix +++ b/lib/nixosSystem.nix @@ -1,4 +1,5 @@ { + nur, nixpkgs, home-manager, nixos-generators, @@ -39,6 +40,7 @@ in home-manager.extraSpecialArgs = specialArgs; home-manager.users."${username}" = home-module; + nixpkgs.overlays = [ nur.overlay ]; } ]; } diff --git a/modules/nixos/core-desktop.nix b/modules/nixos/core-desktop.nix index 1995f34f..a7cab830 100644 --- a/modules/nixos/core-desktop.nix +++ b/modules/nixos/core-desktop.nix @@ -62,6 +62,7 @@ main = { # overloads the capslock key to function as both escape (when tapped) and control (when held) capslock = "overload(control, esc)"; + esc = "capslock"; }; }; }; @@ -173,6 +174,7 @@ source-han-sans # 思源黑体 source-han-serif # 思源宋体 + sarasa-gothic # nerdfonts (nerdfonts.override { fonts = [ diff --git a/modules/nixos/custom-addon.nix b/modules/nixos/custom-addon.nix new file mode 100644 index 00000000..e28dea6b --- /dev/null +++ b/modules/nixos/custom-addon.nix @@ -0,0 +1,83 @@ +{ config, pkgs, ... }: { + programs = { + + steam = { + enable = true; + remotePlay.openFirewall = + true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = + true; # Open ports in the firewall for Source Dedicated Server + }; + + proxychains = { + enable = true; + proxies = { + myproxy = { + enable = true; + type = "socks5"; + host = "127.0.0.1"; + port = 7890; + }; + }; + }; + + darling = { enable = true; }; + + }; + + services = { + + logind = { + lidSwitch = "ignore"; + lidSwitchDocked = "ignore"; + lidSwitchExternalPower = "ignore"; + extraConfig = "HandlePowerKey=ignore"; + # powerKey = "ignore"; + # rebootKey = "ignore"; + }; + + # tlp = { + # enable = true; + # settings = { + # CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + # CPU_SCALING_GOVERNOR_ON_AC = "powersave"; + + # # The following prevents the battery from charging fully to + # # preserve lifetime. Run `tlp fullcharge` to temporarily force + # # full charge. + # # https://linrunner.de/tlp/faq/battery.html#how-to-choose-good-battery-charge-thresholds + # START_CHARGE_THRESH_BAT0 = 40; + # STOP_CHARGE_THRESH_BAT0 = 50; + + # # 100 being the maximum, limit the speed of my CPU to reduce + # # heat and increase battery usage: + # CPU_MAX_PERF_ON_AC = 75; + # CPU_MAX_PERF_ON_BAT = 60; + # }; + # }; + + }; + + systemd.services = { + + cpolar = { + enable = true; + # path = "/home/nixos/Apps/Bins/cpolar/"; + description = + "cpolar secure tunnels to localhost webhook development tool and debugging tool."; + unitConfig = { + Type = "simple"; + # ... + }; + serviceConfig = { + ExecStart = '' + /home/nixos/Apps/Bins/cpolar/cpolar "start-all" "-daemon=on" "-dashboard=on" "-log=/home/nixos/Apps/Bins/cpolar/.cpolar/logs/cpolar_service.log" "-config=/home/nixos/Apps/Bins/cpolar/.cpolar/cpolar.yml"''; + # ... + }; + wantedBy = [ "multi-user.target" ]; + # ... + }; + + }; + +} diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index d4c46277..d8c97e2a 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -18,6 +18,7 @@ wlr.enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr + # xdg-desktop-portal-hyprland ]; }; @@ -35,10 +36,16 @@ displayManager = { defaultSession = "hyprland"; lightdm.enable = false; - gdm = { - enable = true; - wayland = true; - }; + # gdm = { + # enable = true; + # wayland = true; + # debug = true; + # settings = { + # debug = { + # enable = true; + # }; + # }; + # }; }; }; }; diff --git a/modules/nixos/libvirt.nix b/modules/nixos/libvirt.nix index 03e47fe9..fc034e29 100644 --- a/modules/nixos/libvirt.nix +++ b/modules/nixos/libvirt.nix @@ -14,13 +14,45 @@ enable = true; # hanging this option to false may cause file permission issues for existing guests. # To fix these, manually change ownership of affected files in /var/lib/libvirt/qemu to qemu-libvirtd. - qemu.runAsRoot = true; + qemu = { + runAsRoot = true; + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; }; + spiceUSBRedirection.enable = true; }; + + services.spice-vdagentd.enable = true; + programs.dconf.enable = true; environment.systemPackages = with pkgs; [ # Need to add [File (in the menu bar) -> Add connection] when start for the first time virt-manager + virt-manager-qt + virt-viewer + + spice + spice-gtk + spice-protocol + win-spice + + win-virtio + + gnome.adwaita-icon-theme + + iproute + + edk2 + + OVMFFull + + x11docker + + virtiofsd + + dmg2img # QEMU/KVM, provides: # qemu-storage-daemon qemu-edid qemu-ga @@ -38,8 +70,18 @@ qemu_full ]; - boot.kernelModules = ["kvm-amd" "kvm-intel"]; + boot.kernelModules = ["kvm-amd" "kvm-intel" "vfio-pci"]; # Enable nested virsualization, required by security containers and nested vm. boot.extraModprobeConfig = "options kvm_intel nested=1"; # for intel cpu # boot.extraModprobeConfig = "options kvm_amd nested=1"; # for amd cpu + + virtualisation = { + virtualbox.host.enable = true; + virtualbox.host.enableExtensionPack = true; + virtualbox.guest.enable = true; + virtualbox.guest.x11 = true; + waydroid.enable = true; + lxd.enable = true; + }; + nixpkgs.config.allowUnfree = true; } diff --git a/modules/nixos/user-group.nix b/modules/nixos/user-group.nix index 9cb21858..4baac3e8 100644 --- a/modules/nixos/user-group.nix +++ b/modules/nixos/user-group.nix @@ -24,11 +24,11 @@ "wireshark" "adbusers" "libvirtd" + "vboxusers" ]; openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDiipi59EnVbi6bK1bGrcbfEM263wgdNfbrt6VBC1rHx ryan@ai-idols" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII7PTkP3ixXTZlrJNSHnXgkmHNT+QslFi9wNYXOpVwGB ryan@harmonica" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK3F3AH/vKnA2vxl72h67fcxhIK8l+7F/bdE1zmtwTVU ryan@romantic" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBO0+WOKwK9EcRj2Bcdt/VpiB9MvZYqk4JKxlcQElskx nixos@nixos" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDD9oj03QzeGTx7l3XEcIt/rDD6UwarjxeV38iVa8FKQftwuhFVqeJpI+kAeWwUynTOhKLCG/WbcLNCFGI9I9E3NjkSPMXv018yy7X30VFcEn7Arl7Ab48ZVEgRguru5XpuZZWI+IID4T5erbsng1ekQGLBgz0hEokGOKhyqoTgUb/Fpm5S6Ubl66//OF5OIkcdmKQ8mRtQxrjxqYB3ZWX4xbxevKHQbGFtbjZVWO70GfGnMfl6urpPMVmJXe+tHarDsQAiU9BySO+7kmkRfQfUtwiOJ7o2M0evIcKuxyzQ5yRSO9ZeHMzjDLaGAK/5UMvoEP7yZfrom0qBfQpEeHnvEUct80tugH0xCvmqMq1SKxaG64LsRXJIFsv71vPHvLU/U1PTYEEuSVOg+coGG/hMl/iuq9bdfuiiyDjNZtn6FpY5fDj6lBF49wqQuc7JMQ4pWH88aRqCFLlRXDk/jTe+BuaEfghOgbCpq1Xyrb3cnc9iR88udXzas18SqcAT9ec= 102341238+DataEraserC@users.noreply.github.com" ]; }; diff --git a/overlays/waybar/default.nix b/overlays/waybar/default.nix new file mode 100644 index 00000000..28213bbb --- /dev/null +++ b/overlays/waybar/default.nix @@ -0,0 +1,7 @@ +{ ... }: +(self: super: { + waybar = super.waybar.overrideAttrs (oldAttrs: { + mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true " ]; + }); + +})