mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-28 04:11:49 +01: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
|
||||
|
||||
- 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
|
||||
- [devShell](https://github.com/numtide/devshell): manage development environments
|
||||
|
||||
|
||||
17
flake.lock
generated
17
flake.lock
generated
@@ -222,6 +222,22 @@
|
||||
"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": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
@@ -297,6 +313,7 @@
|
||||
"hyprland": "hyprland",
|
||||
"nixos-cn": "nixos-cn",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-stable": "nixpkgs-stable",
|
||||
"nixpkgs-wayland": "nixpkgs-wayland"
|
||||
}
|
||||
},
|
||||
|
||||
24
flake.nix
24
flake.nix
@@ -34,7 +34,9 @@
|
||||
inputs = {
|
||||
# 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";
|
||||
# follows 是 inputs 中的继承语法
|
||||
# 这里使 home-manager 的 nixpkgs 这个 inputs 与当前 flake 的 inputs.nixpkgs 保持一致,避免依赖的 nixpkgs 版本不一致导致问题
|
||||
@@ -43,7 +45,7 @@
|
||||
# modern window compositor
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
# 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 = {
|
||||
@@ -59,6 +61,7 @@
|
||||
outputs = inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-stable,
|
||||
home-manager,
|
||||
nixos-cn,
|
||||
...
|
||||
@@ -84,7 +87,10 @@
|
||||
#
|
||||
# nix flake 的 modules 系统可将配置模块化,提升配置的可维护性
|
||||
# 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs
|
||||
specialArgs = {inherit inputs;};
|
||||
specialArgs = {
|
||||
inherit nixos-cn;
|
||||
inherit nixpkgs-stable;
|
||||
};
|
||||
modules = [
|
||||
./hosts/nixos-test
|
||||
|
||||
@@ -114,7 +120,10 @@
|
||||
msi-rtx4090 = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
|
||||
specialArgs = {inherit inputs;};
|
||||
specialArgs = {
|
||||
inherit nixos-cn;
|
||||
inherit nixpkgs-stable;
|
||||
};
|
||||
modules = [
|
||||
./hosts/msi-rtx4090
|
||||
|
||||
@@ -129,13 +138,6 @@
|
||||
home-manager.extraSpecialArgs = inputs;
|
||||
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
|
||||
with pkgs; [
|
||||
# for flypy chinese input method
|
||||
fcitx5-rime
|
||||
fcitx5-configtool
|
||||
fcitx5-chinese-addons
|
||||
fcitx5-mozc # japanese input method
|
||||
fcitx5-gtk # gtk im module
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -47,10 +47,9 @@
|
||||
ncmpcpp # a mpd client with a UI
|
||||
];
|
||||
|
||||
# if use vscode in wayland, uncomment those line
|
||||
systemd.user.sessionVariables = {
|
||||
"NIXOS_OZONE_WL" = "1"; # for vscode
|
||||
"MOZ_ENABLE_WAYLAND" = "1";
|
||||
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
|
||||
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
|
||||
|
||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
{
|
||||
pkgs,
|
||||
nixpkgs-stable,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# use wayland version of firefox
|
||||
firefox-wayland
|
||||
];
|
||||
home.packages =
|
||||
let
|
||||
pkgs-stable = import nixpkgs-stable {
|
||||
system = pkgs.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
with pkgs-stable; [
|
||||
firefox-wayland
|
||||
|
||||
programs =
|
||||
let commandLineArgs = [ "--enable-wayland-ime" "--ozone-platform=wayland" ];
|
||||
in {
|
||||
chromium = {
|
||||
enable = true;
|
||||
inherit commandLineArgs;
|
||||
};
|
||||
google-chrome = {
|
||||
enable = true;
|
||||
inherit commandLineArgs;
|
||||
};
|
||||
};
|
||||
# chrome wayland support was broken on nixos-unstable branch, so fallback to stable branch for now
|
||||
# https://github.com/swaywm/sway/issues/7562
|
||||
google-chrome
|
||||
];
|
||||
|
||||
# programs = {
|
||||
# };
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
ripgrep
|
||||
yq-go # https://github.com/mikefarah/yq
|
||||
htop
|
||||
nvtop
|
||||
|
||||
## networking tools
|
||||
wireshark
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
./common.nix
|
||||
./git.nix
|
||||
./media.nix
|
||||
./nixos-cn.nix
|
||||
./vscode.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; [
|
||||
qq
|
||||
wechat-uos
|
||||
netease-cloud-music
|
||||
# 引入nixos-cn flake提供的NixOS模块
|
||||
nixos-cn.nixosModules.nixos-cn
|
||||
];
|
||||
|
||||
programs = {
|
||||
mpv = {
|
||||
enable = true;
|
||||
defaultProfiles = ["gpu-hq"];
|
||||
scripts = [pkgs.mpvScripts.mpris];
|
||||
};
|
||||
|
||||
obs-studio.enable = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
playerctld.enable = true;
|
||||
};
|
||||
# # 使用 nixos-cn flake 提供的包
|
||||
home.packages = with nixos-cn.legacyPackages.${pkgs.system}; [
|
||||
# qq
|
||||
# wechat-uos # TODO failed to install
|
||||
netease-cloud-music # TODO chinese font missing
|
||||
];
|
||||
}
|
||||
@@ -21,8 +21,8 @@
|
||||
"video/*" = ["mpv.dekstop"];
|
||||
"image/*" = ["imv.desktop"];
|
||||
"application/json" = browser;
|
||||
"application/pdf" = ["org.pwmt.zathura.desktop.desktop"];
|
||||
"x-scheme-handler/discord" = ["discordcanary.desktop"];
|
||||
"application/pdf" = ["org.pwmt.zathura.desktop.desktop"]; # TODO: pdf viewer
|
||||
"x-scheme-handler/discord" = ["discord.desktop"];
|
||||
"x-scheme-handler/spotify" = ["spotify.desktop"];
|
||||
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
||||
};
|
||||
@@ -43,6 +43,5 @@ in {
|
||||
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
[
|
||||
../../modules/system.nix
|
||||
../../modules/hyprland.nix
|
||||
../../modules/nixpkgs-wayland.nix
|
||||
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
@@ -51,14 +50,22 @@
|
||||
|
||||
|
||||
# for Nvidia GPU
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default
|
||||
hardware.nvidia = {
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
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 = {
|
||||
enable = true;
|
||||
enableNvidia = true;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
[
|
||||
../../modules/system.nix
|
||||
../../modules/hyprland.nix
|
||||
../../modules/nixpkgs-wayland.nix
|
||||
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
};
|
||||
|
||||
displayManager = {
|
||||
defaultSession = "hyprland";
|
||||
lightdm.enable = false;
|
||||
gdm.enable = true;
|
||||
defaultSession = "hyprland";
|
||||
lightdm.enable = false;
|
||||
gdm = {
|
||||
enable = true;
|
||||
wayland = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -42,4 +45,18 @@
|
||||
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 = {
|
||||
defaultSession = "none+i3";
|
||||
lightdm.enable = false;
|
||||
gdm.enable = true;
|
||||
defaultSession = "none+i3";
|
||||
lightdm.enable = false;
|
||||
gdm.enable = true;
|
||||
};
|
||||
|
||||
windowManager.i3 = {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
{pkgs, config, ... }: {
|
||||
}
|
||||
@@ -114,6 +114,11 @@
|
||||
|
||||
# video/audio tools
|
||||
libva-utils
|
||||
nvtop
|
||||
vdpauinfo
|
||||
vulkan-tools
|
||||
glxinfo
|
||||
glmark2
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user