diff --git a/configuration.nix b/configuration.nix index 49e730d..2880151 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,16 +1,16 @@ # NixOS configurations file. -{config, pkgs, lib,...}: { +{ config, pkgs, lib, ... }: { system.stateVersion = "23.05"; - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix - # User custom configurations. - ./global + # User custom configurations. + ./global ]; system.autoUpgrade = { enable = true; flake = "git+https://git.sense-t.eu.org/NixOS/gpd-configurations#gpd"; }; -} \ No newline at end of file +} diff --git a/flake.lock b/flake.lock index d3d47ba..ceef82e 100644 --- a/flake.lock +++ b/flake.lock @@ -74,11 +74,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1687829761, - "narHash": "sha256-QRe1Y8SS3M4GeC58F/6ajz6V0ZLUVWX3ZAMgov2N3/g=", + "lastModified": 1688389917, + "narHash": "sha256-RKiK1QeommEsjQ8fLgxt4831x9O6n2gD7wAhVZTrr8M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9790f3242da2152d5aa1976e3e4b8b414f4dd206", + "rev": "aed4b19d312525ae7ca9bceb4e1efe3357d0e2eb", "type": "github" }, "original": { @@ -98,4 +98,4 @@ }, "root": "root", "version": 7 -} \ No newline at end of file +} diff --git a/flake.nix b/flake.nix index 45eaea6..c5231f4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,77 +1,78 @@ { - description = "NixOS configuration for GPD Win Max"; + description = "NixOS configuration for GPD Win Max"; - nixConfig = rec { - auto-optimise-store = true; - experimental-features = [ "nix-command" "flakes" ]; - trusted-substituters = [ - "https://mirrors.ustc.edu.cn/nix-channels/store" # 中科大 - "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # 清华 - "https://mirrors.bfsu.edu.cn/nix-channels/store" # 北外 - "https://mirror.sjtu.edu.cn/nix-channels/store" # 交大 - "https://nixos-cn.cachix.org" - "https://cache.nixos.org/" - ]; - substituters = trusted-substituters; + nixConfig = rec { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + trusted-substituters = [ + "https://mirrors.ustc.edu.cn/nix-channels/store" # 中科大 + "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # 清华 + "https://mirrors.bfsu.edu.cn/nix-channels/store" # 北外 + "https://mirror.sjtu.edu.cn/nix-channels/store" # 交大 + "https://nixos-cn.cachix.org" + "https://cache.nixos.org/" + ]; + substituters = trusted-substituters; - trusted-users = [ - "user" - "root" - "@wheel" - ]; + trusted-users = [ + "user" + "root" + "@wheel" + ]; + }; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-23.05"; + impermanence.url = "github:nix-community/impermanence"; + + home-manager = { + url = "github:nix-community/home-manager/release-23.05"; + inputs.nixpkgs.follows = "nixpkgs"; }; - inputs = { - nixpkgs.url = "nixpkgs/nixos-23.05"; - impermanence.url = "github:nix-community/impermanence"; - - home-manager = { - url = "github:nix-community/home-manager/release-23.05"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nixos-cn = { - url = "github:nixos-cn/flakes"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + nixos-cn = { + url = "github:nixos-cn/flakes"; + inputs.nixpkgs.follows = "nixpkgs"; }; + }; - outputs = {self, nixpkgs, home-manager, nixos-cn, impermanence, ...}: { - nixosConfigurations.gpd = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; + outputs = { self, nixpkgs, home-manager, nixos-cn, impermanence, ... }: { + nixosConfigurations.gpd = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; - specialArgs = { - pkgs = import nixpkgs { - system = system; - config.allowUnfree = true; - overlays = [ - (self: super: { - waybar = super.waybar.overrideAttrs (oldAttrs: { - # enable hyprland support - mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; - }); - }) - ]; - }; - - cn-pkgs = import nixos-cn { - system = system; - config.allowUnfree = true; - }; - }; - - modules = [ - ./configuration.nix - impermanence.nixosModules.impermanence - nixos-cn.nixosModules.nixos-cn-registries - nixos-cn.nixosModules.nixos-cn - - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users = import ./home; - } - ]; + specialArgs = { + pkgs = import nixpkgs { + system = system; + config.allowUnfree = true; + overlays = [ + (self: super: { + waybar = super.waybar.overrideAttrs (oldAttrs: { + # enable hyprland support + mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; + }); + }) + ]; }; + + cn-pkgs = import nixos-cn { + system = system; + config.allowUnfree = true; + }; + }; + + modules = [ + ./configuration.nix + impermanence.nixosModules.impermanence + nixos-cn.nixosModules.nixos-cn-registries + nixos-cn.nixosModules.nixos-cn + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users = import ./home; + } + ]; }; -} \ No newline at end of file + }; +} diff --git a/global/default.nix b/global/default.nix index 0943731..44cd65f 100644 --- a/global/default.nix +++ b/global/default.nix @@ -1,9 +1,9 @@ { - imports = [ - ./system-configuration.nix - ./software-configuration.nix - ./user-configuration.nix - ./font-configuration.nix - ./stateless-configuration.nix - ]; -} \ No newline at end of file + imports = [ + ./system-configuration.nix + ./software-configuration.nix + ./user-configuration.nix + ./font-configuration.nix + ./stateless-configuration.nix + ]; +} diff --git a/global/font-configuration.nix b/global/font-configuration.nix index bd77a4b..19b7455 100644 --- a/global/font-configuration.nix +++ b/global/font-configuration.nix @@ -1,39 +1,39 @@ -{pkgs, ...}: { - fonts= { - fontDir.enable = true; - - fonts = with pkgs;[ - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - liberation_ttf - fira-code - fira-code-symbols - source-han-sans - source-han-serif - source-han-mono - source-code-pro - font-awesome_5 - powerline-fonts - powerline-symbols - (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) - ]; +{ pkgs, ... }: { + fonts = { + fontDir.enable = true; - fontconfig.cache32Bit = true; + fonts = with pkgs;[ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + liberation_ttf + fira-code + fira-code-symbols + source-han-sans + source-han-serif + source-han-mono + source-code-pro + font-awesome_5 + powerline-fonts + powerline-symbols + (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) + ]; - fontconfig.defaultFonts = { - serif = [ - "Source Han Serif SC" - ]; + fontconfig.cache32Bit = true; - sansSerif = [ - "Source Han Sans SC" - ]; + fontconfig.defaultFonts = { + serif = [ + "Source Han Serif SC" + ]; - monospace = [ - "Fira Code" - "Source Han Mono SC" - ]; - }; + sansSerif = [ + "Source Han Sans SC" + ]; + + monospace = [ + "Fira Code" + "Source Han Mono SC" + ]; }; -} \ No newline at end of file + }; +} diff --git a/global/software-configuration.nix b/global/software-configuration.nix index 1f1faab..7511006 100644 --- a/global/software-configuration.nix +++ b/global/software-configuration.nix @@ -1,116 +1,116 @@ -{pkgs, ...}: { - xdg.portal = { - enable = true; - #wlr.enable = true; - xdgOpenUsePortal = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-hyprland - xdg-desktop-portal-gtk - ]; - }; - - # Enable automatic login for the user. - services = { - # flatpak dev.deedles.Trayscale - # sudo tailscale up --operator=$USER - # use https://hs.wetofu.me - tailscale.enable = true; - blueman.enable = true; - logrotate.checkConfig = false; - flatpak.enable = true; - - ntp = { - enable = true; - servers = [ - "ntp.ntsc.ac.cn" # China - ]; - }; - - greetd = { - enable = true; - settings = rec { - initial_session = { - user = "user"; - command = "${pkgs.greetd.greetd}/bin/agreety --cmd Hyprland"; - }; - default_session = initial_session; - }; - }; - - xserver = { - layout = "cn"; - xkbVariant = ""; - libinput = { - mouse = { - accelProfile = "flat"; - }; - }; - }; - - pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - }; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - hyprpaper - hyprland-protocols - hyprland-share-picker +{ pkgs, ... }: { + xdg.portal = { + enable = true; + #wlr.enable = true; + xdgOpenUsePortal = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-hyprland + xdg-desktop-portal-gtk ]; - - programs = { - hyprland = { - enable = true; - xwayland = { - enable = true; - hidpi = true; - }; - }; + }; - proxychains = { - enable = true; - quietMode = true; - proxies = { - default = { - type = "socks5"; - port = 1089; - host = "127.0.0.1"; - enable = true; - }; - }; - }; + # Enable automatic login for the user. + services = { + # flatpak dev.deedles.Trayscale + # sudo tailscale up --operator=$USER + # use https://hs.wetofu.me + tailscale.enable = true; + blueman.enable = true; + logrotate.checkConfig = false; + flatpak.enable = true; - git.enable = true; - zsh.enable = true; - light.enable = true; - dconf.enable = true; + ntp = { + enable = true; + servers = [ + "ntp.ntsc.ac.cn" # China + ]; }; - virtualisation = { - podman.enable = true; - oci-containers.backend = "podman"; - oci-containers.containers = { - wsproxy = { - login.username = "senseab"; - login.registry = "ghcr.io"; - login.passwordFile = "/var/lib/secrets/podman/ghcr.io"; # should create it manually. - image = "ghcr.io/senseab/wsproxy:master"; - autoStart = true; - - environment = { - CONFIG_NO_TLS_VERIFY = "true"; - CONFIG_ADDR = "wss://dev.wetofu.me/path"; - WSPROXY_MODE = "client"; - }; - - ports = [ - "127.0.0.1:1089:1089" - ]; - }; + greetd = { + enable = true; + settings = rec { + initial_session = { + user = "user"; + command = "${pkgs.greetd.greetd}/bin/agreety --cmd Hyprland"; }; + default_session = initial_session; + }; }; -} \ No newline at end of file + + xserver = { + layout = "cn"; + xkbVariant = ""; + libinput = { + mouse = { + accelProfile = "flat"; + }; + }; + }; + + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + hyprpaper + hyprland-protocols + hyprland-share-picker + ]; + + programs = { + hyprland = { + enable = true; + xwayland = { + enable = true; + hidpi = true; + }; + }; + + proxychains = { + enable = true; + quietMode = true; + proxies = { + default = { + type = "socks5"; + port = 1089; + host = "127.0.0.1"; + enable = true; + }; + }; + }; + + git.enable = true; + zsh.enable = true; + light.enable = true; + dconf.enable = true; + }; + + virtualisation = { + podman.enable = true; + oci-containers.backend = "podman"; + oci-containers.containers = { + wsproxy = { + login.username = "senseab"; + login.registry = "ghcr.io"; + login.passwordFile = "/var/lib/secrets/podman/ghcr.io"; # should create it manually. + image = "ghcr.io/senseab/wsproxy:master"; + autoStart = true; + + environment = { + CONFIG_NO_TLS_VERIFY = "true"; + CONFIG_ADDR = "wss://dev.wetofu.me/path"; + WSPROXY_MODE = "client"; + }; + + ports = [ + "127.0.0.1:1089:1089" + ]; + }; + }; + }; +} diff --git a/global/stateless-configuration.nix b/global/stateless-configuration.nix index aac97cc..5a06678 100644 --- a/global/stateless-configuration.nix +++ b/global/stateless-configuration.nix @@ -1,38 +1,38 @@ { - # /nix/persistent 是你实际保存文件的地方 - environment.persistence."/nix/persistent" = { - # 不让这些映射的 mount 出现在文件管理器的侧边栏中 - hideMounts = true; + # /nix/persistent 是你实际保存文件的地方 + environment.persistence."/nix/persistent" = { + # 不让这些映射的 mount 出现在文件管理器的侧边栏中 + hideMounts = true; - # 你要映射的文件夹 - directories = [ - "/etc/NetworkManager/system-connections" - "/root" - "/var" - ]; + # 你要映射的文件夹 + directories = [ + "/etc/NetworkManager/system-connections" + "/root" + "/var" + ]; - files = [ - "/etc/machine-id" - ]; + files = [ + "/etc/machine-id" + ]; + }; + + environment.variables.NIX_REMOTE = "daemon"; + + systemd.services.nix-daemon = { + environment = { + # 指定临时文件的位置 + TMPDIR = "/var/cache/nix"; }; - - environment.variables.NIX_REMOTE = "daemon"; - - systemd.services.nix-daemon = { - environment = { - # 指定临时文件的位置 - TMPDIR = "/var/cache/nix"; - }; - serviceConfig = { - # 在 Nix Daemon 启动时自动创建 /var/cache/nix - CacheDirectory = "nix"; - }; + serviceConfig = { + # 在 Nix Daemon 启动时自动创建 /var/cache/nix + CacheDirectory = "nix"; }; + }; - # Stateless rootfs - fileSystems."/" = { - device = "tmpfs"; - fsType = "tmpfs"; - options = [ "relatime" "mode=755" "nosuid" "nodev" ]; - }; -} \ No newline at end of file + # Stateless rootfs + fileSystems."/" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ "relatime" "mode=755" "nosuid" "nodev" ]; + }; +} diff --git a/global/system-configuration.nix b/global/system-configuration.nix index 7458d07..7411dd4 100644 --- a/global/system-configuration.nix +++ b/global/system-configuration.nix @@ -1,54 +1,54 @@ { - sound.enable = true; - networking.networkmanager.enable = true; - time.timeZone = "Asia/Shanghai"; - security.sudo.wheelNeedsPassword = false; + sound.enable = true; + networking.networkmanager.enable = true; + time.timeZone = "Asia/Shanghai"; + security.sudo.wheelNeedsPassword = false; - hardware = { - opengl.enable = true; + hardware = { + opengl.enable = true; + }; + + # Select internationalisation properties. + i18n = { + defaultLocale = "zh_CN.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "zh_CN.UTF-8"; + LC_IDENTIFICATION = "zh_CN.UTF-8"; + LC_MEASUREMENT = "zh_CN.UTF-8"; + LC_MONETARY = "zh_CN.UTF-8"; + LC_NAME = "zh_CN.UTF-8"; + LC_NUMERIC = "zh_CN.UTF-8"; + LC_PAPER = "zh_CN.UTF-8"; + LC_TELEPHONE = "zh_CN.UTF-8"; + LC_TIME = "zh_CN.UTF-8"; }; + }; - # Select internationalisation properties. - i18n = { - defaultLocale = "zh_CN.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "zh_CN.UTF-8"; - LC_IDENTIFICATION = "zh_CN.UTF-8"; - LC_MEASUREMENT = "zh_CN.UTF-8"; - LC_MONETARY = "zh_CN.UTF-8"; - LC_NAME = "zh_CN.UTF-8"; - LC_NUMERIC = "zh_CN.UTF-8"; - LC_PAPER = "zh_CN.UTF-8"; - LC_TELEPHONE = "zh_CN.UTF-8"; - LC_TIME = "zh_CN.UTF-8"; - }; - }; + nix.settings = { + auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + ]; - nix.settings = { - auto-optimise-store = true; - experimental-features = [ - "nix-command" - "flakes" - ]; + substituters = [ + "https://mirrors.ustc.edu.cn/nix-channels/store" # 中科大 + "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # 清华 + "https://mirrors.bfsu.edu.cn/nix-channels/store" # 北外 + "https://mirror.sjtu.edu.cn/nix-channels/store" # 交大 + "https://nixos-cn.cachix.org" + "https://cache.nixos.org/" + ]; - substituters = [ - "https://mirrors.ustc.edu.cn/nix-channels/store" # 中科大 - "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # 清华 - "https://mirrors.bfsu.edu.cn/nix-channels/store" # 北外 - "https://mirror.sjtu.edu.cn/nix-channels/store" # 交大 - "https://nixos-cn.cachix.org" - "https://cache.nixos.org/" - ]; + trusted-users = [ + "root" + "@wheel" + ]; + }; - trusted-users = [ - "root" - "@wheel" - ]; - }; - - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 1w"; - }; -} \ No newline at end of file + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; + }; +} diff --git a/global/user-configuration.nix b/global/user-configuration.nix index 1505f31..c4d7e86 100644 --- a/global/user-configuration.nix +++ b/global/user-configuration.nix @@ -1,20 +1,20 @@ -{pkgs, ...}: { - users= { - mutableUsers = false; - users = { - user = { - isNormalUser = true; - description = "Default user"; - extraGroups = [ - "networkmanager" - "wheel" - "input" - "video" - "kvm" - ]; - hashedPassword = ""; # Login directly - shell = pkgs.zsh; - }; - }; +{ pkgs, ... }: { + users = { + mutableUsers = false; + users = { + user = { + isNormalUser = true; + description = "Default user"; + extraGroups = [ + "networkmanager" + "wheel" + "input" + "video" + "kvm" + ]; + hashedPassword = ""; # Login directly + shell = pkgs.zsh; + }; }; -} \ No newline at end of file + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix index f987867..e3a9060 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -4,83 +4,83 @@ { config, lib, pkgs, modulesPath, ... }: { - imports =[ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - - boot = { - plymouth.enable = true; - # Use xanmod kernel - kernelPackages = pkgs.linuxPackages_xanmod_latest; - kernelParams = [ "quiet" ]; - kernelModules = [ "kvm-intel" ]; - consoleLogLevel = 0; - kernel.sysctl = { - # for ryujinx - "vm.max_map_count" = 524288; - }; + boot = { + plymouth.enable = true; + # Use xanmod kernel + kernelPackages = pkgs.linuxPackages_xanmod_latest; + kernelParams = [ "quiet" ]; + kernelModules = [ "kvm-intel" ]; + consoleLogLevel = 0; - initrd = { - #verbose = false; - availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usb_storage" - "usbhid" - "sd_mod" - ]; - }; - - loader = { - efi.canTouchEfiVariables = true; - - grub = { - configurationLimit = 10; - efiSupport = true; - device = "nodev"; - - mirroredBoots = [ - { - devices = [ "nodev" ]; - path = "/boot"; - } - ]; - }; - }; + kernel.sysctl = { + # for ryujinx + "vm.max_map_count" = 524288; }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/8095-BE1B"; - fsType = "vfat"; + initrd = { + #verbose = false; + availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usb_storage" + "usbhid" + "sd_mod" + ]; }; - fileSystems."/nix" = { - device = "/dev/disk/by-uuid/d2fac87e-ce48-174a-a544-36606fd39ee0"; - fsType = "ext4"; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-uuid/4125f3b3-7613-a04b-910c-87169a7a87b3"; - fsType = "ext4"; + loader = { + efi.canTouchEfiVariables = true; + + grub = { + configurationLimit = 10; + efiSupport = true; + device = "nodev"; + + mirroredBoots = [ + { + devices = [ "nodev" ]; + path = "/boot"; + } + ]; + }; }; + }; - swapDevices = [ - { device = "/dev/nvme0n1p2"; } - ]; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/8095-BE1B"; + fsType = "vfat"; + }; - # 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.eth0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/d2fac87e-ce48-174a-a544-36606fd39ee0"; + fsType = "ext4"; + }; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - hardware.bluetooth.enable = true; -} \ No newline at end of file + fileSystems."/home" = { + device = "/dev/disk/by-uuid/4125f3b3-7613-a04b-910c-87169a7a87b3"; + fsType = "ext4"; + }; + + swapDevices = [ + { device = "/dev/nvme0n1p2"; } + ]; + + # 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.eth0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.bluetooth.enable = true; +} diff --git a/home/default.nix b/home/default.nix index 68f54da..b1628dd 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,3 +1,3 @@ { - user = import ./user; -} \ No newline at end of file + user = import ./user; +} diff --git a/home/user/config/waybar.nix b/home/user/config/waybar.nix index b1e68f3..04c6a50 100644 --- a/home/user/config/waybar.nix +++ b/home/user/config/waybar.nix @@ -1,122 +1,122 @@ { - layer = "top"; - position = "top"; - height = 24; + layer = "top"; + position = "top"; + height = 24; - modules-left = [ - "hyprland/window" - ]; - modules-center = [ "wlr/workspaces" ]; - modules-right = [ - "backlight" - "wireplumber" - # "cpu" - # "memory" - "battery" - "network" - "tray" - "clock" - ]; + modules-left = [ + "hyprland/window" + ]; + modules-center = [ "wlr/workspaces" ]; + modules-right = [ + "backlight" + "wireplumber" + # "cpu" + # "memory" + "battery" + "network" + "tray" + "clock" + ]; - wireplumber = { - tooltip = false; - scroll-step = 5; - format = "{icon} {volume}%"; - format-muted = "{icon} --"; - on-click ="wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; # wpctl? - format-icons = { - default = ["" "" ""]; - }; + wireplumber = { + tooltip = false; + scroll-step = 5; + format = "{icon} {volume}%"; + format-muted = "{icon} --"; + on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; # wpctl? + format-icons = { + default = [ "" "" "" ]; }; + }; - "hyprland/window" = { - format = "{}"; - separate-outputs = true; - }; + "hyprland/window" = { + format = "{}"; + separate-outputs = true; + }; - "wlr/workspaces" = { - format = "{icon}"; - on-click = "activate"; - format-icons = { - "1" = ""; - "2" = ""; - "3" = ""; - "4" = ""; - "5" = ""; - urgent = ""; - active = ""; - default = ""; - }; - sort-by-number = true; + "wlr/workspaces" = { + format = "{icon}"; + on-click = "activate"; + format-icons = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; + urgent = ""; + active = ""; + default = ""; }; + sort-by-number = true; + }; - network = { - tooltip = false; - format-wifi = " {essid}"; - format-ethernet = ""; - }; + network = { + tooltip = false; + format-wifi = " {essid}"; + format-ethernet = ""; + }; - backlight = { - tooltip = false; - format = " {}%"; - interval = 1; - on-scroll-up = "light -A 5"; - on-scroll-down = "light -U 5"; - }; - - battery = { - states = { - good = 95; - warning = 30; - critical = 20; - }; - format = "{icon}\t{capacity}%"; - format-charging = " {capacity}%"; - format-plugged = " {capacity}%"; - format-alt = "{time} {icon}"; - format-icons = ["" "" "" "" ""]; - }; + backlight = { + tooltip = false; + format = " {}%"; + interval = 1; + on-scroll-up = "light -A 5"; + on-scroll-down = "light -U 5"; + }; - tray = { - icon-size = 24; - spacing = 10; + battery = { + states = { + good = 95; + warning = 30; + critical = 20; }; + format = "{icon}\t{capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-alt = "{time} {icon}"; + format-icons = [ "" "" "" "" "" ]; + }; - clock = { - format = " {:%H:%M}"; - tooltip-format = "{calendar}"; - calendar = { - mode = "month"; - weeks-pos = "right"; - format = { - months = "{}"; - days = "{}"; - weeks = "W{}"; - weekdays = "{}"; - today = "{}"; - }; - }; - }; + tray = { + icon-size = 24; + spacing = 10; + }; - cpu = { - interval = 15; - format = " {}%"; - max-length = 10; + clock = { + format = " {:%H:%M}"; + tooltip-format = "{calendar}"; + calendar = { + mode = "month"; + weeks-pos = "right"; + format = { + months = "{}"; + days = "{}"; + weeks = "W{}"; + weekdays = "{}"; + today = "{}"; + }; }; + }; - memory = { - interval = 30; - format = " {}%"; - max-length = 10; - }; + cpu = { + interval = 15; + format = " {}%"; + max-length = 10; + }; - "custom/launcher" = { - format = " "; - on-click = "nwggrid"; - }; + memory = { + interval = 30; + format = " {}%"; + max-length = 10; + }; - "custom/power" = { - format = "󰐥 "; - on-click = "nwgbar"; - }; + "custom/launcher" = { + format = " "; + on-click = "nwggrid"; + }; + + "custom/power" = { + format = "󰐥 "; + on-click = "nwgbar"; + }; } diff --git a/home/user/default.nix b/home/user/default.nix index e6d941d..f7ea914 100644 --- a/home/user/default.nix +++ b/home/user/default.nix @@ -1,27 +1,27 @@ -{pkgs, ...}: { - imports = [ - ./home.nix - ./programs.nix - ./services.nix - ./xdg.nix - ]; +{ pkgs, ... }: { + imports = [ + ./home.nix + ./programs.nix + ./services.nix + ./xdg.nix + ]; - systemd.user.services = { - # TODO: Podman + systemd.user.services = { + # TODO: Podman + }; + + i18n.inputMethod.enabled = "fcitx5"; + i18n.inputMethod.fcitx5.addons = with pkgs; [ + fcitx5-configtool + fcitx5-gtk + fcitx5-chinese-addons + ]; + + gtk = { + enable = true; + iconTheme = { + package = pkgs.iconpack-obsidian; # icon theme + name = "Obsidian"; }; - - i18n.inputMethod.enabled = "fcitx5"; - i18n.inputMethod.fcitx5.addons = with pkgs; [ - fcitx5-configtool - fcitx5-gtk - fcitx5-chinese-addons - ]; - - gtk = { - enable = true; - iconTheme = { - package = pkgs.iconpack-obsidian; # icon theme - name = "Obsidian"; - }; - }; -} \ No newline at end of file + }; +} diff --git a/home/user/home.nix b/home/user/home.nix index 2a18b8f..adbcfea 100644 --- a/home/user/home.nix +++ b/home/user/home.nix @@ -1,90 +1,90 @@ -{pkgs, ...}: { - home = { - stateVersion = "23.05"; # Static - username = "user"; - homeDirectory = "/home/user"; +{ pkgs, ... }: { + home = { + stateVersion = "23.05"; # Static + username = "user"; + homeDirectory = "/home/user"; - packages = with pkgs; [ - btop - bat - thefuck - ranger - icdiff - #rofi - #rofi-rbw - #nwg-launchers - nwg-bar - nwg-drawer - gnumake42 - wget - axel - grim - slurp - unzip - p7zip - #appimage-run - cmatrix - gnome.gnome-software - ]; + packages = with pkgs; [ + btop + bat + thefuck + ranger + icdiff + #rofi + #rofi-rbw + #nwg-launchers + nwg-bar + nwg-drawer + gnumake42 + wget + axel + grim + slurp + unzip + p7zip + #appimage-run + cmatrix + gnome.gnome-software + ]; - sessionPath = [ - ".local/bin" - #"Applications" - ]; + sessionPath = [ + ".local/bin" + #"Applications" + ]; - sessionVariables = { - TERM = "kitty"; - #GTK_IM_MODULE = "fcitx"; - #QT_IM_MODULE = "fcitx"; - #SDL_VIDEODRIVER = "wayland"; - #SDL_IM_MODULE = "fcitx"; - }; - - shellAliases = { - cao = "fuck"; - top = "btop"; - ls = "ls --color=auto"; - cat = "bat -p --paging=never -u"; - diff = "icdiff"; - }; - - file = { - # hyprland - ".config/hypr/hyprland.conf".source = ./files/hyprland.conf; - ".config/hypr/hyprpaper.conf".source = ./files/hyprpaper.conf; - - # ranger - ".config/ranger/rc.conf".source = ./files/ranger-rc.conf; - - # nwg - #".config/nwg-launchers".source = ./files/nwg-launchers; - ".config/nwg-drawer".source = ./files/nwg-drawer; - ".config/nwg-bar".source = ./files/nwg-bar; - - # wallpapers - ".local/share/wallpapers".source = ./wallpapers; - - # Use flatseal to change permissions. - #".local/share/fonts".source = /run/current-system/sw/share/X11/fonts; - - # Fix flatpak fonts - ".local/share/flatpak/overrides/global".text = '' - [Context] - sockets=wayland - filesystems=/run/current-system/sw/share/X11/fonts:ro;/nix/store:ro;~/.icons; - ''; - - # Electron global settings - ".config/electron-flags.conf".text = '' - --enable-features=WaylandWindowDecorations - --ozone-platform-hint=auto - --enable-webrtc-pipewire-capturer - ''; - - ".config/electron13-flags.conf".text = '' - --enable-features=UseOzonePlatform - --ozone-platform=wayland - ''; - }; + sessionVariables = { + TERM = "kitty"; + #GTK_IM_MODULE = "fcitx"; + #QT_IM_MODULE = "fcitx"; + #SDL_VIDEODRIVER = "wayland"; + #SDL_IM_MODULE = "fcitx"; }; -} \ No newline at end of file + + shellAliases = { + cao = "fuck"; + top = "btop"; + ls = "ls --color=auto"; + cat = "bat -p --paging=never -u"; + diff = "icdiff"; + }; + + file = { + # hyprland + ".config/hypr/hyprland.conf".source = ./files/hyprland.conf; + ".config/hypr/hyprpaper.conf".source = ./files/hyprpaper.conf; + + # ranger + ".config/ranger/rc.conf".source = ./files/ranger-rc.conf; + + # nwg + #".config/nwg-launchers".source = ./files/nwg-launchers; + ".config/nwg-drawer".source = ./files/nwg-drawer; + ".config/nwg-bar".source = ./files/nwg-bar; + + # wallpapers + ".local/share/wallpapers".source = ./wallpapers; + + # Use flatseal to change permissions. + #".local/share/fonts".source = /run/current-system/sw/share/X11/fonts; + + # Fix flatpak fonts + ".local/share/flatpak/overrides/global".text = '' + [Context] + sockets=wayland + filesystems=/run/current-system/sw/share/X11/fonts:ro;/nix/store:ro;~/.icons; + ''; + + # Electron global settings + ".config/electron-flags.conf".text = '' + --enable-features=WaylandWindowDecorations + --ozone-platform-hint=auto + --enable-webrtc-pipewire-capturer + ''; + + ".config/electron13-flags.conf".text = '' + --enable-features=UseOzonePlatform + --ozone-platform=wayland + ''; + }; + }; +} diff --git a/home/user/programs.nix b/home/user/programs.nix index 3c2b42e..f495448 100644 --- a/home/user/programs.nix +++ b/home/user/programs.nix @@ -1,82 +1,78 @@ -{pkgs, ...}: { - programs = { - home-manager.enable = true; +{ pkgs, ... }: { + programs = { + home-manager.enable = true; - git = { - enable = true; - userName = "GPD Game User"; - userEmail = "user@gpd.local"; - }; - - vim = { - enable = true; - defaultEditor = true; - }; - - zsh = { - enable = true; - enableAutosuggestions = true; - enableSyntaxHighlighting = true; - enableVteIntegration = true; - - oh-my-zsh = { - enable = true; - plugins = [ "sudo" "git" "golang" "thefuck" "kubectl" "emoji" "pip" "npm" "yarn" "vscode" ]; - theme = "agnoster"; - }; - }; - - waybar = { - enable = true; - systemd.enable = true; - systemd.target = "default.target"; - # see https://github.com/theCode-Breaker/riverwm/blob/main/waybar/river/config-river - # https://blog.cascade.moe/posts/hyprland-configure/ - settings = { - mainBar = import ./config/waybar.nix; - }; - - style = import ./config/waybar-style.nix; - }; - - kitty = { - enable = true; - font = { - name = "Powerline"; - size = 12; - }; - - keybindings = { - "ctrl+c" = "copy_or_interrupt"; - "ctrl+v" = "paste_from_clipboard"; - }; - - shellIntegration = { - enableZshIntegration = true; - enableBashIntegration = true; - }; - - settings = { - background_opacity = "0.8"; - }; - }; - - rbw = { - enable = true; - settings = { - base_url = "https://pass.sense-t.eu.org"; - email = "sense-t@sense-t.eu.org"; - lock_timeout = 300; - pinentry = "gnome3"; - }; - }; - - wlogout = { - enable = false; - }; - - clipman = { - enable = true; - }; + git = { + enable = true; + userName = "GPD Game User"; + userEmail = "user@gpd.local"; }; -} \ No newline at end of file + + vim = { + enable = true; + defaultEditor = true; + }; + + zsh = { + enable = true; + enableAutosuggestions = true; + enableSyntaxHighlighting = true; + enableVteIntegration = true; + + oh-my-zsh = { + enable = true; + plugins = [ "sudo" "git" "golang" "thefuck" "kubectl" "emoji" "pip" "npm" "yarn" "vscode" ]; + theme = "agnoster"; + }; + }; + + waybar = { + enable = true; + systemd.enable = true; + systemd.target = "default.target"; + # see https://github.com/theCode-Breaker/riverwm/blob/main/waybar/river/config-river + # https://blog.cascade.moe/posts/hyprland-configure/ + settings = { + mainBar = import ./config/waybar.nix; + }; + + style = import ./config/waybar-style.nix; + }; + + kitty = { + enable = true; + font = { + name = "Powerline"; + size = 12; + }; + + keybindings = { + "ctrl+c" = "copy_or_interrupt"; + "ctrl+v" = "paste_from_clipboard"; + }; + + shellIntegration = { + enableZshIntegration = true; + enableBashIntegration = true; + }; + + settings = { + background_opacity = "0.8"; + }; + }; + + rbw = { + enable = true; + settings = { + base_url = "https://pass.sense-t.eu.org"; + email = "sense-t@sense-t.eu.org"; + lock_timeout = 300; + pinentry = "gnome3"; + }; + }; + + wlogout = { + enable = false; + }; + }; +} diff --git a/home/user/services.nix b/home/user/services.nix index 6275701..b0f4300 100644 --- a/home/user/services.nix +++ b/home/user/services.nix @@ -1,43 +1,45 @@ { - services = { - dunst = { - enable = true; - settings = { - global = { - width = 300; - height = 300; - offset = "30x50"; - origin = "top-right"; - notification_limit = 10; - progress_bar = true; - transparency = 20; - corner_radius = 8; - }; - - urgency_low = { - frame_color = "#3B7C87"; - foreground = "#3B7C87"; - background = "#191311"; - #background = "#2B313C" - timeout = 4; - }; - - urgency_normal = { - frame_color = "#5B8234"; - foreground = "#5B8234"; - background = "#191311"; - #background = "#2B313C" - timeout = 6; - }; - - urgency_critical = { - frame_color = "#B7472A"; - foreground = "#B7472A"; - background = "#191311"; - #background = "#2B313C" - timeout = 8; - }; - }; + services = { + clipman.enable = true; + + dunst = { + enable = true; + settings = { + global = { + width = 300; + height = 300; + offset = "30x50"; + origin = "top-right"; + notification_limit = 10; + progress_bar = true; + transparency = 20; + corner_radius = 8; }; + + urgency_low = { + frame_color = "#3B7C87"; + foreground = "#3B7C87"; + background = "#191311"; + #background = "#2B313C" + timeout = 4; + }; + + urgency_normal = { + frame_color = "#5B8234"; + foreground = "#5B8234"; + background = "#191311"; + #background = "#2B313C" + timeout = 6; + }; + + urgency_critical = { + frame_color = "#B7472A"; + foreground = "#B7472A"; + background = "#191311"; + #background = "#2B313C" + timeout = 8; + }; + }; }; -} \ No newline at end of file + }; +} diff --git a/home/user/xdg.nix b/home/user/xdg.nix index bb078b2..3cbf315 100644 --- a/home/user/xdg.nix +++ b/home/user/xdg.nix @@ -1,31 +1,32 @@ let - defaultBrowser = "io.gitlab.librewolf-community.desktop"; - defaultFileManager = "ranger.desktop"; - defaultTerminal = "kitty.desktop"; -in { - xdg = { - enable = true; - mimeApps = { - enable = true; - defaultApplications = { - # Default web browser. - "text/html" = defaultBrowser; - "x-scheme-handler/http" = defaultBrowser; - "x-scheme-handler/https" = defaultBrowser; - "x-scheme-handler/about" = defaultBrowser; - "x-scheme-handler/unknown" = defaultBrowser; + defaultBrowser = "io.gitlab.librewolf-community.desktop"; + defaultFileManager = "ranger.desktop"; + defaultTerminal = "kitty.desktop"; +in +{ + xdg = { + enable = true; + mimeApps = { + enable = true; + defaultApplications = { + # Default web browser. + "text/html" = defaultBrowser; + "x-scheme-handler/http" = defaultBrowser; + "x-scheme-handler/https" = defaultBrowser; + "x-scheme-handler/about" = defaultBrowser; + "x-scheme-handler/unknown" = defaultBrowser; - # Default file manager. - "inode/directory" = defaultFileManager; + # Default file manager. + "inode/directory" = defaultFileManager; - # Image - "image/*" = defaultTerminal; + # Image + "image/*" = defaultTerminal; - # Default terminal - "application/x-sh" = defaultTerminal; - "application/x-shellscript" = defaultTerminal; - "x-scheme-handler/ssh" = defaultTerminal; - }; - }; + # Default terminal + "application/x-sh" = defaultTerminal; + "application/x-shellscript" = defaultTerminal; + "x-scheme-handler/ssh" = defaultTerminal; + }; }; -} \ No newline at end of file + }; +}