初步配置,等 GPD 到货后根据实际情况调整

This commit is contained in:
Sense T 2023-06-21 13:29:28 +08:00
parent 5c2b9a3cfa
commit d1f1cb7715
13 changed files with 316 additions and 1 deletions

View File

@ -1,3 +1,14 @@
# gpd-configurations
GPD Win Max 配置
## 构建
```bash
nixos-rebuild switch --flake 'git+https://git.sense-t.eu.org/NixOS/gpd-configurations#gpd'
```
## Todo
- [] 无状态 `/` 分区
- [] wsproxy on podman

20
configuration.nix Normal file
View File

@ -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;
}

62
flake.nix Normal file
View File

@ -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;
}
];
};
};
}

8
global/default.nix Normal file
View File

@ -0,0 +1,8 @@
{
imports = [
./system-configuration.nix
./software-configuration.nix
./user-configuration.nix
./font-configuration.nix
];
}

View File

@ -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"
];
};
};
}

View File

@ -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;
};
};
};
}

View File

@ -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";
};
};
}

View File

@ -0,0 +1,16 @@
{
users= {
mutableUsers = false;
users = {
user = {
isNormalUser = true;
description = "Default user";
extraGroups = [
"networkmanager"
"wheel"
"input"
];
};
};
};
}

3
home/default.nix Normal file
View File

@ -0,0 +1,3 @@
{
user = import ./user;
}

11
home/user/default.nix Normal file
View File

@ -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
];
}

27
home/user/home.nix Normal file
View File

@ -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
};
}

39
home/user/programs.nix Normal file
View File

@ -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;
};
};
}

4
home/user/services.nix Normal file
View File

@ -0,0 +1,4 @@
# Will used for podman
{
}