feat: redesign the project structure
18
flake.lock
generated
@@ -240,11 +240,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685019994,
|
"lastModified": 1684596126,
|
||||||
"narHash": "sha256-81o6SKZPALvib21hIOMx2lIhFSs0mRy0PfPvg0zsfTk=",
|
"narHash": "sha256-4RZZmygeEXpuBqEXGs38ZAcWjWKGwu13Iqbxub6wuJk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "d1f04b0f365a34896a37d9015637796537ec88a3",
|
"rev": "27ef11f0218d9018ebb2948d40133df2b1de622d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -534,11 +534,11 @@
|
|||||||
"nixpkgs": "nixpkgs_7"
|
"nixpkgs": "nixpkgs_7"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685045766,
|
"lastModified": 1685121294,
|
||||||
"narHash": "sha256-MK128KJnrf0PqfdnL40KN57ZSpHPtru19TH+Ok0A0TU=",
|
"narHash": "sha256-ddWsZ2JGWgD/xfE2XZhfVibRTacU0hWYVrAovNZNb2M=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "38c86d9ff0a4cff1e229214031f7eaaab34e10f1",
|
"rev": "e49f4358e371c5f6486a95e90dfb1754817acdae",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -645,11 +645,11 @@
|
|||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685061478,
|
"lastModified": 1685156120,
|
||||||
"narHash": "sha256-fNCFmOOfTmtWCV4WEoAnwwyjjB4NRAzucTKdt0w5zvg=",
|
"narHash": "sha256-XnfGRNvRgqdNyiTm1B2VvzeuLFcENOXIir2jIE7BQ3A=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "82f3aa5c5a85a9f2a1e72eaf0eec30c8ab8fdf2c",
|
"rev": "d71033acca2e80c8a2341a6dcd81fc9a677b1c4f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
85
flake.nix
@@ -1,12 +1,6 @@
|
|||||||
{
|
{
|
||||||
description = "NixOS configuration of Ryan Yin";
|
description = "NixOS configuration of Ryan Yin";
|
||||||
|
|
||||||
# flake 为了确保够纯,它不依赖系统自身的 /etc/nix/nix.conf,而是在 flake.nix 中通过 nixConfig 设置
|
|
||||||
# 但是为了确保安全性,flake 默认仅允许直接设置少数 nixConfig 参数,其他参数都需要在执行 nix 命令时指定 `--accept-flake-config`,否则会被忽略
|
|
||||||
# <https://nixos.org/manual/nix/stable/command-ref/conf-file.html>
|
|
||||||
# 如果有些包国内镜像下载不到,它仍然会走国外,这时候就得靠旁路由来解决了。
|
|
||||||
# 临时修改默认网关为旁路由: sudo ip route add default via 192.168.5.201
|
|
||||||
# sudo ip route del default via 192.168.5.201
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
@@ -31,13 +25,17 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# 这是 flake.nix 的标准格式,inputs 是 flake 的依赖,outputs 是 flake 的输出
|
|
||||||
# inputs 中的每一项都被拉取、构建后,被作为参数传递给 outputs 函数
|
|
||||||
inputs = {
|
|
||||||
# flake inputs 有很多种引用方式,应用最广泛的是 github 的引用方式
|
|
||||||
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # 使用 nixos-unstable 分支 for nix flakes
|
# This is the standard format for flake.nix. `inputs` are the dependencies of the flake,
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05"; # unstable branch may be broken sometimes, use stable branch when necessary
|
# and `outputs` function will return all the build results of the flake.
|
||||||
|
# Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built.
|
||||||
|
inputs = {
|
||||||
|
# There are many ways to reference flake inputs. The most widely used is github:owner/name/reference,
|
||||||
|
# which represents the GitHub repository URL + branch/commit-id/tag.
|
||||||
|
|
||||||
|
# Official NixOS package source, using nixos-unstable branch here
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
|
|
||||||
# for macos
|
# for macos
|
||||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin";
|
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin";
|
||||||
@@ -51,10 +49,14 @@
|
|||||||
# e.g. wechat-uos/qqmusic/dingtalk
|
# e.g. wechat-uos/qqmusic/dingtalk
|
||||||
nur.url = "github:nix-community/NUR";
|
nur.url = "github:nix-community/NUR";
|
||||||
|
|
||||||
home-manager.url = "github:nix-community/home-manager";
|
# home-manager, used for managing user configuration
|
||||||
# follows 是 inputs 中的继承语法
|
home-manager = {
|
||||||
# 这里使 home-manager 的 nixpkgs 这个 inputs 与当前 flake 的 inputs.nixpkgs 保持一致,避免依赖的 nixpkgs 版本不一致导致问题
|
url = "github:nix-community/home-manager";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
# The `follows` keyword in inputs is used for inheritance.
|
||||||
|
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
||||||
|
# to avoid problems caused by different versions of nixpkgs dependencies.
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# modern window compositor
|
# modern window compositor
|
||||||
hyprland.url = "github:hyprwm/Hyprland/v0.25.0";
|
hyprland.url = "github:hyprwm/Hyprland/v0.25.0";
|
||||||
@@ -77,9 +79,11 @@
|
|||||||
nil.url = "github:oxalica/nil/2023-05-09";
|
nil.url = "github:oxalica/nil/2023-05-09";
|
||||||
};
|
};
|
||||||
|
|
||||||
# outputs 的参数都是 inputs 中定义的依赖项,可以通过它们的名称来引用。
|
# `outputs` are all the build result of the flake.
|
||||||
# 不过 self 是个例外,这个特殊参数指向 outputs 自身(自引用),以及 flake 根目录
|
# A flake can have many use cases and different types of outputs.
|
||||||
# 这里的 @ 语法将函数的参数 attribute set 取了个别名,方便在内部使用
|
# parameters in `outputs` are defined in `inputs` and can be referenced by their names.
|
||||||
|
# However, `self` is an exception, This special parameter points to the `outputs` itself (self-reference)
|
||||||
|
# The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function.
|
||||||
outputs = inputs@{
|
outputs = inputs@{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
@@ -88,49 +92,67 @@
|
|||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
# By default, NixOS will try to refer the nixosConfiguration with its hostname.
|
||||||
|
# so the system named `msi-rtx4090` will use this configuration.
|
||||||
|
# However, the configuration name can also be specified using `sudo nixos-rebuild switch --flake /path/to/flakes/directory#<name>`.
|
||||||
|
# The `nixpkgs.lib.nixosSystem` function is used to build this configuration, the following attribute set is its parameter.
|
||||||
|
# Run `sudo nixos-rebuild switch --flake .#msi-rtx4090` in the flake's directory to deploy this configuration on any NixOS system
|
||||||
msi-rtx4090 = nixpkgs.lib.nixosSystem {
|
msi-rtx4090 = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
specialArgs = inputs;
|
# The Nix module system can modularize configurations, improving the maintainability of configurations.
|
||||||
|
#
|
||||||
|
# Each parameter in the `modules` is a Nix Module, and there is a partial introduction to it in the nixpkgs manual:
|
||||||
|
# <https://nixos.org/manual/nixpkgs/unstable/#module-system-introduction>
|
||||||
|
# It is said to be partial because the documentation is not complete, only some simple introductions
|
||||||
|
# (such is the current state of Nix documentation...)
|
||||||
|
# A Nix Module can be an attribute set, or a function that returns an attribute set.
|
||||||
|
# If a Module is a function, according to the Nix Wiki description, this function can have up to four parameters:
|
||||||
|
#
|
||||||
|
# config: The configuration of the entire system
|
||||||
|
# options: All option declarations refined with all definition and declaration references.
|
||||||
|
# pkgs: The attribute set extracted from the Nix package collection and enhanced with the nixpkgs.config option.
|
||||||
|
# modulesPath: The location of the module directory of Nix.
|
||||||
|
#
|
||||||
|
# Only these four parameters can be passed by default.
|
||||||
|
# If you need to pass other parameters, you must use `specialArgs` by uncomment the following line
|
||||||
|
specialArgs = inputs; # pass all inputs into all sub modules.
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/msi-rtx4090
|
./hosts/msi-rtx4090
|
||||||
|
|
||||||
# home-manager 作为 nixos 的一个 module
|
# make home-manager as a module of nixos
|
||||||
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
|
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
# pass all inputs into home manager's all sub modules
|
||||||
home-manager.extraSpecialArgs = inputs;
|
home-manager.extraSpecialArgs = inputs;
|
||||||
home-manager.users.ryan = import ./home/home-x11.nix;
|
home-manager.users.ryan = import ./home/linux/x11.nix;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
nixos-test = nixpkgs.lib.nixosSystem {
|
nixos-test = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs = inputs;
|
specialArgs = inputs;
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/nixos-test
|
./hosts/nixos-test
|
||||||
|
|
||||||
# home-manager 作为 nixos 的一个 module
|
|
||||||
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
|
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
|
||||||
home-manager.extraSpecialArgs = inputs;
|
home-manager.extraSpecialArgs = inputs;
|
||||||
home-manager.users.ryan = import ./home/home-wayland.nix;
|
home-manager.users.ryan = import ./home/linux/wayland.nix;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# configurations for MacOS
|
||||||
darwinConfigurations."harmonica" = darwin.lib.darwinSystem {
|
darwinConfigurations."harmonica" = darwin.lib.darwinSystem {
|
||||||
system = "x86_64-darwin";
|
system = "x86_64-darwin";
|
||||||
|
|
||||||
@@ -138,16 +160,13 @@
|
|||||||
modules = [
|
modules = [
|
||||||
./hosts/harmonica
|
./hosts/harmonica
|
||||||
|
|
||||||
# home-manager 作为 nixos 的一个 module
|
|
||||||
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
|
|
||||||
home-manager.darwinModules.home-manager
|
home-manager.darwinModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
|
||||||
home-manager.extraSpecialArgs = inputs;
|
home-manager.extraSpecialArgs = inputs;
|
||||||
home-manager.users.admin = import ./home/home-darwin.nix;
|
home-manager.users.admin = import ./home/darwin;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
117
home/common/core.nix
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
{config, pkgs, ...}: let
|
||||||
|
d = config.xdg.dataHome;
|
||||||
|
c = config.xdg.configHome;
|
||||||
|
cache = config.xdg.cacheHome;
|
||||||
|
in rec {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
neofetch
|
||||||
|
nnn # terminal file manager
|
||||||
|
|
||||||
|
# archives
|
||||||
|
zip
|
||||||
|
xz
|
||||||
|
unzip
|
||||||
|
p7zip
|
||||||
|
|
||||||
|
# utils
|
||||||
|
ripgrep # recursively searches directories for a regex pattern
|
||||||
|
jq # A lightweight and flexible command-line JSON processor
|
||||||
|
yq-go # yaml processer https://github.com/mikefarah/yq
|
||||||
|
exa # A modern replacement for ‘ls’
|
||||||
|
|
||||||
|
# networking tools
|
||||||
|
mtr # A network diagnostic tool
|
||||||
|
iperf3
|
||||||
|
nmap
|
||||||
|
socat
|
||||||
|
ldns # replacement of dig, it provide the command `drill`
|
||||||
|
aria2 # A lightweight multi-protocol & multi-source command-line download utility
|
||||||
|
socat # replacement of openbsd-netcat
|
||||||
|
|
||||||
|
# misc
|
||||||
|
file
|
||||||
|
which
|
||||||
|
tree
|
||||||
|
gnused
|
||||||
|
gnutar
|
||||||
|
gawk
|
||||||
|
p7zip
|
||||||
|
xz
|
||||||
|
zstd
|
||||||
|
|
||||||
|
# productivity
|
||||||
|
hugo
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
# A terminal multiplexer
|
||||||
|
tmux = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# a cat(1) clone with syntax highlighting and Git integration.
|
||||||
|
bat = {
|
||||||
|
enable = true;
|
||||||
|
config = {
|
||||||
|
pager = "less -FR";
|
||||||
|
theme = "Catppuccin-mocha";
|
||||||
|
};
|
||||||
|
themes = {
|
||||||
|
Catppuccin-mocha = builtins.readFile (pkgs.fetchurl {
|
||||||
|
url = "https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme";
|
||||||
|
hash = "sha256-qMQNJGZImmjrqzy7IiEkY5IhvPAMZpq0W6skLLsng/w=";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# skim provides a single executable: sk.
|
||||||
|
# Basically anywhere you would want to use grep, try sk instead.
|
||||||
|
skim = {
|
||||||
|
enable = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
# syncthing.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
bashrcExtra = ''
|
||||||
|
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# add environment variables
|
||||||
|
systemd.user.sessionVariables = {
|
||||||
|
# clean up ~
|
||||||
|
LESSHISTFILE = cache + "/less/history";
|
||||||
|
LESSKEY = c + "/less/lesskey";
|
||||||
|
WINEPREFIX = d + "/wine";
|
||||||
|
|
||||||
|
# set this variable make i3 failed to start
|
||||||
|
# related issue:
|
||||||
|
# https://github.com/sddm/sddm/issues/871
|
||||||
|
# XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
|
||||||
|
|
||||||
|
# set default applications
|
||||||
|
BROWSER = "firefox";
|
||||||
|
TERMINAL = "alacritty";
|
||||||
|
|
||||||
|
# enable scrolling in git diff
|
||||||
|
DELTA_PAGER = "less -R";
|
||||||
|
|
||||||
|
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
|
||||||
|
};
|
||||||
|
|
||||||
|
home.sessionVariables = systemd.user.sessionVariables;
|
||||||
|
|
||||||
|
home.shellAliases = {
|
||||||
|
k = "kubectl";
|
||||||
|
|
||||||
|
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||||
|
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||||
|
};
|
||||||
|
}
|
||||||
17
home/common/default.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{config, pkgs, ...}: let
|
||||||
|
d = config.xdg.dataHome;
|
||||||
|
c = config.xdg.configHome;
|
||||||
|
cache = config.xdg.cacheHome;
|
||||||
|
in rec {
|
||||||
|
imports = [
|
||||||
|
./nushell
|
||||||
|
|
||||||
|
./alacritty.nix
|
||||||
|
./core.nix
|
||||||
|
./development.nix
|
||||||
|
./git.nix
|
||||||
|
./media.nix
|
||||||
|
./starship.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
97
home/common/development.nix
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
{config, pkgs, nil, ...}:
|
||||||
|
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
nil.packages."${pkgs.system}".default # nix language server
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
insomnia
|
||||||
|
jetbrains.pycharm-community
|
||||||
|
# jetbrains.idea-community
|
||||||
|
|
||||||
|
# cloud native
|
||||||
|
docker-compose
|
||||||
|
kubectl
|
||||||
|
kubernetes-helm
|
||||||
|
terraform
|
||||||
|
pulumi
|
||||||
|
|
||||||
|
# cloud provider
|
||||||
|
awscli
|
||||||
|
|
||||||
|
# DO NOT install build tools for C/C++, set it per project by devShell instead
|
||||||
|
gnumake # used by this repo, to simplify the deployment
|
||||||
|
clang-tools
|
||||||
|
clang-analyzer
|
||||||
|
# lldb
|
||||||
|
# cmake
|
||||||
|
# autoconf
|
||||||
|
# automake
|
||||||
|
# bison
|
||||||
|
# cppcheck
|
||||||
|
# fakeroot
|
||||||
|
# flex
|
||||||
|
# gettext
|
||||||
|
# groff
|
||||||
|
# libtool
|
||||||
|
# m4
|
||||||
|
# patch
|
||||||
|
# pkgconf
|
||||||
|
# texinfo
|
||||||
|
# binutils
|
||||||
|
|
||||||
|
# Golang
|
||||||
|
delve
|
||||||
|
go
|
||||||
|
go-outline
|
||||||
|
go-tools
|
||||||
|
go2nix
|
||||||
|
gomodifytags
|
||||||
|
gopls
|
||||||
|
gotests
|
||||||
|
impl
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
rustup
|
||||||
|
|
||||||
|
# python
|
||||||
|
(python3.withPackages(ps: with ps; [
|
||||||
|
ipython
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
pyquery
|
||||||
|
]))
|
||||||
|
# need to run `conda-install` before using it
|
||||||
|
# need to run `conda-shell` before using command `conda`
|
||||||
|
conda
|
||||||
|
|
||||||
|
# db related
|
||||||
|
dbeaver
|
||||||
|
mycli
|
||||||
|
pgcli
|
||||||
|
|
||||||
|
# embedded development
|
||||||
|
minicom
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
# modern vim
|
||||||
|
neovim = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
set number relativenumber
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
direnv = {
|
||||||
|
enable = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# GitHub CLI tool
|
||||||
|
programs.gh = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
30
home/common/git.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
lfs.enable = true;
|
||||||
|
|
||||||
|
userName = "Ryan Yin";
|
||||||
|
userEmail = "xiaoyin_c@qq.com";
|
||||||
|
|
||||||
|
extraConfig = {
|
||||||
|
pull = {
|
||||||
|
rebase = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# signing = {
|
||||||
|
# key = "xxx";
|
||||||
|
# signByDefault = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
delta = {
|
||||||
|
enable = true;
|
||||||
|
options = {
|
||||||
|
features = "side-by-side";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
17
home/common/media.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# processing audio/video
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
ffmpeg-full
|
||||||
|
|
||||||
|
# images
|
||||||
|
viu # terminal image viewer
|
||||||
|
imv # simple image viewer
|
||||||
|
imagemagick
|
||||||
|
graphviz
|
||||||
|
];
|
||||||
|
}
|
||||||
44
home/darwin/core.nix
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
{pkgs, ...}:
|
||||||
|
{
|
||||||
|
# MacOS specific configuration
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.ssh = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# all my ssh private key are generated by `ssh-keygen -t ed25519 -C "ryan@nickname"`
|
||||||
|
# the config's format:
|
||||||
|
# Host — given the pattern used to match against the host name given on the command line.
|
||||||
|
# HostName — specify nickname or abbreviation for host
|
||||||
|
# IdentityFile — the location of your SSH key authentication file for the account.
|
||||||
|
# format in details:
|
||||||
|
# https://www.ssh.com/academy/ssh/config
|
||||||
|
extraConfig = ''
|
||||||
|
Host 192.168.*
|
||||||
|
# allow to securely use local SSH agent to authenticate on the remote machine.
|
||||||
|
# It has the same effect as adding cli option `ssh -A user@host`
|
||||||
|
ForwardAgent yes
|
||||||
|
# romantic holds my homelab~
|
||||||
|
IdentityFile ~/.ssh/romantic
|
||||||
|
# Specifies that ssh should only use the identity file explicitly configured above
|
||||||
|
# required to prevent sending default identity files first.
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host github.com
|
||||||
|
Hostname github.com
|
||||||
|
# github is controlled by gluttony~
|
||||||
|
IdentityFile ~/.ssh/harmonica
|
||||||
|
# Specifies that ssh should only use the identity file explicitly configured above
|
||||||
|
# required to prevent sending default identity files first.
|
||||||
|
IdentitiesOnly yes
|
||||||
|
'';
|
||||||
|
|
||||||
|
# use ssh-agent so we only need to input passphrase once
|
||||||
|
# run `ssh-add /path/to/key` for every identity file
|
||||||
|
# check imported keys by `ssh-add -l`
|
||||||
|
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,10 +1,33 @@
|
|||||||
{pkgs, ...}:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
imports = [
|
||||||
docker-compose
|
../common/core.nix
|
||||||
kubectl
|
../common/alacritty.nix
|
||||||
kubernetes-helm
|
../common/git.nix
|
||||||
terraform
|
../common/starship.nix
|
||||||
pulumi
|
|
||||||
|
./core.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Home Manager needs a bit of information about you and the
|
||||||
|
# paths it should manage.
|
||||||
|
home = {
|
||||||
|
username = "admin";
|
||||||
|
# set homeDirectory make build fail
|
||||||
|
# homeDirectory = "/Users/admin";
|
||||||
|
|
||||||
|
# This value determines the Home Manager release that your
|
||||||
|
# configuration is compatible with. This helps avoid breakage
|
||||||
|
# when a new Home Manager release introduces backwards
|
||||||
|
# incompatible changes.
|
||||||
|
#
|
||||||
|
# You can update Home Manager without changing this value. See
|
||||||
|
# the Home Manager release notes for a list of state version
|
||||||
|
# changes in each release.
|
||||||
|
stateVersion = "22.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./darwin
|
|
||||||
];
|
|
||||||
|
|
||||||
# Home Manager needs a bit of information about you and the
|
|
||||||
# paths it should manage.
|
|
||||||
home = {
|
|
||||||
username = "admin";
|
|
||||||
# set homeDirectory make build fail
|
|
||||||
# homeDirectory = "/Users/admin";
|
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
|
||||||
# configuration is compatible with. This helps avoid breakage
|
|
||||||
# when a new Home Manager release introduces backwards
|
|
||||||
# incompatible changes.
|
|
||||||
#
|
|
||||||
# You can update Home Manager without changing this value. See
|
|
||||||
# the Home Manager release notes for a list of state version
|
|
||||||
# changes in each release.
|
|
||||||
stateVersion = "22.11";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
}
|
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
# home.packages = [
|
|
||||||
# ];
|
|
||||||
|
|
||||||
programs.ssh = {
|
programs.ssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
@@ -39,35 +36,4 @@
|
|||||||
# check imported keys by `ssh-add -l`
|
# check imported keys by `ssh-add -l`
|
||||||
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.git = {
|
|
||||||
enable = true;
|
|
||||||
lfs.enable = true;
|
|
||||||
|
|
||||||
userName = "Ryan Yin";
|
|
||||||
userEmail = "xiaoyin_c@qq.com";
|
|
||||||
|
|
||||||
extraConfig = {
|
|
||||||
pull = {
|
|
||||||
rebase = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# signing = {
|
|
||||||
# key = "xxx";
|
|
||||||
# signByDefault = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
delta = {
|
|
||||||
enable = true;
|
|
||||||
options = {
|
|
||||||
features = "side-by-side";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# GitHub CLI tool
|
|
||||||
programs.gh = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
39
home/linux/common/system-tools.nix
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
# Linux Only Packages, not available on Darwin
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
btop # replacement of htop/nmon
|
||||||
|
htop
|
||||||
|
iotop
|
||||||
|
nmon
|
||||||
|
|
||||||
|
## networking tools
|
||||||
|
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
||||||
|
iftop
|
||||||
|
|
||||||
|
# misc
|
||||||
|
libnotify
|
||||||
|
|
||||||
|
# system call monitoring
|
||||||
|
strace
|
||||||
|
ltrace # library call monitoring
|
||||||
|
lsof
|
||||||
|
|
||||||
|
# system tools
|
||||||
|
ethtool
|
||||||
|
sysstat
|
||||||
|
lm_sensors # for `sensors` command
|
||||||
|
cifs-utils # for mounting windows shares
|
||||||
|
];
|
||||||
|
|
||||||
|
# auto mount usb drives
|
||||||
|
services = {
|
||||||
|
udiskie.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
playerctld.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# XDG stands for "Cross-Desktop Group", with X used to mean "cross".
|
||||||
|
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
|
||||||
|
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
|
||||||
|
# https://www.freedesktop.org/wiki/Specifications/
|
||||||
{config, pkgs, ...}: let
|
{config, pkgs, ...}: let
|
||||||
browser = ["firefox.desktop"];
|
browser = ["firefox.desktop"];
|
||||||
|
|
||||||
@@ -25,6 +29,11 @@
|
|||||||
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
xdg-utils
|
||||||
|
xdg-user-dirs
|
||||||
|
];
|
||||||
|
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cacheHome = config.home.homeDirectory + "/.local/cache";
|
cacheHome = config.home.homeDirectory + "/.local/cache";
|
||||||
21
home/linux/desktop/creative.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# creative
|
||||||
|
# blender # 3d modeling
|
||||||
|
# gimp # image editing, I prefer using figma in browser instead of this one
|
||||||
|
inkscape # vector graphics
|
||||||
|
krita # digital painting
|
||||||
|
kicad # 3d printing, eletrical engineering
|
||||||
|
musescore # music notation
|
||||||
|
reaper # audio production
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
obs-studio.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
21
home/linux/desktop/default.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./creative.nix
|
||||||
|
./media.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# networking
|
||||||
|
wireshark
|
||||||
|
|
||||||
|
# instant messaging
|
||||||
|
telegram-desktop
|
||||||
|
discord
|
||||||
|
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
|
||||||
|
|
||||||
|
# remote desktop(rdp connect)
|
||||||
|
remmina
|
||||||
|
freerdp # required by remmina
|
||||||
|
];
|
||||||
|
}
|
||||||
32
home/linux/desktop/media.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# media - control and enjoy audio/video
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# audio control
|
||||||
|
pavucontrol
|
||||||
|
playerctl
|
||||||
|
pulsemixer
|
||||||
|
|
||||||
|
nvtop
|
||||||
|
|
||||||
|
# video/audio tools
|
||||||
|
libva-utils
|
||||||
|
vdpauinfo
|
||||||
|
vulkan-tools
|
||||||
|
glxinfo
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
mpv = {
|
||||||
|
enable = true;
|
||||||
|
defaultProfiles = ["gpu-hq"];
|
||||||
|
scripts = [pkgs.mpvScripts.mpris];
|
||||||
|
};
|
||||||
|
|
||||||
|
obs-studio.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -29,6 +29,5 @@
|
|||||||
XMODIFIERS = "@im=fcitx";
|
XMODIFIERS = "@im=fcitx";
|
||||||
INPUT_METHOD = "fcitx";
|
INPUT_METHOD = "fcitx";
|
||||||
IMSETTINGS_MODULE = "fcitx";
|
IMSETTINGS_MODULE = "fcitx";
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
@@ -23,6 +23,13 @@
|
|||||||
executable = true; # make all scripts executable
|
executable = true; # make all scripts executable
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# rofi is a application launcher and dmenu replacement
|
||||||
|
home.file.".config/rofi" = {
|
||||||
|
source = ./rofi-conf;
|
||||||
|
# copy the scripts directory recursively
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
|
|
||||||
# allow fontconfig to discover fonts and configurations installed through home.packages
|
# allow fontconfig to discover fonts and configurations installed through home.packages
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
|
|
||||||