mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 10:18:37 +02:00
feat: update TODO, fix some problems
This commit is contained in:
@@ -5,6 +5,10 @@ This repository is home to the nix code that builds my systems.
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
- fix wayland related problems
|
||||||
|
- fcitx5 input method - currently not work in vscode, and failed to add flypy input method
|
||||||
|
- status bar and other hyprland scripts
|
||||||
|
- some of them do not work
|
||||||
- [sops-nix](https://github.com/Mic92/sops-nix): secret management
|
- [sops-nix](https://github.com/Mic92/sops-nix): secret management
|
||||||
- [devShell](https://github.com/numtide/devshell): manage development environments
|
- [devShell](https://github.com/numtide/devshell): manage development environments
|
||||||
|
|
||||||
|
|||||||
17
flake.lock
generated
17
flake.lock
generated
@@ -222,6 +222,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1683207485,
|
||||||
|
"narHash": "sha256-gs+PHt/y/XQB7S8+YyBLAM8LjgYpPZUVFQBwpFSmJro=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "cc45a3f8c98e1c33ca996e3504adefbf660a72d1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-22.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-wayland": {
|
"nixpkgs-wayland": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
@@ -297,6 +313,7 @@
|
|||||||
"hyprland": "hyprland",
|
"hyprland": "hyprland",
|
||||||
"nixos-cn": "nixos-cn",
|
"nixos-cn": "nixos-cn",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
"nixpkgs-wayland": "nixpkgs-wayland"
|
"nixpkgs-wayland": "nixpkgs-wayland"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
24
flake.nix
24
flake.nix
@@ -34,7 +34,9 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
# flake inputs 有很多种引用方式,应用最广泛的是 github 的引用方式
|
# flake inputs 有很多种引用方式,应用最广泛的是 github 的引用方式
|
||||||
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # 使用 nixos-unstable 分支
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # 使用 nixos-unstable 分支 for nix flakes
|
||||||
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11"; # unstable branch may be broken sometimes, use stable branch when necessary
|
||||||
|
|
||||||
home-manager.url = "github:nix-community/home-manager";
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
# follows 是 inputs 中的继承语法
|
# follows 是 inputs 中的继承语法
|
||||||
# 这里使 home-manager 的 nixpkgs 这个 inputs 与当前 flake 的 inputs.nixpkgs 保持一致,避免依赖的 nixpkgs 版本不一致导致问题
|
# 这里使 home-manager 的 nixpkgs 这个 inputs 与当前 flake 的 inputs.nixpkgs 保持一致,避免依赖的 nixpkgs 版本不一致导致问题
|
||||||
@@ -43,7 +45,7 @@
|
|||||||
# modern window compositor
|
# modern window compositor
|
||||||
hyprland.url = "github:hyprwm/Hyprland";
|
hyprland.url = "github:hyprwm/Hyprland";
|
||||||
# community wayland nixpkgs
|
# community wayland nixpkgs
|
||||||
nixpkgs-wayland = { url = "github:nix-community/nixpkgs-wayland"; };
|
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
||||||
|
|
||||||
# nixos-cn 提供了一些国内常用的程序包,如 qq wechat dingtalk 等
|
# nixos-cn 提供了一些国内常用的程序包,如 qq wechat dingtalk 等
|
||||||
nixos-cn = {
|
nixos-cn = {
|
||||||
@@ -59,6 +61,7 @@
|
|||||||
outputs = inputs@{
|
outputs = inputs@{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
nixpkgs-stable,
|
||||||
home-manager,
|
home-manager,
|
||||||
nixos-cn,
|
nixos-cn,
|
||||||
...
|
...
|
||||||
@@ -84,7 +87,10 @@
|
|||||||
#
|
#
|
||||||
# nix flake 的 modules 系统可将配置模块化,提升配置的可维护性
|
# nix flake 的 modules 系统可将配置模块化,提升配置的可维护性
|
||||||
# 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs
|
# 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs
|
||||||
specialArgs = {inherit inputs;};
|
specialArgs = {
|
||||||
|
inherit nixos-cn;
|
||||||
|
inherit nixpkgs-stable;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/nixos-test
|
./hosts/nixos-test
|
||||||
|
|
||||||
@@ -114,7 +120,10 @@
|
|||||||
msi-rtx4090 = nixpkgs.lib.nixosSystem {
|
msi-rtx4090 = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
specialArgs = {inherit inputs;};
|
specialArgs = {
|
||||||
|
inherit nixos-cn;
|
||||||
|
inherit nixpkgs-stable;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/msi-rtx4090
|
./hosts/msi-rtx4090
|
||||||
|
|
||||||
@@ -129,13 +138,6 @@
|
|||||||
home-manager.extraSpecialArgs = inputs;
|
home-manager.extraSpecialArgs = inputs;
|
||||||
home-manager.users.ryan = import ./home;
|
home-manager.users.ryan = import ./home;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 将 nixos-cn flake 提供的 registry 添加到全局 registry 列表中
|
|
||||||
# 可在`nixos-rebuild switch`之后通过`nix registry list`查看
|
|
||||||
nixos-cn.nixosModules.nixos-cn-registries
|
|
||||||
|
|
||||||
# 引入nixos-cn flake提供的NixOS模块
|
|
||||||
nixos-cn.nixosModules.nixos-cn
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
4
home/fcitx5/README.md
Normal file
4
home/fcitx5/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Fcitx5-Rime + Flypy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -16,9 +16,12 @@
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
with pkgs; [
|
with pkgs; [
|
||||||
|
# for flypy chinese input method
|
||||||
fcitx5-rime
|
fcitx5-rime
|
||||||
fcitx5-configtool
|
fcitx5-configtool
|
||||||
fcitx5-chinese-addons
|
fcitx5-chinese-addons
|
||||||
|
fcitx5-mozc # japanese input method
|
||||||
|
fcitx5-gtk # gtk im module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,10 +47,9 @@
|
|||||||
ncmpcpp # a mpd client with a UI
|
ncmpcpp # a mpd client with a UI
|
||||||
];
|
];
|
||||||
|
|
||||||
# if use vscode in wayland, uncomment those line
|
|
||||||
systemd.user.sessionVariables = {
|
systemd.user.sessionVariables = {
|
||||||
"NIXOS_OZONE_WL" = "1"; # for vscode
|
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
|
||||||
"MOZ_ENABLE_WAYLAND" = "1";
|
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
|
||||||
|
|
||||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
nixpkgs-stable,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
home.packages = with pkgs; [
|
home.packages =
|
||||||
# use wayland version of firefox
|
let
|
||||||
firefox-wayland
|
pkgs-stable = import nixpkgs-stable {
|
||||||
];
|
system = pkgs.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
with pkgs-stable; [
|
||||||
|
firefox-wayland
|
||||||
|
|
||||||
programs =
|
# chrome wayland support was broken on nixos-unstable branch, so fallback to stable branch for now
|
||||||
let commandLineArgs = [ "--enable-wayland-ime" "--ozone-platform=wayland" ];
|
# https://github.com/swaywm/sway/issues/7562
|
||||||
in {
|
google-chrome
|
||||||
chromium = {
|
];
|
||||||
enable = true;
|
|
||||||
inherit commandLineArgs;
|
# programs = {
|
||||||
};
|
# };
|
||||||
google-chrome = {
|
|
||||||
enable = true;
|
|
||||||
inherit commandLineArgs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
ripgrep
|
ripgrep
|
||||||
yq-go # https://github.com/mikefarah/yq
|
yq-go # https://github.com/mikefarah/yq
|
||||||
htop
|
htop
|
||||||
nvtop
|
|
||||||
|
|
||||||
## networking tools
|
## networking tools
|
||||||
wireshark
|
wireshark
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
./common.nix
|
./common.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
./media.nix
|
./media.nix
|
||||||
|
./nixos-cn.nix
|
||||||
./vscode.nix
|
./vscode.nix
|
||||||
./xdg.nix
|
./xdg.nix
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -5,24 +5,19 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
# 将 nixos-cn flake 提供的 registry 添加到全局 registry 列表中
|
||||||
|
# 可在`nixos-rebuild switch`之后通过`nix registry list`查看
|
||||||
|
nixos-cn.nixosModules.nixos-cn-registries
|
||||||
|
|
||||||
home.packages = with nixos-cn; [
|
# 引入nixos-cn flake提供的NixOS模块
|
||||||
qq
|
nixos-cn.nixosModules.nixos-cn
|
||||||
wechat-uos
|
|
||||||
netease-cloud-music
|
|
||||||
];
|
];
|
||||||
|
|
||||||
programs = {
|
# # 使用 nixos-cn flake 提供的包
|
||||||
mpv = {
|
home.packages = with nixos-cn.legacyPackages.${pkgs.system}; [
|
||||||
enable = true;
|
# qq
|
||||||
defaultProfiles = ["gpu-hq"];
|
# wechat-uos # TODO failed to install
|
||||||
scripts = [pkgs.mpvScripts.mpris];
|
netease-cloud-music # TODO chinese font missing
|
||||||
};
|
];
|
||||||
|
|
||||||
obs-studio.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
playerctld.enable = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"video/*" = ["mpv.dekstop"];
|
"video/*" = ["mpv.dekstop"];
|
||||||
"image/*" = ["imv.desktop"];
|
"image/*" = ["imv.desktop"];
|
||||||
"application/json" = browser;
|
"application/json" = browser;
|
||||||
"application/pdf" = ["org.pwmt.zathura.desktop.desktop"];
|
"application/pdf" = ["org.pwmt.zathura.desktop.desktop"]; # TODO: pdf viewer
|
||||||
"x-scheme-handler/discord" = ["discordcanary.desktop"];
|
"x-scheme-handler/discord" = ["discord.desktop"];
|
||||||
"x-scheme-handler/spotify" = ["spotify.desktop"];
|
"x-scheme-handler/spotify" = ["spotify.desktop"];
|
||||||
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
||||||
};
|
};
|
||||||
@@ -43,6 +43,5 @@ in {
|
|||||||
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
|
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
[
|
[
|
||||||
../../modules/system.nix
|
../../modules/system.nix
|
||||||
../../modules/hyprland.nix
|
../../modules/hyprland.nix
|
||||||
../../modules/nixpkgs-wayland.nix
|
|
||||||
|
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
@@ -51,14 +50,22 @@
|
|||||||
|
|
||||||
|
|
||||||
# for Nvidia GPU
|
# for Nvidia GPU
|
||||||
services.xserver.videoDrivers = ["nvidia"];
|
|
||||||
hardware.opengl.enable = true;
|
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware.opengl.driSupport32Bit = true;
|
|
||||||
virtualisation.docker = {
|
virtualisation.docker = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableNvidia = true;
|
enableNvidia = true;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
[
|
[
|
||||||
../../modules/system.nix
|
../../modules/system.nix
|
||||||
../../modules/hyprland.nix
|
../../modules/hyprland.nix
|
||||||
../../modules/nixpkgs-wayland.nix
|
|
||||||
|
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|||||||
@@ -15,9 +15,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
displayManager = {
|
displayManager = {
|
||||||
defaultSession = "hyprland";
|
defaultSession = "hyprland";
|
||||||
lightdm.enable = false;
|
lightdm.enable = false;
|
||||||
gdm.enable = true;
|
gdm = {
|
||||||
|
enable = true;
|
||||||
|
wayland = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,4 +45,18 @@
|
|||||||
services.tumbler.enable = true; # Thumbnail support for images
|
services.tumbler.enable = true; # Thumbnail support for images
|
||||||
|
|
||||||
|
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
wlr.enable = true;
|
||||||
|
xdgOpenUsePortal = true;
|
||||||
|
extraPortals = with pkgs; [
|
||||||
|
xdg-desktop-portal-wlr # for wlroots based compositors
|
||||||
|
# xdg-desktop-portal-kde # for kde
|
||||||
|
# xdg-desktop-portal-gtk # for gtk
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# for power management
|
||||||
|
services.upower.enable = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
displayManager = {
|
displayManager = {
|
||||||
defaultSession = "none+i3";
|
defaultSession = "none+i3";
|
||||||
lightdm.enable = false;
|
lightdm.enable = false;
|
||||||
gdm.enable = true;
|
gdm.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
windowManager.i3 = {
|
windowManager.i3 = {
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
{pkgs, config, ... }: {
|
|
||||||
}
|
|
||||||
@@ -114,6 +114,11 @@
|
|||||||
|
|
||||||
# video/audio tools
|
# video/audio tools
|
||||||
libva-utils
|
libva-utils
|
||||||
|
nvtop
|
||||||
|
vdpauinfo
|
||||||
|
vulkan-tools
|
||||||
|
glxinfo
|
||||||
|
glmark2
|
||||||
|
|
||||||
# minimal screen capture tool, used by i3 blur lock to take a screenshot
|
# minimal screen capture tool, used by i3 blur lock to take a screenshot
|
||||||
# print screen key is also bound to this tool in i3 config
|
# print screen key is also bound to this tool in i3 config
|
||||||
|
|||||||
Reference in New Issue
Block a user