diff --git a/README.md b/README.md index a677c2f..6956fa5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ # gpd-configurations -GPD Win Max 配置 \ No newline at end of file +GPD Win Max 配置 + +## 构建 + +```bash +nixos-rebuild switch --flake 'git+https://git.sense-t.eu.org/NixOS/gpd-configurations#gpd' +``` + +## Todo + +- [] 无状态 `/` 分区 +- [] wsproxy on podman diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..6b2d489 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,20 @@ +# NixOS configurations file. +{config, pkgs, lib,...}: { + system.stateVersion = "23.05"; + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + + # User custom configurations. + ./global + ]; + + + boot.plymouth.enable = true; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use xanmod kernel + boot.kernelPackages = pkgs.linuxKernel.kernels.linux_xanmod; +} \ No newline at end of file diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..97e3910 --- /dev/null +++ b/flake.nix @@ -0,0 +1,62 @@ +{ + description = "NixOS configuration for GPD Win Max"; + + nixConfig = { + 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://cache.nixos.org/" + ]; + + trusted-users = [ + "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.nixos-cn = { + url = "github:nixos-cn/flakes"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = {self, nixpkgs, home-manager, nixos-cn,...}: { + nixosConfigurations.gpd = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + + specialArgs = { + pkgs = import nixpkgs { + system = system; + config.allowUnfree = true; + }; + + cn-pkgs = import nixos-cn { + system = system; + config.allowUnfree = true; + } + }; + + modules = [ + ./configuration.nix + impermanence.nixosModules.impermanence + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users = import ./per-user; + } + ]; + }; + }; +} \ No newline at end of file diff --git a/global/default.nix b/global/default.nix new file mode 100644 index 0000000..f40bc5c --- /dev/null +++ b/global/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./system-configuration.nix + ./software-configuration.nix + ./user-configuration.nix + ./font-configuration.nix + ]; +} \ No newline at end of file diff --git a/global/font-configuration.nix b/global/font-configuration.nix new file mode 100644 index 0000000..6b3d8b9 --- /dev/null +++ b/global/font-configuration.nix @@ -0,0 +1,36 @@ +{pkgs, ...}: { + fonts= { + 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-code-pro + font-awesome_5 + powerline-fonts + powerline-symbols + (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) + ]; + + fontconfig.cache32Bit = true; + + fontconfig.defaultFonts = { + serif = [ + "Source Han Serif" + ]; + + sansSerif = [ + "Source Han Sans" + ]; + + monospace = [ + "Fira Code" + "Source Han Serif SC" + ]; + }; + }; +} \ No newline at end of file diff --git a/global/software-configuration.nix b/global/software-configuration.nix new file mode 100644 index 0000000..d388a41 --- /dev/null +++ b/global/software-configuration.nix @@ -0,0 +1,51 @@ +{pkgs, ...}: { + xdg.portal = { + enable = true; + wlr.enable = true; + } + + # Enable automatic login for the user. + services = { + flatpak.enable = true; + 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"; + }; + }; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + kitty + rofi + hyprland-protocols + hyprland-share-picker + xdg-desktop-portal-hyprland + ]; + + programs = { + hyprland = { + enable = true; + xwayland = { + enable = true; + hidpi = true; + }; + }; + }; +} \ No newline at end of file diff --git a/global/system-configuration.nix b/global/system-configuration.nix new file mode 100644 index 0000000..89a2e3f --- /dev/null +++ b/global/system-configuration.nix @@ -0,0 +1,27 @@ +{ + sound.enable = true; + networking.networkmanager.enable = true; + time.timeZone = "Asia/Shanghai"; + security.sudo.wheelNeedsPassword = false; + + hardware = { + pulseaudio.enable = true; + 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"; + }; + }; +} \ No newline at end of file diff --git a/global/user-configuration.nix b/global/user-configuration.nix new file mode 100644 index 0000000..1e70a7b --- /dev/null +++ b/global/user-configuration.nix @@ -0,0 +1,16 @@ +{ + users= { + mutableUsers = false; + users = { + user = { + isNormalUser = true; + description = "Default user"; + extraGroups = [ + "networkmanager" + "wheel" + "input" + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..68f54da --- /dev/null +++ b/home/default.nix @@ -0,0 +1,3 @@ +{ + user = import ./user; +} \ No newline at end of file diff --git a/home/user/default.nix b/home/user/default.nix new file mode 100644 index 0000000..ea2f5d3 --- /dev/null +++ b/home/user/default.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + home = import ./home.nix; + programs = import ./programs.nix; + systemd.user.services = import ./sevices.nix; + + i18n.inputMethod.enabled = "fcitx5"; + i18n.inputMethod.fcitx5.addons = with pkgs; [ + fcitx5-configtool + fcitx5-gtk + ]; +} \ No newline at end of file diff --git a/home/user/home.nix b/home/user/home.nix new file mode 100644 index 0000000..819aeb3 --- /dev/null +++ b/home/user/home.nix @@ -0,0 +1,27 @@ +{pkgs, ...}: { + stateVersion = "23.05"; # Static + username = "GPD User"; + homeDirectory = "/home/user"; + + packages = with pkgs; [ + btop + bat + thefuck + ranger + icdiff + podman + jdk17 + ]; + + shellAliases = { + cao = "fuck"; + top = "btop"; + ls = "ls --color=auto"; + cat = "bat -p --paging=never -u"; + diff="icdiff"; + }; + + file = { + # TODO: hyprland + }; +} \ No newline at end of file diff --git a/home/user/programs.nix b/home/user/programs.nix new file mode 100644 index 0000000..a84cb11 --- /dev/null +++ b/home/user/programs.nix @@ -0,0 +1,39 @@ +{pkgs, ...}: { + home-manager.enable = true; + + vim = { + enable = true; + defaultEditor = true; + }; + + zsh = { + enable = true; + enableSyntaxHighlighting = 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; + settings = { + + }; + + style = '' + ''; + }; + + kitty = { + enable = true; + font = pkgs. + + shellIntegration = { + enableZshIntegration = true; + }; + }; +} \ No newline at end of file diff --git a/home/user/services.nix b/home/user/services.nix new file mode 100644 index 0000000..5daf766 --- /dev/null +++ b/home/user/services.nix @@ -0,0 +1,4 @@ +# Will used for podman +{ + +} \ No newline at end of file