Compare commits

...

38 Commits

Author SHA1 Message Date
ryan4yin 78e620001f fix: fcitx5 2023-05-08 00:23:06 +08:00
ryan4yin 1b9801c15a fix: add android development tools - adb/fastboot 2023-05-07 23:45:16 +08:00
ryan4yin ffd4313dec fix: add android development tools - adb/fastboot 2023-05-07 23:44:24 +08:00
ryan4yin ad5f3da45f feat: add embedded dev tools - minicom 2023-05-07 23:36:43 +08:00
ryan4yin 129302ac26 feat: add android development tools - adb/fastboot 2023-05-07 23:30:56 +08:00
ryan4yin be47ea74cd fix: fcitx5 2023-05-07 22:22:07 +08:00
ryan4yin f1c20d68f9 feat: mount smb/cifs share 2023-05-07 22:21:15 +08:00
ryan4yin 0716174fb7 feat: add screenshots 2023-05-07 21:25:16 +08:00
ryan4yin b25b6a48e2 feat: try to fix fcitx5 2023-05-07 20:57:03 +08:00
ryan4yin 162399ad8a feat: update hyprland's startup script to reduce start duration, update gtk theme configs 2023-05-07 19:59:09 +08:00
ryan4yin 79c424e08e feat: try to fix fcitx5 2023-05-07 19:17:25 +08:00
ryan4yin 381f0c5123 fix: skim with bash 2023-05-07 17:29:31 +08:00
ryan4yin e83aec85f1 fix: disable synthing 2023-05-07 17:21:28 +08:00
ryan4yin 1235f08891 fix: tmux 2023-05-07 17:20:36 +08:00
ryan4yin ed7ebb0802 fix: starship with bash, vscode 2023-05-07 17:16:50 +08:00
ryan4yin 82f0248cf6 fix: adjust hyprland configs 2023-05-07 16:37:39 +08:00
ryan4yin 88faaa950c feat: adjust 4k monitor scale to 1.6 2023-05-07 11:50:03 +08:00
ryan4yin e9e63e6d4a feat: update TODO, fix some problems 2023-05-07 05:03:16 +08:00
ryan4yin b8b4d843d6 feat: add nvtop for gpu monitoring 2023-05-07 00:11:02 +08:00
ryan4yin 99e12fde04 fix: syntax error 2023-05-07 00:10:15 +08:00
ryan4yin bb47747529 feat: update TODO 2023-05-06 18:11:33 +08:00
ryan4yin 4f4bccbb59 feat: add more useful packages 2023-05-06 16:05:09 +08:00
ryan4yin ea35e5dc49 feat: add packages from nixos-cn 2023-05-06 14:49:31 +08:00
ryan4yin b50cca1ec6 fix: replace webp by png 2023-05-06 12:31:48 +08:00
ryan4yin 07d13c7cc9 feat: update system(flake.lock) 2023-05-06 12:17:19 +08:00
ryan4yin 57ed18fe8b fix: enable nix-command & flakes globally 2023-05-06 12:15:02 +08:00
ryan4yin e3a9bea779 feat: update wallpapers 2023-05-06 12:12:35 +08:00
ryan4yin 65e2672a68 fix: vscode settings is read only 2023-05-06 11:37:48 +08:00
ryan4yin 8619d9a284 feat: add docker with nvidia-containers support 2023-05-06 11:32:20 +08:00
ryan4yin 7619f7ca41 feat: replace old viewnior with imv 2023-05-06 04:39:46 +08:00
ryan4yin 90c61f0625 fix: networking 2023-05-06 04:16:02 +08:00
ryan4yin 1b95d4945f fix: missing cursor, networking error 2023-05-06 02:38:01 +08:00
Ryan Yin 830605aeec feat: replace i3wm with hyprland 2023-05-06 00:59:35 +08:00
Ryan Yin 9e549fb733 feat: add new host - msi-rtx4090 2023-05-04 23:48:49 +08:00
ryan4yin c56db98288 feat: update vscode extensions 2023-05-04 17:53:26 +08:00
ryan4yin 720ef0d9ca feat: update vscode extensions 2023-05-04 17:41:38 +08:00
ryan4yin 796cdcd928 feat: migrate docs to thiscute.world 2023-05-04 16:53:10 +08:00
ryan4yin 126c31d73b feat: update docs 2023-05-04 14:50:40 +08:00
100 changed files with 5941 additions and 754 deletions
+3
View File
@@ -0,0 +1,3 @@
.smb_credentials
-471
View File
@@ -1,471 +0,0 @@
# How to Learn Nix & Flake?
Nix Flake is a new feature in Nix, it's the unit for packaging Nix code in a reproducible and discoverable way.
They can have dependencies on other flakes, making it possible to have multi-repository Nix projects.
A flake is a filesystem tree (typically fetched from a Git repository or a tarball) that contains a file named flake.nix in the
root directory. flake.nix specifies some metadata about the flake such as dependencies (called inputs), as well as its outputs
(the Nix values such as packages or NixOS modules provided by the flake).
Nix Flake is an experimental feature till now (2023-04-23), but it's already very useful and being used by many people.
>Because `nix-command` & `flake` are still experimental, many document about nix are stll using old commands such as `nix-env`, `nix-channel` & `nix-shell`, but they are not very reproducible compared with `nix-command` & `flake`, So please forget those old commands, and start with the [New Nix Commands][New Nix Commands] for Nix Flake.
## 一、Nix Flake's Command Line
after enabled `nix-command` & `flake`, you can use `nix help` to get all the info of [New Nix Commands][New Nix Commands], the main commands include:
- `nix build` - build a derivation or fetch a store path, generate a result symlink in the current directory
- `nix develop` - run a bash shell that provides the build environment of a derivation
- `nix flake` - provides subcommands for creating, modifying and querying Nix flakes.
- `nix flake archive` - copy a flake and all its inputs to a store
- `nix flake check` - check whether the flake evaluates and run its tests
- `nix flake clone` - clone flake repository
- `nix flake info` - show flake metadata
- `nix flake init` - create a flake in the current directory from a template
- `nix flake lock` - create missing lock file entries
- `nix flake metadata` - show flake metadata
- `nix flake new` - create a flake in the specified directory from a template
- `nix flake prefetch` - download the source tree denoted by a flake reference into the Nix store
- `nix flake show` - show the outputs provided by a flake
- `nix flake update` - update flake lock file
- `nix profile` - manage Nix profiles. nix profile allows you to create and manage Nix profiles. A Nix profile is a set of packages that can be installed and upgraded independently from each other. Nix profiles are versioned, allowing them to be rolled back easily. its a replacement of `nix-env`.
- `nix profile diff-closures` - show the closure difference between each version of a profile
- `nix profile history` - show all versions of a profile
- `nix profile install` - install a package into a profile
- `nix profile list` - list installed packages
- `nix profile remove` - remove packages from a profile
- `nix profile rollback` - roll back to the previous version or a specified version of a profile
- `nix profile upgrade` - upgrade packages using their most recent flake
- `nix profile wipe-history` - delete non-current versions of a profile
- `nix repl` - start an interactive environment for evaluating Nix expressions
- `nix run` - run a Nix application. (use `nix run --help` for detail explanation)
- `nix search` - search for packages, maybe your woulde prefer the website <https://search.nixos.org> instead of this command.
- `nix shell` - run a shell in which the specified packages are available
[Zero to Nix - Determinate Systems][Zero to Nix - Determinate Systems] is a brand new guide to get started with Nix & Flake, recommended to read for beginners.
### Flake outpus
Flake outputs are what a flake produces as part of its build. Each flake can have many different outputs simultaneously, including but not limited to:
- Nix packages: named `apps.<system>.<name>`, `packages.<system>.<name>`, or `legacyPackages.<system>.<name>`
- Nix Helper Functions: named `lib`, which means a library for other flakes.
- Nix development environments: named `devShell`
- NixOS configurations: has many different outputs
- Nix templates: named `templates`
- templates can be used by command `nix flake init --template <reference>`
### Flake Command Examples
examples:
```bash
# `nixpkgs#ponysay` means `ponysay` from `nixpkgs` flake.
# [nixpkgs](https://github.com/NixOS/nixpkgs) contains `flake.nix` file, so it's a flake.
# `nixpkgs` is a falkeregistry id for `github:NixOS/nixpkgs/nixos-unstable`.
# you can find all the falkeregistry ids at <https://github.com/NixOS/flake-registry/blob/master/flake-registry.json>
# so this command means install and run package `ponysay` in `nixpkgs` flake.
echo "Hello Nix" | nix run "nixpkgs#ponysay"
# this command is the same as above, but use a full flake URI instead of falkeregistry id.
echo "Hello Nix" | nix run "github:NixOS/nixpkgs/nixos-unstable#ponysay"
# instead of treat flake package as an application,
# this command use the example package in zero-to-nix flake to setup the development environment,
# and then open a bash shell in that environment.
nix develop "github:DeterminateSystems/zero-to-nix#example"
# instead of using a remote flake, you can open a bash shell using the flake located in the current directory.
mkdir my-flake && cd my-flake
## init a flake with template
nix flake init --template "github:DeterminateSystems/zero-to-nix#javascript-dev"
# open a bash shell using the flake in current directory
nix develop
# or if your flake has multiple devShell outputs, you can specify which one to use.
nix develop .#example
# build package `bat` from flake `nixpkgs`, and put a symlink `result` in the current directory.
mkdir build-nix-package && cd build-nix-package
nix build "nixpkgs#bat"
# build a local flake is the same as nix develop, skip it
```
### Nix Flakes Repo
除了官方的 Nixpkgs 之外,nix flake 还可以从任何第三方仓库中获取 flake,这个前面已经演示过许多了。
第三方仓库虽然多,不过有几个比较常用的,官方也给它们提供了别名,列表保存在 [NixOS/flake-registry](ttps://github.com/NixOS/flake-registry/blob/master/flake-registry.json),可供参考。
比较知名的有:
- [NUR](https://github.com/nix-community/NUR): 它类似 Arch Linux 的 AUR,是一个第三方 packages/flakes 的集合
- [home-manager](https://github.com/nix-community/home-manager): home-manager 的 flake 版本
## Basics of Nix Language
>https://nix.dev/tutorials/nix-language
主要包含如下内容:
1. 数据类型
2. 函数的声明与调用语法
3. 内置函数与库函数
4. inputs 的不纯性
5. 用于描述 build task 的 derivation
### 1. 基础数据类型一览
```nix
{
string = "hello";
integer = 1;
float = 3.141;
bool = true;
null = null;
list = [ 1 "two" false ];
attribute-set = {
a = "hello";
b = 2;
c = 2.718;
d = false;
}; # comments are supported
}
```
以及一些基础操作符,普通的算术运算、布尔运算就跳过了:
```nix
# List concatenation
[ 1 2 3 ] ++ [ 4 5 6 ] # [ 1 2 3 4 5 6 ]
# Update attribute set attrset1 with names and values from attrset2.
{ a = 1; b = 2; } // { b = 3; c = 4; } # { a = 1; b = 3; c = 4; }
# 逻辑隐含,等同于 !b1 || b2.
bool -> bool
```
### 2. attribute set 说明
花括号 `{}` 用于创建 attribute set,也就是 key-value 对的集合,类似于 JSON 中的对象。
attribute set 默认不支持递归引用,如下内容会报错:
```nix
{
a = 1;
b = a + 1; # error: undefined variable 'a'
}
```
不过 nix 提供了 `rec` 关键字(recursive attribute set),可用于创建递归引用的 attribute set
```nix
rec {
a = 1;
b = a + 1; # ok
}
```
在递归引用的情况下,nix 会按照声明的顺序进行求值,所以如果 `a``b` 之后声明,那么 `b` 会报错。
可以使用 `.` 操作符来访问 attribute set 的成员:
```nix
let
a = {
b = {
c = 1;
};
};
in
a.b.c # result is 1
```
`.` 操作符也可直接用于赋值:
```nix
{ a.b.c = 1; }
```
### 3. let ... in ...
nix 的 `let ... in ...` 语法被称作「let 表达式」或者「let 绑定」,它用于创建临时使用的局部变量:
```nix
let
a = 1;
in
a + a # result is 2
```
let 表达式中的变量只能在 `in` 之后的表达式中使用,理解成临时变量就行。
### 4. with 语句
with 语句的语法如下:
```nix
with <attribute-set> ; <expression>
```
`with` 语句会将 `<attribute-set>` 中的所有成员添加到当前作用域中,这样在 `<expression>` 中就可以直接使用 `<attribute-set>` 中的成员了,简化 attribute set 的访问语法,比如:
```nix
let
a = {
x = 1;
y = 2;
z = 3;
};
in
with a; [ x y z ] # result is [ 1 2 3 ], equavlent to [ a.x a.y a.z ]
```
### 5. 继承 inherit ...
`inherit` 语句用于从 attribute set 中继承成员,同样是一个简化代码的语法糖,比如:
```nix
let
x = 1;
y = 2;
in
{
inherit x y;
} # result is { x = 1; y = 2; }
```
inherit 还能直接从某个 attribute set 中继承成员,语法为 `inherit (<attribute-set>) <member-name>;`,比如:
```nix
let
a = {
x = 1;
y = 2;
z = 3;
};
in
{
inherit (a) x y;
} # result is { x = 1; y = 2; }
```
### 6. ${ ... } 字符串插值
`${ ... }` 用于字符串插值,懂点编程的应该都很容易理解这个,比如:
```nix
let
a = 1;
in
"the value of a is ${a}" # result is "the value of a is 1"
```
### 7. 文件系统路径
Nix 中不带引号的字符串会被解析为文件系统路径,路径的语法与 Unix 系统相同。
### 8. 搜索路径
>请不要使用这个功能,搜索路径不是 pure 的,会导致不可预期的行为。
Nix 会在看到 `<nixpkgs>` 这类三角括号语法时,会在 `NIX_PATH` 环境变量中指定的路径中搜索该路径。
因为环境变量 `NIX_PATH` 是可变更的值,所以这个功能是不纯的,会导致不可预期的行为。
### 9. 多行字符串
多行字符串的语法为 `''`,比如:
```nix
''
this is a
multi-line
string
''
```
### 10. 函数
函数的声明语法为:
```nix
<arg1>:
<body>;
```
举几个常见的例子:
```nix
# function with one argument
a: a + a
# 嵌套函数
a: b: a + b
# function with two arguments
{ a, b }: a + b
# function with two arguments and default values
{ a ? 1, b ? 2 }: a + b
# 带有命名 attribute set 作为参数的函数,并且使用 ... 收集其他可选参数
# 命名 args 与 ... 可选参数通常被一起作为函数的参数定义使用
args@{ a, b, ... }: a + b + args.c
# 如下内容等价于上面的内容
{ a, b, ... }@args: a + b + args.c
# 但是要注意命名参数仅绑定了输入的 attribute set,默认参数不在其中,举例
let
f = { a ? 1, b ? 2, ... }@args: args # this will cause an error
in
f {} # result is {}
# 函数的调用方式就是把参数放在后面,比如下面的 2 就是前面这个函数的参数
a: a + a 2 # result is 4
# 还可以给函数命名,不过必须使用 let 表达式
let
f = a: a + a;
in
f 2 # result is 4
```
#### 内置函数
Nix 内置了一些函数,可通过 `builtins.<function-name>` 来调用,比如:
```nix
builtins.add 1 2 # result is 3
```
详细的内置函数列表参见 [Built-in Functions - Nix Reference Mannual](https://nixos.org/manual/nix/stable/language/builtins.html)
#### import 表达式
`import` 表达式以其他 nix 文件的路径作为参数,返回该 nix 文件的执行结果。
`import` 的参数如果为文件夹路径,那么会返回该文件夹下的 `default.nix` 文件的执行结果。
举个例子,首先创建一个 `file.nix` 文件:
```shell
$ echo "x: x + 1" > file.nix
```
然后使用 import 执行它:
```nix
import ./file.nix 1 # result is 2
```
#### pkgs.lib 函数包
除了 builtins 之外,Nix 的 nixpkgs 仓库还提供了一个名为 `lib` 的 attribute set,它包含了一些常用的函数,它通常被以如下的形式被使用:
```nix
let
pkgs = import <nixpkgs> {};
in
pkgs.lib.strings.toUpper "search paths considered harmful" # result is "SEARCH PATHS CONSIDERED HARMFUL"
```
可以通过 [Nixpkgs Library Functions - Nixpkgs Manual](https://nixos.org/manual/nixpkgs/stable/#sec-functions-library) 查看 lib 函数包的详细内容。
### 不纯
Nix 语言本身是纯函数式的,是纯的,也就是说它就跟数学中的函数一样,同样的输入永远得到同样的输出。
**Nix 唯一的不纯之处在这里:从文件系统路径或者其他输入源中读取文件作为构建任务的输入**
nix 的构建输入只有两种,一种是从文件系统路径等输入源中读取文件,另一种是将其他函数作为输入。
>nix 中的搜索路径与 `builtins.currentSystem` 也是不纯的,但是这两个功能都不建议使用,所以这里略过了。
### Fetchers
构建输入除了直接来自文件系统路径之外,还可以通过 Fetchers 来获取,Fetcher 是一种特殊的函数,它的输入是一个 attribute set,输出是 nix store 中的一个系统路径。
Nix 提供了四个内置的 Fetcher,分别是:
- `builtins.fetchurl`:从 url 中下载文件
- `builtins.fetchTarball`:从 url 中下载 tarball 文件
- `builtins.fetchGit`:从 git 仓库中下载文件
- `builtins.fetchClosure`:从 Nix store 中获取 derivation
举例:
```nix
builtins.fetchurl "https://github.com/NixOS/nix/archive/7c3ab5751568a0bc63430b33a5169c5e4784a0ff.tar.gz"
# result example => "/nix/store/7dhgs330clj36384akg86140fqkgh8zf-7c3ab5751568a0bc63430b33a5169c5e4784a0ff.tar.gz"
builtins.fetchTarball "https://github.com/NixOS/nix/archive/7c3ab5751568a0bc63430b33a5169c5e4784a0ff.tar.gz"
# result example(auto unzip the tarball) => "/nix/store/d59llm96vgis5fy231x6m7nrijs0ww36-source"
```
### Derivations
一个构建动作的 nix 语言描述被称做一个 Derivation,它描述了如何构建一个软件包,它的执行结果是一个 store object
在 Nix 语言的最底层,一个构建任务就是使用 builtins 中的不纯函数 `derivation` 创建的,我们实际使用的 `stdenv.mkDerivation` 就是它的一个 wrapper,屏蔽了底层的细节,简化了用法。
### stdenv.mkDerivation
stdenv,顾名思义即标准构建环境,它是一个 attribute set,提供了构建 Unix 程序所需的标准环境,比如 gcc、glibc、binutils 等等。
它可以完全取代我们在其他操作系统上常用的构建工具链,比如 `./configure`; `make`; `make install` 等等。
即使 stdenv 提供的环境不能满足你的要求,你也可以通过 `stdenv.mkDerivation` 来创建一个自定义的构建环境。
举个例子:
```nix
{ lib, stdenv }:
stdenv.mkDerivation rec {
pname = "libfoo";
version = "1.2.3";
# 源码
src = fetchurl {
url = "http://example.org/libfoo-source-${version}.tar.bz2";
sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m";
};
# 构建依赖
buildInputs = [libbar perl ncurses];
# Nix 默认将构建拆分为一系列 phases,这里仅用到其中两个
# https://nixos.org/manual/nixpkgs/stable/#ssec-controlling-phases
buildPhase = ''
gcc foo.c -o foo
'';
installPhase = ''
mkdir -p $out/bin
cp foo $out/bin
'';
}
```
## Override 与 Overlays
TODO
## Usfeful Flakes
those flakes are useful for flake development, but require more knowledge about nix modules, profiles, overlays, etc.
- [flake-parts](https://github.com/hercules-ci/flake-parts): Simplify Nix Flakes with the module system, useful to hold multiple system configurations in a single flake.
- [flake-utils-plus](https://github.com/gytis-ivaskevicius/flake-utils-plus): an more powerful utils for flake development.
- [github](https://github.com/divnix/digga): a powerful nix flake template to hold multiple host's configurations in a single flake.
[digga]: https://github.com/divnix/digga
[sway-nvidia]: https://github.com/crispyricepc/sway-nvidia
[New Nix Commands]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix.html
[Zero to Nix - Determinate Systems]: https://github.com/DeterminateSystems/zero-to-nix
+32 -19
View File
@@ -3,31 +3,44 @@
This repository is home to the nix code that builds my systems. This repository is home to the nix code that builds my systems.
## Screenshots
![](./_img/screenshot_2023-05-07-21-21.webp)
## TODO ## TODO
- vscode extensions - [sops-nix](https://github.com/Mic92/sops-nix): secret management
- secret management - [devShell](https://github.com/numtide/devshell): manage development environments
## How to install Nix and Deploy this Flake?
Nix can be used on Linux and MacOS, we have to method to install Nix:
1. [Official Way to Install Nix](https://nixos.org/download.html): writen in bash script, `nix-command` & `flake` are disabled by default till now (2023-04-23).
1. you need to follow [Enable flakes - NixOS Wiki](https://nixos.wiki/wiki/Flakes) to enable `flake` feature.
2. and it provide no method to uninstall nix automatically, you need to delte all resources & users & group(`nixbld`) manually.
2. [The Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer): writen mainly in Rust, enable `nix-command` & `flake` by default, and offer an easy way to uninstall Nix.
After installed Nix with `nix-command` & `flake` enabled, you can deploy this flake with the following command:
```bash
sudo nixos-rebuild switch .#nixos
```
## Why Nix? ## Why Nix?
Nix allows for easy to manage, collaborative, reproducible deployments. This means that once something is setup and configured once, it works forever. If someone else shares their configuration, anyone can make use of it. Nix allows for easy to manage, collaborative, reproducible deployments. This means that once something is setup and configured once, it works forever. If someone else shares their configuration, anyone can make use of it.
## References ## How to install Nix and Deploy this Flake?
- [Nix Flake Basics](./Nix_Flake_Basics.md) After installed NixOS with `nix-command` & `flake` enabled, you can deploy this flake with the following command:
```bash
# deploy my test configuration
sudo nixos-rebuild switch --flake .#nixos-test
# deploy my PC's configuration
rm -rf ~/.config/fcitx5/profile ~/.config/mimeapps.list # this file may be covered by fcitx5, so remove it first
sudo nixos-rebuild switch --flake .#msi-rtx4090
```
## Other Interesting Dotfiles
Other configurations from where I learned and copied:
- https://github.com/notwidow/hyprland
- https://github.com/notusknot/dotfiles-nix
- [xddxdd/nixos-config](https://github.com/xddxdd/nixos-config)
- [bobbbay/dotfiles](https://github.com/bobbbay/dotfiles)
- [gytis-ivaskevicius/nixfiles](https://github.com/gytis-ivaskevicius/nixfiles)
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles)
- [davidak/nixos-config](https://codeberg.org/davidak/nixos-config)
- [davidtwco/veritas](https://github.com/davidtwco/veritas)
- [NixOS-CN/NixOS-CN-telegram](https://github.com/NixOS-CN/NixOS-CN-telegram)
Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Generated
+259 -32
View File
@@ -1,28 +1,52 @@
{ {
"nodes": { "nodes": {
"flake-compat": { "flake-compat": {
"flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1680531544,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "narHash": "sha256-8qbiDTYb1kGaDADRXTItpcMKQ1TeQVkuof6oEwHUvVA=",
"owner": "edolstra", "owner": "nix-community",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "rev": "95e78dc12268c5e4878621845c511077f3798729",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "edolstra", "owner": "nix-community",
"repo": "flake-compat", "repo": "flake-compat",
"type": "github" "type": "github"
} }
}, },
"flake-utils": { "flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs-wayland",
"nix-eval-jobs",
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1680392223,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -38,11 +62,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1682176386, "lastModified": 1683459775,
"narHash": "sha256-xwYjQ8PjfdHlggi8Dq0PXWby/1oXegSUuNuBvoTcnpA=", "narHash": "sha256-Ab1pIKOj7XRZbJAv4g9937ElhaZF7Pob3hqGTDKt5w8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6169690ae38175295605d521bd778d999fbd85cd", "rev": "6fc82e56971523acfe1a61dbcb20f4bb969b3990",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -51,33 +75,93 @@
"type": "github" "type": "github"
} }
}, },
"nix-vscode-extensions": { "hyprland": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "hyprland-protocols": "hyprland-protocols",
"flake-utils": "flake-utils", "nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs" "wlroots": "wlroots",
"xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1683076311, "lastModified": 1683414693,
"narHash": "sha256-xGvR07+fR5g/89oVEQieKG/ZveGHZZyhxXcRouW0WCk=", "narHash": "sha256-TH7iHV4mcStMk0NzySOiKcUMY5tjmOM9VbdNHEanvSs=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "a31dceb2c623c41565193328f98b50694917e0bf",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1681065697,
"narHash": "sha256-QPzwwlGKX95tl6ZEshboZbEwwAXww6lNLdVYd6T9Mrc=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "4d29e48433270a2af06b8bc711ca1fe5109746cd",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1681214977,
"narHash": "sha256-pBaG4iKzF/YJQA06f87IZokB15Z13DYd6zsT/wlbWfI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-vscode-extensions", "repo": "lib-aggregate",
"rev": "70d48e0c7eafdbcdaa9dac6c17f46a88872f7285", "rev": "19d70ca7a81956bd01a768297b84798f301e150f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-vscode-extensions", "repo": "lib-aggregate",
"type": "github"
}
},
"nix-eval-jobs": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1682480188,
"narHash": "sha256-4LG8Vl/fLWsJg+QAb5/PvZTdLtPFsYFxuGDfEAR5szA=",
"owner": "nix-community",
"repo": "nix-eval-jobs",
"rev": "73ee1712faeb5db609fc9f991e2dc1de265acff5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-eval-jobs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1675763311, "lastModified": 1683014792,
"narHash": "sha256-bz0Q2H3mxsF1CUfk26Sl9Uzi8/HFjGFD/moZHz1HebU=", "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "fab09085df1b60d6a0870c8a89ce26d5a4a708c2", "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -87,13 +171,97 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1681920287, "lastModified": 1681001314,
"narHash": "sha256-+/d6XQQfhhXVfqfLROJoqj3TuG38CAeoT6jO1g9r1k0=", "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "367c0e1086a4eb4502b24d872cea2c7acdd557f4",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1683383741,
"narHash": "sha256-rAQSBnFGNKNomUUyVl+7v0tnp45677t4Ovlh9f57k6Q=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "645bc49f34fa8eff95479f0345ff57e55b53437e", "rev": "adc7c6f1bbaa73cda26be2323353b63a05b42f61",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-wayland": {
"inputs": {
"flake-compat": "flake-compat",
"lib-aggregate": "lib-aggregate",
"nix-eval-jobs": "nix-eval-jobs",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1683454517,
"narHash": "sha256-T3ObyRj1BsR0MZfIqZ/y8dSqRBeRBulrnWYiFQaz98o=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "e40b5d9061325d66acb598e0ae7038ca149d626d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1681347147,
"narHash": "sha256-B+hTioRc3Jdf4SJyeCiO0fW5ShIznJk2OTiW2vOV+mc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1a9d9175ecc48ecd033062fa09b1834d13ae9c69",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -106,12 +274,71 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-vscode-extensions": "nix-vscode-extensions", "hyprland": "hyprland",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-wayland": "nixpkgs-wayland"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1682436395,
"narHash": "sha256-GGEjkQO9m7YLYIXIXM76HWdhjg4Ye+oafOtyaFAYKI4=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "6830bfc17fd94709e2cdd4da0af989f102a26e59",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1682439384,
"narHash": "sha256-zHDa8LCZs05TZHQSIZ3ucwyMPglBGHcqTBzfkLjYXTM=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "c0e233955568fbea4e859336f6d3d14d51294d7c",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
} }
} }
}, },
"root": "root", "root": "root",
"version": 7 "version": 7
} }
+63 -7
View File
@@ -18,24 +18,41 @@
# nix community's cache server # nix community's cache server
extra-substituters = [ extra-substituters = [
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
# "https://nixos-cn.cachix.org"
]; ];
extra-trusted-public-keys = [ extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
# "nixos-cn.cachix.org-1:L0jEaL6w7kwQOPlLoCR3ADx+E3Q8SEFEcB9Jaibl0Xg="
]; ];
}; };
# 这是 flake.nix 的标准格式,inputs 是 flake 的依赖,outputs 是 flake 的输出 # 这是 flake.nix 的标准格式,inputs 是 flake 的依赖,outputs 是 flake 的输出
# inputs 中的每一项都被拉取、构建后,被作为参数传递给 outputs 函数 # inputs 中的每一项都被拉取、构建后,被作为参数传递给 outputs 函数
inputs = { inputs = {
# 以 url 的形式指定依赖,flake 会自动拉取、构建 # 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 版本不一致导致问题
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
# vscode 插件库 # modern window compositor
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; hyprland.url = "github:hyprwm/Hyprland";
# community wayland nixpkgs
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# # nixos-cn 提供了一些国内常用的程序包,如 qq wechat dingtalk 等
# nixos-cn = {
# url = "github:nixos-cn/flakes";
# # 强制 nixos-cn 和该 flake 使用相同版本的 nixpkgs
# inputs.nixpkgs.follows = "nixpkgs";
# };
}; };
# outputs 的参数都是 inputs 中定义的依赖项,可以通过它们的名称来引用。 # outputs 的参数都是 inputs 中定义的依赖项,可以通过它们的名称来引用。
@@ -44,14 +61,15 @@
outputs = inputs@{ outputs = inputs@{
self, self,
nixpkgs, nixpkgs,
nixpkgs-stable,
home-manager, home-manager,
nix-vscode-extensions, # nixos-cn,
... ...
}: { }: {
# 名为 nixosConfigurations 的 outputs 会在执行 `nixos-rebuild switch --flake .` 时被使用 # 名为 nixosConfigurations 的 outputs 会在执行 `nixos-rebuild switch --flake .` 时被使用
# 默认情况下会使用与主机 hostname 同名的 nixosConfigurations,但是也可以通过 `--flake .#<name>` 来指定 # 默认情况下会使用与主机 hostname 同名的 nixosConfigurations,但是也可以通过 `--flake .#<name>` 来指定
nixosConfigurations = { nixosConfigurations = {
# hostname 为 nixos 的主机会使用这个配置 # hostname 为 nixos-test 的主机会使用这个配置
# 这里使用了 nixpkgs.lib.nixosSystem 函数来构建配置,后面的 attributes set 是它的参数 # 这里使用了 nixpkgs.lib.nixosSystem 函数来构建配置,后面的 attributes set 是它的参数
# 在 nixos 上使用此命令部署配置:`nixos-rebuild switch --flake .#nixos-test` # 在 nixos 上使用此命令部署配置:`nixos-rebuild switch --flake .#nixos-test`
nixos-test = nixpkgs.lib.nixosSystem { nixos-test = nixpkgs.lib.nixosSystem {
@@ -69,8 +87,45 @@
# #
# nix flake 的 modules 系统可将配置模块化,提升配置的可维护性 # nix flake 的 modules 系统可将配置模块化,提升配置的可维护性
# 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs # 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs
specialArgs = {
# inherit nixos-cn;
inherit nixpkgs-stable;
};
modules = [ modules = [
./hosts ./hosts/nixos-test
# home-manager 作为 nixos 的一个 module
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
home-manager.extraSpecialArgs = inputs;
home-manager.users.ryan = import ./home;
}
({pkgs, config, ... }: {
config = {
# use it as an overlay
nixpkgs.overlays = [
inputs.nixpkgs-wayland.overlay
];
};
})
];
};
msi-rtx4090 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
# inherit nixos-cn;
inherit nixpkgs-stable;
};
modules = [
./hosts/msi-rtx4090
# home-manager 作为 nixos 的一个 module # home-manager 作为 nixos 的一个 module
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令 # 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
@@ -86,6 +141,7 @@
]; ];
}; };
# 如果你在 x86_64-linux 平台上执行 nix build,那么默认会使用这个配置,或者也能通过 `.#<name>` 参数来指定非 default 的配置 # 如果你在 x86_64-linux 平台上执行 nix build,那么默认会使用这个配置,或者也能通过 `.#<name>` 参数来指定非 default 的配置
# packages.x86_64-linux.default = # packages.x86_64-linux.default =
}; };
+35
View File
@@ -0,0 +1,35 @@
{ lib, stdenvNoCC, fetchgit }:
stdenvNoCC.mkDerivation rec {
pname = "archcraft-font";
version = "2023-05-07";
src = fetchgit {
url = "https://github.com/archcraft-os/archcraft-packages.git";
rev = "88030ee6d2df80db958541b53bd3673e081720cf"; # git commit id
sparseCheckout = [ "archcraft-fonts/files/icon-fonts/archcraft.ttf" ]; # only fetch the feather.ttf file
# the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
# so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
# specify sha256 to empty and build it, then an error will indicate the correct sha256
sha256 = "sha256-DrGN8lN4Yr1RTyCUZhJjzKgCuC0vTnSWjOKovNg3T/U=";
};
installPhase = ''
runHook preInstall
install -Dm644 archcraft-fonts/files/icon-fonts/archcraft.ttf -t $out/share/fonts/truetype/
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/archcraft-os/archcraft-packages";
description = "Archcraft icon font";
version = version;
longDescription = ''Archcraft icon font'';
license = licenses.mit;
maintainers = [ maintainers.ryan4yin ];
platforms = platforms.all;
};
}
+39
View File
@@ -0,0 +1,39 @@
{ lib, stdenvNoCC, fetchgit }:
stdenvNoCC.mkDerivation rec {
pname = "icomoon-feather-font";
version = "2023-05-06";
# 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather
src = fetchgit {
url = "https://github.com/adi1090x/polybar-themes.git";
rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id
sparseCheckout = [ "fonts/feather.ttf" ]; # only fetch the feather.ttf file
# the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
# so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
# specify sha256 to empty and build it, then an error will indicate the correct sha256
sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4=";
};
installPhase = ''
runHook preInstall
install -Dm644 fonts/feather.ttf -t $out/share/fonts/truetype/
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/feathericons/feather";
description = "Icomoon feather font";
version = version;
longDescription = ''
Feather is a collection of simply beautiful open source icons.
Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.
'';
license = licenses.mit;
maintainers = [ maintainers.ryan4yin ];
platforms = platforms.all;
};
}
+1 -2
View File
@@ -3,8 +3,7 @@
{ {
imports = [ imports = [
./fcitx5 ./hyprland
./i3
./programs ./programs
./rofi ./rofi
./shell ./shell
-24
View File
@@ -1,24 +0,0 @@
{ config, pkgs, ... }:
{
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons =
let
# 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
config.packageOverrides = pkgs: {
fcitx5-rime = pkgs.fcitx5-rime.override {rimeDataPkgs = [
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
./rime-data-flypy
];};
};
in
with pkgs; [
fcitx5-rime
fcitx5-configtool
fcitx5-chinese-addons
];
};
}
+48
View File
@@ -0,0 +1,48 @@
{
pkgs,
config,
...
}: {
# hyprland configs, based on https://github.com/notwidow/hyprland
home.file.".config/hypr" = {
source = ./hypr-conf;
# copy the scripts directory recursively
recursive = true;
};
home.file.".config/gtk-3.0" = {
source = ./gtk-3.0;
recursive = true;
};
home.file.".gtkrc-2.0".source = ./gtkrc-2.0;
home.file.".config/hypr/wallpapers/wallpaper.png".source = ../wallpapers/wallpaper.png;
home.file.".config/fcitx5" = {
source = ./fcitx5;
recursive = true;
};
# allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true;
systemd.user.sessionVariables = {
"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
"MOZ_WEBRENDER" = "1";
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
"LIBVA_DRIVER_NAME" = "nvidia";
"XDG_SESSION_TYPE" = "wayland";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"WLR_NO_HARDWARE_CURSORS" = "1";
"WLR_EGL_NO_MODIFIRES" = "1";
# copy from https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
GLFW_IM_MODULE = "fcitx";
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx";
};
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
# Hidden Notifications
HiddenNotifications=
+75
View File
@@ -0,0 +1,75 @@
[Hotkey]
# Enumerate when press trigger key repeatedly
EnumerateWithTriggerKeys=True
# Skip first input method while enumerating
EnumerateSkipFirst=False
[Hotkey/TriggerKeys]
0=Control+space
1=Zenkaku_Hankaku
2=Hangul
[Hotkey/AltTriggerKeys]
0=Shift_L
[Hotkey/EnumerateForwardKeys]
0=Control+Shift_L
[Hotkey/EnumerateBackwardKeys]
0=Control+Shift_R
[Hotkey/EnumerateGroupForwardKeys]
0=Super+space
[Hotkey/EnumerateGroupBackwardKeys]
0=Shift+Super+space
[Hotkey/ActivateKeys]
0=Hangul_Hanja
[Hotkey/DeactivateKeys]
0=Hangul_Romaja
[Hotkey/PrevPage]
0=Up
[Hotkey/NextPage]
0=Down
[Hotkey/PrevCandidate]
0=Shift+Tab
[Hotkey/NextCandidate]
0=Tab
[Hotkey/TogglePreedit]
0=Control+Alt+P
[Behavior]
# Active By Default
ActiveByDefault=False
# Share Input State
ShareInputState=No
# Show preedit in application
PreeditEnabledByDefault=True
# Show Input Method Information when switch input method
ShowInputMethodInformation=True
# Show Input Method Information when changing focus
showInputMethodInformationWhenFocusIn=False
# Show compact input method information
CompactInputMethodInformation=True
# Show first input method information
ShowFirstInputMethodInformation=True
# Default page size
DefaultPageSize=5
# Override Xkb Option
OverrideXkbOption=False
# Custom Xkb Option
CustomXkbOption=
# Force Enabled Addons
EnabledAddons=
# Force Disabled Addons
DisabledAddons=
# Preload input method to be used by default
PreloadInputMethod=True
+22
View File
@@ -0,0 +1,22 @@
[Groups/0]
# Group Name
Name=Other
# Layout
Default Layout=us
# Default Input Method
DefaultIM=rime
[Groups/0/Items/0]
# Name
Name=rime
# Layout
Layout=
[Groups/0/Items/1]
# Name
Name=keyboard-us
# Layout
Layout=
[GroupOrder]
0=Other
+16
View File
@@ -0,0 +1,16 @@
[Settings]
gtk-theme-name=Arc-Dark
gtk-icon-theme-name=Qogir-dark
gtk-font-name=Noto Sans 10
gtk-cursor-theme-name=Qogir-dark
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintmedium
gtk-xft-rgba=rgb
+19
View File
@@ -0,0 +1,19 @@
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
include "~/.gtkrc-2.0.mine"
gtk-theme-name="Arc-Dark"
gtk-icon-theme-name="Qogir-dark"
gtk-font-name="Noto Sans 10"
gtk-cursor-theme-name="Qogir-dark"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintmedium"
gtk-xft-rgba="rgb"
+200
View File
@@ -0,0 +1,200 @@
## Hyprland configuration file for Archcraft
#-- Output ----------------------------------------------------
# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info.
# format:
# monitor=name,resolution,position,scale
monitor=DP-2,3840x2160@144,0x0,1.6
workspace=DP-2,1
#-- Input ----------------------------------------------------
# Configure mouse and touchpad here.
input {
kb_layout=us
kb_variant=
kb_model=
kb_options=
kb_rules=
follow_mouse=1
natural_scroll=0
force_no_accel=0
# repeat_rate=
# repeat_delay=
numlock_by_default=1
}
#-- General ----------------------------------------------------
# General settings like MOD key, Gaps, Colors, etc.
general {
sensitivity=2.0
apply_sens_to_raw=0
gaps_in=5
gaps_out=10
border_size=4
col.active_border=0xFFB4A1DB
col.inactive_border=0xFF343A40
}
#-- Decoration ----------------------------------------------------
# Decoration settings like Rounded Corners, Opacity, Blur, etc.
decoration {
rounding=8 # Original: rounding=-1
multisample_edges=0
active_opacity=1.0
inactive_opacity=0.9
fullscreen_opacity=1.0
blur=0
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
blur_ignore_opacity=0
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
}
#-- Animations ----------------------------------------------------
animations {
enabled=1
animation=windows,1,8,default,popin 80%
animation=fadeOut,1,8,default
animation=fadeIn,1,8,default
animation=workspaces,1,8,default
#animation=workspaces,1,6,overshot
}
#-- Dwindle ----------------------------------------------------
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
#-- Window Rules ----------------------------------------------------
windowrule=float,foot-float
windowrule=float,yad|nm-connection-editor|pavucontrolk
windowrule=float,xfce-polkit|kvantummanager|qt5ct
windowrule=float,feh|imv|Gpicview|Gimp|nomacs
windowrule=float,VirtualBox Manager|qemu|Qemu-system-x86_64
windowrule=float,xfce4-appfinder
windowrule=float,foot-full
windowrule=move 0 0,foot-full
windowrule=size 100% 100%,foot-full
windowrule=float,wlogout
windowrule=move 0 0,wlogout
windowrule=size 100% 100%,wlogout
windowrule=animation slide,wlogout
#-- Keybindings ----------------------------------------------------
$term = alacritty
$app_launcher = ~/.config/hypr/scripts/menu
$volume = ~/.config/hypr/scripts/volume
$backlight = ~/.config/hypr/scripts/brightness
$screenshot = ~/.config/hypr/scripts/screenshot
$lockscreen = ~/.config/hypr/scripts/lockscreen
$wlogout = ~/.config/hypr/scripts/wlogout
$colorpicker = ~/.config/hypr/scripts/colorpicker
$files = thunar
$editor = code # vscode
$browser = firefox
# -- Terminal --
bind=SUPER,Return,exec,$term
# -- Wofi --
bind=SUPER,D,exec,$app_launcher
# -- Hyprland --
bind=SUPER,Q,killactive,
bind=CTRLALT,Delete,exit,
bind=SUPER,F,fullscreen,
bind=SUPER,Space,togglefloating,
bind=SUPER,S,pseudo,
# -- Misc --
bind=SUPER,N,exec,nm-connection-editor # need install network-manager-applet
bind=SUPER,P,exec,$colorpicker
bind=CTRLALT,L,exec,$lockscreen
bind=SUPERSHIFT,X,exec,$wlogout
# -- Some nice mouse binds --
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow
# -- Function keys --
bind=,XF86MonBrightnessUp,exec,$backlight --inc
bind=,XF86MonBrightnessDown,exec,$backlight --dec
bind=,XF86AudioRaiseVolume,exec,$volume --inc
bind=,XF86AudioLowerVolume,exec,$volume --dec
bind=,XF86AudioMute,exec,$volume --toggle
bind=,XF86AudioMicMute,exec,$volume --toggle-mic
bind=,XF86AudioNext,exec,mpc next
bind=,XF86AudioPrev,exec,mpc prev
bind=,XF86AudioPlay,exec,mpc toggle
bind=,XF86AudioStop,exec,mpc stop
# -- Screenshots --
bind=,Print,exec,$screenshot --now
bind=SUPER,Print,exec,$screenshot --win
bind=CTRL,Print,exec,$screenshot --area
# Focus
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
# Move
bind=SUPERSHIFT,left,movewindow,l
bind=SUPERSHIFT,right,movewindow,r
bind=SUPERSHIFT,up,movewindow,u
bind=SUPERSHIFT,down,movewindow,d
# Resize
bind=SUPERCTRL,left,resizeactive,-20 0
bind=SUPERCTRL,right,resizeactive,20 0
bind=SUPERCTRL,up,resizeactive,0 -20
bind=SUPERCTRL,down,resizeactive,0 20
# Workspaces
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
# Send to Workspaces
bind=SUPERSHIFT,1,movetoworkspace,1
bind=SUPERSHIFT,2,movetoworkspace,2
bind=SUPERSHIFT,3,movetoworkspace,3
bind=SUPERSHIFT,4,movetoworkspace,4
bind=SUPERSHIFT,5,movetoworkspace,5
bind=SUPERSHIFT,6,movetoworkspace,6
bind=SUPERSHIFT,7,movetoworkspace,7
bind=SUPERSHIFT,8,movetoworkspace,8
bind=SUPERSHIFT,9,movetoworkspace,9
bind=SUPERSHIFT,0,movetoworkspace,10
bind=SUPER,mouse_down,workspace,e+1
bind=SUPER,mouse_up,workspace,e-1
#-- Startup ----------------------------------------------------
exec-once=~/.config/hypr/scripts/startup
#-- Fcitx5 input method ----------------------------------------------------
windowrule=pseudo,fcitx
exec-once=fcitx5-remote -r
exec-once=fcitx5 -d --replace
exec-once=fcitx5-remote -r
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
+56
View File
@@ -0,0 +1,56 @@
## Mako configuration file
# GLOBAL CONFIGURATION OPTIONS
max-history=100
sort=-time
# BINDING OPTIONS
on-button-left=dismiss
on-button-middle=none
on-button-right=dismiss-all
on-touch=dismiss
on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga
# STYLE OPTIONS
font=JetBrains Mono 10
width=300
height=100
margin=10
padding=15
border-size=2
border-radius=0
icons=1
max-icon-size=48
icon-location=left
markup=1
actions=1
history=1
text-alignment=left
default-timeout=5000
ignore-timeout=0
max-visible=5
layer=overlay
anchor=top-right
background-color=#1e1e2e
text-color=#d9e0ee
border-color=#313244
progress-color=over #89b4fa
[urgency=low]
border-color=#313244
default-timeout=2000
[urgency=normal]
border-color=#313244
default-timeout=5000
[urgency=high]
border-color=#f38ba8
text-color=#f38ba8
default-timeout=0
[category=mpd]
border-color=#f9e2af
default-timeout=2000
group-by=category
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
## Script To Manage Brightness For Archcraft (in Wayland).
iDIR="$HOME/.config/hypr/mako/icons"
# Get brightness
get_backlight() {
LIGHT=$(printf "%.0f\n" $(light -G))
echo "${LIGHT}%"
}
# Get icons
get_icon() {
backlight="$(get_backlight)"
current="${backlight%%%}"
if [[ ("$current" -ge "0") && ("$current" -le "20") ]]; then
icon="$iDIR/brightness-20.png"
elif [[ ("$current" -ge "20") && ("$current" -le "40") ]]; then
icon="$iDIR/brightness-40.png"
elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then
icon="$iDIR/brightness-60.png"
elif [[ ("$current" -ge "60") && ("$current" -le "80") ]]; then
icon="$iDIR/brightness-80.png"
elif [[ ("$current" -ge "80") && ("$current" -le "100") ]]; then
icon="$iDIR/brightness-100.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Brightness : $(get_backlight)"
}
# Increase brightness
inc_backlight() {
light -A 5 && get_icon && notify_user
}
# Decrease brightness
dec_backlight() {
light -U 5 && get_icon && notify_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_backlight
elif [[ "$1" == "--inc" ]]; then
inc_backlight
elif [[ "$1" == "--dec" ]]; then
dec_backlight
else
get_backlight
fi
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
## Simple Script To Pick Color Quickly.
color=$(grim -g "$(slurp -b 1B1F2800 -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
image=/tmp/${color}.png
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo $color | tr -d "\n" | wl-copy
# generate preview
convert -size 48x48 xc:"$color" ${image}
# notify about it
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i ${image} "$color, copied to clipboard."
fi
}
# Run the script
main
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Times the screen off and puts it to background
swayidle \
timeout 300 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' &
# Locks the screen immediately
swaylock
# Kills last background task so idle timer doesn't keep running
kill %%
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
## launch wofi with alt config
CONFIG="$HOME/.config/hypr/wofi/config"
STYLE="$HOME/.config/hypr/wofi/style.css"
COLORS="$HOME/.config/hypr/wofi/colors"
if [[ ! $(pidof wofi) ]]; then
wofi --show drun --prompt 'Search...' --conf ${CONFIG} --style ${STYLE} --color ${COLORS}
else
pkill wofi
fi
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
## launch mako with alt config
CONFIG="$HOME/.config/hypr/mako/config"
if [[ ! $(pidof mako) ]]; then
mako --config ${CONFIG}
fi
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
## Script to take screenshots with grim, slurp (in Wayland)
iDIR="$HOME/.config/hypr/mako/icons"
time=$(date +%Y-%m-%d-%H-%M-%S)
dir="$(xdg-user-dir PICTURES)/Screenshots" # need
file="Screenshot_${time}_${RANDOM}.png"
# notify and view screenshot
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png"
notify_view () {
${notify_cmd_shot} "Copied to clipboard."
imv ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
else
${notify_cmd_shot} "Screenshot Deleted."
fi
}
# take shots
shotnow () {
cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shotwin () {
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
cd ${dir} && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
notify_view
}
shotarea () {
cd ${dir} && grim -g "$(slurp -b 1B1F28CC -c E06B74ff -s C778DD0D -w 2)" - | tee "$file" | wl-copy
notify_view
}
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--area" ]]; then
shotarea
elif [[ "$1" == "--win" ]]; then
shotwin
else
echo -e "Available Options : --now --win --area"
fi
exit 0
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
## Autostart Programs
# Kill already running process
_ps=(waybar mako mpd)
for _prs in "${_ps[@]}"; do
if [[ $(pidof ${_prs}) ]]; then
killall -9 ${_prs}
fi
done
# Set wallpaper
swaybg --output '*' --mode fill --image ~/.config/hypr/wallpapers/wallpaper.png &
# Lauch notification daemon (mako)
~/.config/hypr/scripts/notifications &
# Lauch statusbar (waybar)
~/.config/hypr/scripts/statusbar &
# Start mpd
exec mpd &
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
## launch waybar with alt config
CONFIG="$HOME/.config/hypr/waybar/config"
STYLE="$HOME/.config/hypr/waybar/style.css"
if [[ ! $(pidof waybar) ]]; then
waybar --bar main-bar --log-level error --config ${CONFIG} --style ${STYLE}
fi
+76
View File
@@ -0,0 +1,76 @@
#!/usr/bin/env bash
## Script To Manage Speaker Volume For Archcraft (in Wayland).
iDIR="$HOME/.config/hypr/mako/icons"
# Get Volume
get_volume() {
volume=$(amixer get Master | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]')
echo "$volume"
}
# Get icons
get_icon() {
vol="$(get_volume)"
current="${vol%%%}"
if [[ "$current" -eq "0" ]]; then
icon="$iDIR/volume-mute.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
icon="$iDIR/volume-low.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
icon="$iDIR/volume-mid.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
icon="$iDIR/volume-high.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Volume : $(get_volume)"
}
# Increase Volume
inc_volume() {
amixer -Mq set Master,0 5%+ unmute && get_icon && notify_user
}
# Decrease Volume
dec_volume() {
amixer -Mq set Master,0 5%- unmute && get_icon && notify_user
}
# Toggle Mute
toggle_mute() {
amixer get Master | grep '\[on\]' &>/dev/null
if [[ "$?" == 0 ]]; then
amixer set Master toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Mute"
else
amixer set Master toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Unmute"
fi
}
# Toggle Mic
toggle_mic() {
amixer get Capture | grep '\[on\]' &>/dev/null
if [[ "$?" == 0 ]]; then
amixer -D pulse sset Capture toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
else
amixer -D pulse sset Capture toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
fi
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_volume
elif [[ "$1" == "--inc" ]]; then
inc_volume
elif [[ "$1" == "--dec" ]]; then
dec_volume
elif [[ "$1" == "--toggle" ]]; then
toggle_mute
elif [[ "$1" == "--toggle-mic" ]]; then
toggle_mic
else
get_volume
fi
+120
View File
@@ -0,0 +1,120 @@
#!/usr/bin/env python
import subprocess
from pyquery import PyQuery # install using `pip install pyquery`
import json
# weather icons
weather_icons = {
"sunnyDay": "滛",
"clearNight": "望",
"cloudyFoggyDay": "",
"cloudyFoggyNight": "",
"rainyDay": "",
"rainyNight": "",
"snowyIcyDay": "",
"snowyIcyNight": "",
"severe": "",
"default": "",
}
# get location_id
# to get your own location_id, go to https://weather.com & search your location.
# once you choose your location, you can see the location_id in the URL(64 chars long hex string)
# Shenzen, Guangdong's location id: https://weather.com/en-IN/weather/today/l/7a4684e0789c881e79935986f2e9e5ab05b0104ac4310fd8818006dfb66092c3
location_id = "7a4684e0789c881e79935986f2e9e5ab05b0104ac4310fd8818006dfb66092c3"
# get html page
url = "https://weather.com/en-IN/weather/today/l/" + location_id
html_data = PyQuery(url=url)
# current temperature
temp = html_data("span[data-testid='TemperatureValue']").eq(0).text()
# print(temp)
# current status phrase
status = html_data("div[data-testid='wxPhrase']").text()
status = f"{status[:16]}.." if len(status) > 17 else status
# print(status)
# status code
status_code = html_data("#regionHeader").attr("class").split(" ")[2].split("-")[2]
# print(status_code)
# status icon
icon = (
weather_icons[status_code]
if status_code in weather_icons
else weather_icons["default"]
)
# print(icon)
# temperature feels like
temp_feel = html_data(
"div[data-testid='FeelsLikeSection'] > span[data-testid='TemperatureValue']"
).text()
temp_feel_text = f"Feels like {temp_feel}c"
# print(temp_feel_text)
# min-max temperature
temp_min = (
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
.eq(0)
.text()
)
temp_max = (
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
.eq(1)
.text()
)
temp_min_max = f" {temp_min}\t\t {temp_max}"
# print(temp_min_max)
# wind speed
wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1]
wind_text = f"煮 {wind_speed}"
# print(wind_text)
# humidity
humidity = html_data("span[data-testid='PercentageValue']").text()
humidity_text = f" {humidity}"
# print(humidity_text)
# visibility
visbility = html_data("span[data-testid='VisibilityValue']").text()
visbility_text = f" {visbility}"
# print(visbility_text)
# air quality index
air_quality_index = html_data("text[data-testid='DonutChartValue']").text()
# print(air_quality_index)
# hourly rain prediction
prediction = html_data("section[aria-label='Hourly Forecast']")(
"div[data-testid='SegmentPrecipPercentage'] > span"
).text()
prediction = prediction.replace("Chance of Rain", "")
prediction = f"\n\n  (hourly) {prediction}" if len(prediction) > 0 else prediction
# print(prediction)
# tooltip text
tooltip_text = str.format(
"\t\t{}\t\t\n{}\n{}\n{}\n\n{}\n{}\n{}{}",
f'<span size="xx-large">{temp}</span>',
f"<big>{icon}</big>",
f"<big>{status}</big>",
f"<small>{temp_feel_text}</small>",
f"<big>{temp_min_max}</big>",
f"{wind_text}\t{humidity_text}",
f"{visbility_text}\tAQI {air_quality_index}",
f"<i>{prediction}</i>",
)
# print waybar module data
out_data = {
"text": f"{icon} {temp}",
"alt": status,
"tooltip": tooltip_text,
"class": status_code,
}
print(json.dumps(out_data))
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
## wlogout with alt layout and style file
LAYOUT="$HOME/.config/hypr/wlogout/layout"
STYLE="$HOME/.config/hypr/wlogout/style.css"
if [[ ! $(pidof wlogout) ]]; then
wlogout --layout ${LAYOUT} --css ${STYLE} \
--column-spacing 20 \
--row-spacing 20 \
--margin-top 200 \
--margin-bottom 200 \
--margin-left 150 \
--margin-right 150
else
pkill wlogout
fi
+222
View File
@@ -0,0 +1,222 @@
{
"name": "main-bar",
"id": "main-bar",
"layer": "top",
"mode": "dock",
"exclusive": true,
"passthrough": false,
"height": 32,
"spacing": 6,
"margin": 0,
"margin-top": 0,
"margin-bottom": 0,
"margin-left": 0,
"margin-right": 0,
"fixed-center": true,
"ipc": true,
"modules-left": [
"custom/menu",
"wlr/workspaces",
"cpu",
"memory",
"disk"
],
"modules-center": [
"mpd",
"tray"
],
"modules-right": [
"pulseaudio",
"custom/weather",
"network",
"battery",
"clock",
"custom/power"
],
// waybar-backlight
"backlight": {
"interval": 2,
"align": 0,
"rotate": 0,
//"device": "amdgpu_bl0",
"format": "{icon} {percent}%",
"format-icons": [
"",
"",
"",
""
],
// Commands to execute on events
"on-click": "",
"on-click-middle": "",
"on-click-right": "",
"on-update": "",
"on-scroll-up": "light -A 5%",
"on-scroll-down": "light -U 5%",
"smooth-scrolling-threshold": 1,
},
"wlr/workspaces": {
"format": "{icon}",
"on-click": "activate",
"all-outputs": true,
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "ﭮ",
"6": "",
"7": "",
"8": "",
"9": "",
"10": "﮼",
"focused": "",
"default": ""
}
},
// waybar-battery
"battery": {
"interval": 60,
"align": 0,
"rotate": 0,
//"bat": "BAT1",
//"adapter": "ACAD",
"full-at": 100,
"design-capacity": false,
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-full": "{icon} Full",
//"format-good": "",
"format-alt": "{icon} {time}",
"format-icons": [
"",
"",
"",
"",
""
],
"format-time": "{H}h {M}min",
"tooltip": true,
},
// waybar-clock
"clock": {
"interval": 60,
"align": 0,
"rotate": 0,
"tooltip-format": "<big>{:%B %Y}</big>\n<tt><small>{calendar}</small></tt>",
"format": " {:%H:%M}",
"format-alt": " {:%a %b %d, %G}"
},
// waybar-cpu
"cpu": {
"interval": 5,
"format": " LOAD: {usage}%",
},
// waybar-custom
"custom/menu": {
"format": "",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/menu",
},
"custom/power": {
"format": " ",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/wlogout",
},
// waybar-disk
"disk": {
"interval": 30,
"format": " FREE: {free}",
},
// waybar-memory
"memory": {
"interval": 10,
"format": " USED: {used:0.1f}G",
},
// waybar-mpd
"mpd": {
"interval": 2,
"unknown-tag": "N/A",
"format": "{stateIcon} {artist} - {title}",
"format-disconnected": " Disconnected",
"format-paused": "{stateIcon} {artist} - {title}",
"format-stopped": "Stopped ",
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)",
// Commands to execute on events
"on-click": "mpc toggle",
"on-click-middle": "mpc prev",
"on-click-right": "mpc next",
"on-update": "",
"on-scroll-up": "mpc seek +00:00:01",
"on-scroll-down": "mpc seek -00:00:01",
"smooth-scrolling-threshold": 1,
},
// waybar-network
"network": {
"interval": 5,
//"interface": "wlan*", // (Optional) To force the use of this interface, set it for netspeed to work
"format-wifi": " {essid}",
"format-ethernet": " {ipaddr}/{cidr}",
"format-linked": " {ifname} (No IP)",
"format-disconnected": "睊 Disconnected",
"format-disabled": "睊 Disabled",
"format-alt": " {bandwidthUpBits} |  {bandwidthDownBits}",
"tooltip-format": " {ifname} via {gwaddr}",
},
// weather-custom
"custom/weather": {
// "format": "{}",
// "format-alt": "{alt}: {}",
"format-alt-click": "click-right",
"interval": 300,
"return-type": "json",
"exec": "~/.config/hypr/scripts/weather",
// "on-click": "xdg-open https://weather.com/en-IN/weather/today/l/$(location_id)"
},
// waybar-pulseaudio
"pulseaudio": {
//"format": "{volume}% {icon} {format_source}",
"format": "{icon} {volume}%",
"format-muted": " Mute",
"format-bluetooth": " {volume}% {format_source}",
"format-bluetooth-muted": " Mute",
"format-source": " {volume}%",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": [
"",
"",
""
]
},
"scroll-step": 5.0,
// Commands to execute on events
"on-click": "amixer set Master toggle",
"on-click-right": "pavucontrol",
"smooth-scrolling-threshold": 1,
},
// waybar-tray
"tray": {
"icon-size": 16,
"spacing": 10
}
}
+216
View File
@@ -0,0 +1,216 @@
/** ********** Fonts ********** **/
* {
font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif;
font-size: 12px;
}
/** ********** Waybar Window ********** **/
window#waybar {
background-color: #1e1e2e;
color: #1e1e2e;
border-bottom: 2px solid #313244;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.5;
}
/** ********** Backlight ********** **/
#backlight {
background-color: #cba6f7;
}
/** ********** Battery ********** **/
#battery {
background-color: #f9e2af;
}
#battery.charging {
}
#battery.plugged {
}
@keyframes blink {
to {
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f38ba8;
color: #f38ba8;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/** ********** Clock ********** **/
#clock {
background-color: #a6e3a1;
}
/** ********** CPU ********** **/
#cpu {
background-color: #89dceb;
}
/** ********** Memory ********** **/
#memory {
background-color: #eba0ac;
}
/** ********** Disk ********** **/
#disk {
background-color: #b4befe;
}
/** ********** Tray ********** **/
#tray {
background-color: #cdd6f4;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
}
#tray > .active {
}
/** ********** MPD ********** **/
#mpd {
background-color: #94e2d5;
}
#mpd.disconnected {
background-color: #f38ba8;
}
#mpd.stopped {
background-color: #f5c2e7;
}
#mpd.playing {
background-color: #74c7ec;
}
#mpd.paused {
}
/** ********** Pulseaudio ********** **/
#pulseaudio {
background-color: #fab387;
}
#pulseaudio.bluetooth {
background-color: #f5c2e7;
}
#pulseaudio.muted {
background-color: #313244;
color: #cdd6f4;
}
/** ********** Network ********** **/
#network {
background-color: #89b4fa;
}
#network.disconnected,#network.disabled {
background-color: #313244;
color: #cdd6f4;
}
#network.linked {
}
#network.ethernet {
}
#network.wifi {
}
/** ********** Custom ********** **/
#custom-menu, #custom-power, #custom-weather, #custom-updater {
border-radius: 4px;
margin: 6px 0px;
padding: 2px 8px;
}
#custom-menu {
background-color: #f5c2e7;
margin-left: 6px;
padding: 2px 6px;
font-size: 16px;
}
#custom-power {
background-color: #f38ba8;
margin-right: 6px;
padding: 2px 8px;
font-size: 16px;
}
#custom-updater {
background-color: #e6ed7b;
margin-right: 6px;
padding: 2px 8px;
font-size: 12px;
}
/** Common style **/
#backlight,
#battery,
#clock,
#cpu,
#disk,
#mode,
#memory,
#mpd,
#tray,
#pulseaudio,
#network {
border-radius: 4px;
margin: 6px 0px;
padding: 2px 8px;
}
/** ********** Weather ********** **/
#custom-weather {
background-color: #5d388b;
margin-right: 6px;
padding: 2px 8px;
font-size: 12px;
}
#custom-weather.severe {
color: #eb937d;
}
#custom-weather.sunnyDay {
color: #c2ca76;
}
#custom-weather.clearNight {
color: #2b2b2a;
}
#custom-weather.cloudyFoggyDay, #custom-weather.cloudyFoggyNight {
color: #c2ddda;
}
#custom-weather.rainyDay, #custom-weather.rainyNight {
color: #5aaca5;
}
#custom-weather.showyIcyDay, #custom-weather.snowyIcyNight {
color: #d6e7e5;
}
#custom-weather.default {
color: #dbd9d8;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

+36
View File
@@ -0,0 +1,36 @@
{
"label" : "lock",
"action" : "~/.config/hypr/scripts/lockscreen",
"text" : "Lock",
"keybind" : "l"
}
{
"label" : "hibernate",
"action" : "systemctl hibernate",
"text" : "Hibernate",
"keybind" : "h"
}
{
"label" : "logout",
"action" : "loginctl terminate-user $USER",
"text" : "Logout",
"keybind" : "e"
}
{
"label" : "shutdown",
"action" : "systemctl poweroff",
"text" : "Shutdown",
"keybind" : "s"
}
{
"label" : "suspend",
"action" : "systemctl suspend",
"text" : "Suspend",
"keybind" : "u"
}
{
"label" : "reboot",
"action" : "systemctl reboot",
"text" : "Reboot",
"keybind" : "r"
}
+52
View File
@@ -0,0 +1,52 @@
/** ********** Fonts ********** **/
* {
font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif;
font-size: 14px;
font-weight: bold;
}
/** ********** Main Window ********** **/
window {
background-color: #1E1E2E;
}
/** ********** Buttons ********** **/
button {
background-color: #242434;
color: #FFFFFF;
border: 2px solid #282838;
border-radius: 20px;
background-repeat: no-repeat;
background-position: center;
background-size: 35%;
}
button:focus, button:active, button:hover {
background-color: #89B4FA;
outline-style: none;
}
/** ********** Icons ********** **/
#lock {
background-image: image(url("icons/lock.png"), url("/usr/share/wlogout/icons/lock.png"));
}
#logout {
background-image: image(url("icons/logout.png"), url("/usr/share/wlogout/icons/logout.png"));
}
#suspend {
background-image: image(url("icons/suspend.png"), url("/usr/share/wlogout/icons/suspend.png"));
}
#hibernate {
background-image: image(url("icons/hibernate.png"), url("/usr/share/wlogout/icons/hibernate.png"));
}
#shutdown {
background-image: image(url("icons/shutdown.png"), url("/usr/share/wlogout/icons/shutdown.png"));
}
#reboot {
background-image: image(url("icons/reboot.png"), url("/usr/share/wlogout/icons/reboot.png"));
}
+6
View File
@@ -0,0 +1,6 @@
#1e1e2e
#262636
#d9e0ee
#89b4fa
#f38ba8
#cba6f7
+39
View File
@@ -0,0 +1,39 @@
## Wofi Config
## General
show=drun
prompt=Apps
normal_window=true
layer=top
term=alacritty
## Geometry
width=500px
height=305px
location=0
orientation=vertical
halign=fill
line_wrap=off
dynamic_lines=false
## Images
allow_markup=true
allow_images=true
image_size=24
## Search
exec_search=false
hide_search=false
parse_search=false
insensitive=false
## Other
hide_scroll=true
no_actions=true
sort_order=default
gtk_dark=true
filter_rate=100
## Keys
key_expand=Tab
key_exit=Escape
+60
View File
@@ -0,0 +1,60 @@
/** ********** Fonts ********** **/
* {
font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif;
font-size: 12px;
}
#window {
background-color: --wofi-color0;
color: --wofi-color2;
border: 2px solid --wofi-color1;
border-radius: 0px;
}
#outer-box {
padding: 20px;
}
#input {
background-color: --wofi-color1;
border: 0px solid --wofi-color3;
padding: 8px 12px;
}
#scroll {
margin-top: 20px;
}
#inner-box {
}
#img {
padding-right: 8px;
}
#text {
color: --wofi-color2;
}
#text:selected {
color: --wofi-color0;
}
#entry {
padding: 6px;
}
#entry:selected {
background-color: --wofi-color3;
color: --wofi-color0;
}
#unselected {
}
#selected {
}
#input, #entry:selected {
border-radius: 4px;
}
+1 -1
View File
@@ -346,7 +346,7 @@ exec --no-startup-id dex --autostart --environment i3
# set wallpaper # set wallpaper
# exec --no-startup-id sleep 2 && nitrogen --restore # exec --no-startup-id sleep 2 && nitrogen --restore
exec --no-startup-id sleep 1 && feh --bg-fill ~/.config/i3/wallpaper.jpg exec --no-startup-id sleep 1 && feh --bg-fill ~/.config/i3/wallpaper.png
# set powersavings for display: # set powersavings for display:
exec --no-startup-id xset s 480 dpms 600 600 600 exec --no-startup-id xset s 480 dpms 600 600 600
+8 -1
View File
@@ -7,7 +7,7 @@
# 直接从当前文件夹中读取配置文件作为配置内容 # 直接从当前文件夹中读取配置文件作为配置内容
# wallpaper, binary file # wallpaper, binary file
home.file.".config/i3/wallpaper.jpg".source = ../../wallpaper.jpg; home.file.".config/i3/wallpaper.png".source = ../wallpapers/wallpaper.png;
home.file.".config/i3/config".source = ./config; home.file.".config/i3/config".source = ./config;
home.file.".config/i3/i3blocks.conf".source = ./i3blocks.conf; home.file.".config/i3/i3blocks.conf".source = ./i3blocks.conf;
home.file.".config/i3/keybindings".source = ./keybindings; home.file.".config/i3/keybindings".source = ./keybindings;
@@ -18,6 +18,13 @@
executable = true; # make all scripts executable executable = true; # make all scripts executable
}; };
# set cursor size and dpi for 4k monitor
xresources.properties = {
"Xcursor.size" = 16;
"Xft.dpi" = 192;
};
# 直接以 text 的方式,在 nix 配置文件中硬编码文件内容 # 直接以 text 的方式,在 nix 配置文件中硬编码文件内容
# home.file.".xxx".text = '' # home.file.".xxx".text = ''
# xxx # xxx
+18 -11
View File
@@ -1,20 +1,27 @@
{ {
pkgs, pkgs,
nixpkgs-stable,
config, config,
... ...
}: { }: let
programs = { pkgs-stable = import nixpkgs-stable {
chromium = { system = pkgs.system;
enable = true; config.allowUnfree = true;
commandLineArgs = ["--enable-features=TouchpadOverscrollHistoryNavigation"];
extensions = [
# {id = "";} // extension id, query from chrome web store
];
}; };
in {
home.packages = with pkgs-stable; [
firefox-wayland
firefox = { # 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.vscode = {
enable = true; enable = true;
profiles.ryan = {}; package = pkgs-stable.vscode; # use the stable version
};
# let vscode sync and update its configuration & extensions across devices, using github account.
# userSettings = {};
}; };
} }
+65 -12
View File
@@ -10,23 +10,71 @@
yq-go # https://github.com/mikefarah/yq yq-go # https://github.com/mikefarah/yq
htop htop
## networking tools
wireshark
wireguard-tools # manage wireguard vpn manually, via wg-quick
# misc # misc
libnotify libnotify
wineWowPackages.wayland wineWowPackages.wayland
xdg-utils xdg-utils
graphviz
# productivity # productivity
obsidian obsidian
hugo
# IDE # IDE
insomnia insomnia
jetbrains.pycharm-community
# jetbrains.idea-community
# cloud native # cloud native
docker-compose docker-compose
kubectl kubectl
kubernetes-helm
terraform
pulumi
# cloud provider
awscli
# C
clang-tools
clang-analyzer
lldb
gnumake
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
# nodejs
nodejs nodejs
nodePackages.npm nodePackages.npm
nodePackages.pnpm nodePackages.pnpm
@@ -36,16 +84,19 @@
dbeaver dbeaver
mycli mycli
pgcli pgcli
# desktop
tdesktop
discord
]; ];
programs = { programs = {
# A terminal multiplexer
tmux = { tmux = {
enable = true; enable = true;
clock24 = true;
keyMode = "vi";
extraConfig = "mouse on";
}; };
# a cat(1) clone with syntax highlighting and Git integration.
bat = { bat = {
enable = true; enable = true;
config = { config = {
@@ -64,21 +115,23 @@
exa.enable = true; # A modern replacement for ls exa.enable = true; # A modern replacement for ls
jq.enable = true; # A lightweight and flexible command-line JSON processor jq.enable = true; # A lightweight and flexible command-line JSON processor
ssh.enable = true; ssh.enable = true;
aria2.enable = true; aria2.enable = true; # a
# skim provides a single executable: sk.
# Basically anywhere you would want to use grep, try sk instead.
skim = { skim = {
enable = true; enable = true;
enableZshIntegration = true; enableBashIntegration = true;
defaultCommand = "rg --files --hidden"; };
changeDirWidgetOptions = [
"--preview 'exa --icons --git --color always -T -L 3 {} | head -200'" direnv = {
"--exact" enable = true;
]; nix-direnv.enable = true;
}; };
}; };
services = { services = {
syncthing.enable = true; # syncthing.enable = true;
# auto mount usb drives # auto mount usb drives
udiskie.enable = true; udiskie.enable = true;
+1 -1
View File
@@ -8,7 +8,7 @@
./common.nix ./common.nix
./git.nix ./git.nix
./media.nix ./media.nix
./vscode.nix # ./nixos-cn.nix
./xdg.nix ./xdg.nix
]; ];
} }
+17 -1
View File
@@ -13,8 +13,24 @@
pavucontrol pavucontrol
playerctl playerctl
pulsemixer pulsemixer
ffmpeg-full
# images # images
imv viu # terminal image viewer
imv # simple image viewer
imagemagick
graphviz
# creative
blender # 3d modeling
gimp # image editing
inkscape # vector graphics
krita # digital painting
# 3d printing, eletrical engineering
kicad
]; ];
programs = { programs = {
+23
View File
@@ -0,0 +1,23 @@
{
pkgs,
config,
nixos-cn,
...
}:
{
imports = [
# 将 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
];
# # 使用 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
];
}
-119
View File
@@ -1,119 +0,0 @@
{
config,
pkgs,
home-manager,
nix-vscode-extensions,
...
}:
{
# if use vscode in wayland, uncomment this line
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
programs.vscode = {
enable = true;
userSettings = {
"editor.renderWhitespace" = "all";
"files.autoSave" = "onFocusChange";
"editor.rulers" = [ 80 120 ];
"telemetry.enableTelemetry" = false;
"telemetry.enableCrashReporter" = false;
"editor.tabSize" = 2;
"files.exclude" = { "**/node_modules/**" = true; };
"editor.formatOnSave" = false;
"breadcrumbs.enabled" = true;
"editor.useTabStops" = false;
"editor.fontFamily" = "JetBrainsMono Nerd Font";
"editor.fontSize" = 16;
"editor.fontLigatures" = true;
"editor.lineHeight" = 20;
"workbench.fontAliasing" = "antialiased";
"files.trimTrailingWhitespace" = true;
"editor.minimap.enabled" = false;
"workbench.editor.enablePreview" = false;
"terminal.integrated.fontFamily" = "JetBrainsMono Nerd Font";
};
# pkgs.vscode-extensions 里包含的 vscode 太少了
# 必须使用社区的 <https://github.com/nix-community/nix-vscode-extensions> 才能安装更多插件
# TODO 安装有点麻烦,后面再整
extensions = with pkgs.vscode-extensions; [
# aaron-bond.better-comments
# anweber.vscode-httpyac
# arrterian.nix-env-selector
# bierner.markdown-mermaid
# christian-kohler.path-intellisense
# cschlosser.doxdocgen
# DanishSarwar.reverse-search
# eamodio.gitlens
# esbenp.prettier-vscode
# espressif.esp-idf-extension
# fabiospampinato.vscode-diff
# GitHub.copilot
# golang.go
# hashicorp.terraform
# janisdd.vscode-edit-csv
# jebbs.plantuml
# jeff-hykin.better-cpp-syntax
# jnoortheen.nix-ide
# JuanBlanco.solidity
# k--kato.intellij-idea-keybindings
# llvm-vs-code-extensions.vscode-clangd
# mcu-debug.debug-tracker-vscode
# mcu-debug.memory-view
# mcu-debug.rtos-views
# mikestead.dotenv
# mkhl.direnv
# ms-azuretools.vscode-docker
# ms-dotnettools.vscode-dotnet-runtime
# ms-kubernetes-tools.vscode-kubernetes-tools
# ms-python.isort
# ms-python.python
# ms-python.vscode-pylance
# ms-toolsai.jupyter
# ms-toolsai.jupyter-keymap
# ms-toolsai.jupyter-renderers
# ms-toolsai.vscode-jupyter-cell-tags
# ms-toolsai.vscode-jupyter-slideshow
# ms-vscode-remote.remote-containers
# ms-vscode-remote.remote-ssh
# ms-vscode-remote.remote-ssh-edit
# ms-vscode-remote.vscode-remote-extensionpack
# ms-vscode.cmake-tools
# ms-vscode.cpptools
# ms-vscode.cpptools-extension-pack
# ms-vscode.cpptools-themes
# ms-vscode.remote-explorer
# ms-vscode.remote-server
# pinage404.nix-extension-pack
# platformio.platformio-ide
# pomdtr.excalidraw-editor
# redhat.java
# redhat.vscode-commons
# redhat.vscode-xml
# redhat.vscode-yaml
# rust-lang.rust-analyzer
# shd101wyy.markdown-preview-enhanced
# sumneko.lua
# tamasfe.even-better-toml
# timonwong.shellcheck
# tintinweb.graphviz-interactive-preview
# tintinweb.solidity-visual-auditor
# tintinweb.vscode-inline-bookmarks
# tintinweb.vscode-solidity-flattener
# tintinweb.vscode-solidity-language
# twxs.cmake
# vadimcn.vscode-lldb
# VisualStudioExptTeam.intellicode-api-usage-examples
# VisualStudioExptTeam.vscodeintellicode
# vscjava.vscode-java-debug
# vscjava.vscode-java-pack
# vscjava.vscode-java-test
# vscjava.vscode-maven
# vscode-icons-team.vscode-icons
# WakaTime.vscode-wakatime
yzhang.markdown-all-in-one
zxh404.vscode-proto3
];
};
}
+3 -3
View File
@@ -1,4 +1,4 @@
{config, ...}: let {config, pkgs, ...}: let
browser = ["firefox.desktop"]; browser = ["firefox.desktop"];
# XDG MIME types # XDG MIME types
@@ -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"];
}; };
+7 -1
View File
@@ -10,8 +10,14 @@ in {
./terminals.nix ./terminals.nix
]; ];
programs.bash = {
enable = true;
enableCompletion = true;
};
# add environment variables # add environment variables
home.sessionVariables = { # 注意不要用 home.sessionVariables 或 home.xxx.sessionVariables,这俩参数没用
systemd.user.sessionVariables = {
# clean up ~ # clean up ~
LESSHISTFILE = cache + "/less/history"; LESSHISTFILE = cache + "/less/history";
LESSKEY = c + "/less/lesskey"; LESSKEY = c + "/less/lesskey";
-2
View File
@@ -1,6 +1,4 @@
{config, ...}: { {config, ...}: {
home.sessionVariables.STARSHIP_CACHE = "${config.xdg.cacheHome}/starship";
programs.starship = { programs.starship = {
enable = true; enable = true;
settings = { settings = {
+22
View File
@@ -0,0 +1,22 @@
# convert all images to png
def to_png [old_path: string, old_format: string] {
# 将后缀改为 .png 得到新图片的 path
let webp_path = ($old_path | split row $old_format | append ".png" | str join)
# 使用 ffmpeg 进行格式转换
ffmpeg -y -i $old_path $webp_path
# 删除旧图片
rm $old_path
}
def convert_format [old_format: string] {
# 递归找出所有大于 10kib 的图片
let old_paths = (ls $"**/*($old_format)" | where size > 10kb | each {|it| $it.name})
$old_paths | to md
# 1. 执行图片格式转换与压缩,同时删除原图片
$old_paths | each { |it| to_png $it $old_format }
}
convert_format ".webp"
# convert_format ".jpg"
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 KiB

-10
View File
@@ -1,10 +0,0 @@
{
...
}: {
imports =
[
./nixos-test
../modules/system.nix
../modules/i3.nix
];
}
+12
View File
@@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
# mount a smb/cifs share
fileSystems."/home/ryan/SMB-Downloads" = {
device = "//192.168.5.194/Downloads";
fsType = "cifs";
options = ["vers=3.0,uid=1000,gid=100,dir_mode=0755,file_mode=0755,mfsymlinks,credentials=/etc/nixos/.smb_credentials,nofail"];
};
}
+87
View File
@@ -0,0 +1,87 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[
./cifs-mount.nix
../../modules/system.nix
../../modules/hyprland.nix
../../modules/fcitx5
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi"; # ← use the same mount point here.
};
systemd-boot.enable = true;
};
networking = {
hostName = "msi-rtx4090"; # Define your hostname.
wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/";
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networkmanager.enable = true;
enableIPv6 = false; # disable ipv6
interfaces.enp5s0 = {
useDHCP = false;
ipv4.addresses = [ {
address = "192.168.5.66";
prefixLength = 24;
} ];
};
defaultGateway = "192.168.5.201";
nameservers = [
"119.29.29.29" # DNSPod
"223.5.5.5" # AliDNS
];
};
# for Nvidia GPU
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;
};
virtualisation.docker = {
enable = true;
enableNvidia = true;
storageDriver = "btrfs";
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}
@@ -0,0 +1,42 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/231466f6-cdf3-40e1-b9d2-6b4e8d10a4d3";
fsType = "btrfs";
options = [ "subvol=@" ];
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/87ED-8B2E";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/17391ca0-8cdb-4598-a40b-fd9548fd9b37"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+21 -12
View File
@@ -6,16 +6,17 @@
{ {
imports = imports =
[ # Include the results of the hardware scan. [
../../modules/system.nix
../../modules/hyprland.nix
../../modules/fcitx5
# Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
# Bootloader. # Bootloader.
boot.loader = { boot.loader = {
# efi = {
# canTouchEfiVariables = true;
# efiSysMountPoint = "/boot/efi"; # ← use the same mount point here.
# };
grub = { grub = {
enable = true; enable = true;
device = "/dev/sda"; # "nodev" device = "/dev/sda"; # "nodev"
@@ -25,16 +26,24 @@
}; };
}; };
networking.hostName = "nixos-test"; # Define your hostname. networking = {
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. hostName = "nixos-test"; # Define your hostname.
wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/"; # proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking networkmanager.enable = true;
networking.networkmanager.enable = true; interfaces.ens18 = {
networking.defaultGateway = "192.168.5.201"; useDHCP = false;
ipv4.addresses = [ {
address = "192.168.5.48";
prefixLength = 24;
} ];
};
defaultGateway = "192.168.5.201";
};
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
+9
View File
@@ -0,0 +1,9 @@
# Fcitx5-Rime + Flypy
- fcitx5 input method - currently not work in vscode, and failed to add flypy input method
## Hisotry Problems
1. pay attention to the `rm -rf .local/share/fcitx5/rime/`, which may contains some auto generated rime config files, which may cause flypy not the default scheme for rime
2. manage `~/.config/fcitx5/profile` in ../home/hyprland/default.nix, which hardcode rime as the default input method, so you do not need to use fcitx-configtool to set rime as the default input method.
3. fcitx5-rime still cannot use on vscode & chrome now... need more time to figure out why and resolve it.
+28
View File
@@ -0,0 +1,28 @@
{ config, pkgs, ... }:
# related issues: https://github.com/hyprwm/Hyprland/discussions/421
{
# 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
nixpkgs.overlays = [
(self: super: {
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
rime-data = ./rime-data-flypy;
fcitx5-rime = super.fcitx5-rime.override { rimeDataPkgs = [ ./rime-data-flypy ]; };
})
];
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
# for flypy chinese input method
fcitx5-rime
# needed enable rime using configtool after installed
fcitx5-configtool
fcitx5-chinese-addons
# fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
};
}
+89
View File
@@ -0,0 +1,89 @@
{pkgs, ...}:
{
# i3wm: old and stable, only support X11
# sway: compatible with i3wm, support Wayland. do not support Nvidia GPU officially.
# hyprland: project starts from 2022, support Wayland, envolving fast, good looking, support Nvidia GPU.
environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw
services.xserver = {
enable = true;
desktopManager = {
xterm.enable = false;
};
displayManager = {
defaultSession = "hyprland";
lightdm.enable = false;
gdm = {
enable = true;
wayland = true;
};
};
};
programs.hyprland = {
enable = true;
xwayland = {
enable = true;
hidpi = true;
};
nvidiaPatches = true;
};
programs.light.enable = true; # monitor backlight control
# thunar file manager(part of xfce) related options
programs.thunar.plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
services.gvfs.enable = true; # Mount, trash, and other functionalities
services.tumbler.enable = true; # Thumbnail support for images
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
waybar # the status bar
swaybg # the wallpaper
swayidle # the idle timeout
swaylock # locking the screen
wlogout # logout menu
wl-clipboard # copying and pasting
wf-recorder # creen recording
grim # taking screenshots
slurp # selecting a region to screenshot
# TODO replace by `flameshot gui --raw | wl-copy`
wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland
mako # the notification daemon, the same as dunst
yad # a fork of zenity, for creating dialogs
# 用于播放系统音效
mpd # for playing system sounds
mpc-cli # command-line mpd client
ncmpcpp # a mpd client with a UI
networkmanagerapplet # provide GUI app: nm-connection-editor
];
xdg.portal = {
enable = true;
wlr.enable = true;
xdgOpenUsePortal = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr # for wlroots based compositors
xdg-desktop-portal-gtk # for gtk
# xdg-desktop-portal-kde # for kde
];
};
# for power management
services.upower.enable = true;
}
+1 -1
View File
@@ -34,7 +34,7 @@
arandr # screen layout manager arandr # screen layout manager
dex # autostart applications dex # autostart applications
xbindkeys # bind keys to commands xbindkeys # bind keys to commands
xorg.xbacklight # control screen brightness xorg.xbacklight # control screen brightness, the same as light
xorg.xdpyinfo # get screen information xorg.xdpyinfo # get screen information
sysstat # get system information sysstat # get system information
]; ];
+79 -6
View File
@@ -1,6 +1,9 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
# enable flakes globally
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Set your time zone. # Set your time zone.
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
@@ -23,10 +26,16 @@
services.printing.enable = true; services.printing.enable = true;
# all fonts are linked to /nix/var/nix/profiles/system/sw/share/X11/fonts
fonts = { fonts = {
# use fonts specified by user rather than default ones
enableDefaultFonts = false;
fontDir.enable = true;
fonts = with pkgs; [ fonts = with pkgs; [
# icon fonts # icon fonts
material-design-icons material-design-icons
font-awesome
# normal fonts # normal fonts
noto-fonts noto-fonts
@@ -34,11 +43,18 @@
noto-fonts-emoji noto-fonts-emoji
# nerdfonts # nerdfonts
(nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" ]; }) (nerdfonts.override { fonts = [
]; "FiraCode"
"JetBrainsMono"
"Iosevka"
];})
# use fonts specified by user rather than default ones (pkgs.callPackage ../fonts/icomoon-feather-icon-font.nix { })
enableDefaultFonts = false;
# arch linux icon, used temporarily in waybar
(pkgs.callPackage ../fonts/archcraft-icon-font.nix { })
];
# user defined fonts # user defined fonts
# the reason there's Noto Color Emoji everywhere is to override DejaVu's # the reason there's Noto Color Emoji everywhere is to override DejaVu's
@@ -79,23 +95,72 @@
wget wget
curl curl
git git
# networking tools
ethtool
iperf3
nmap
socat
# system tools
sysstat sysstat
lm_sensors # for `sensors` command lm_sensors # for `sensors` command
# misc
findutils
file
which
tree
gnused
gnutar
gawk
p7zip
xz
zstd
cifs-utils # for mounting windows shares
(python3.withPackages(ps: with ps; [
ipython
pandas
requests
pyquery
]))
conda
# video/audio tools
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
scrot scrot
neofetch neofetch
xfce.thunar # xfce4's file manager xfce.thunar # xfce4's file manager
nnn # terminal file manager nnn # terminal file manager
xdg-user-dirs
# embedded development
minicom
]; ];
# Enable sound with pipewire. # Enable sound with pipewire.
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
# security with polkit
services.power-profiles-daemon = { services.power-profiles-daemon = {
enable = true; enable = true;
}; };
security.polkit.enable = true; security.polkit.enable = true;
# security with gnome-kering
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
services = { services = {
dbus.packages = [ pkgs.gcr ]; dbus.packages = [ pkgs.gcr ];
@@ -115,14 +180,22 @@
#media-session.enable = true; #media-session.enable = true;
}; };
udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; udev.packages = with pkgs; [
gnome.gnome-settings-daemon
platformio # udev rules for platformio
android-udev-rules
];
}; };
# android development tools, this will install adb/fastboot and other android tools and udev rules
# see https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/programs/adb.nix
programs.adb.enable = true;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.ryan = { users.users.ryan = {
isNormalUser = true; isNormalUser = true;
description = "ryan"; description = "ryan";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "users" "networkmanager" "wheel" "docker" "wireshark" "adbusers" ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj admin@ryan-MBP" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj admin@ryan-MBP"
]; ];
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 KiB