Skip to content

Commit f1498ab

Browse files
authored
Merge pull request #676 from sseu-buhzzi/38203017/build-nix-flake
build: add a nix flake to build and run DanXi on NixOS
2 parents ca30546 + 5e7dc89 commit f1498ab

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ sudo pacman -S danxi # 最新稳定版
6969
sudo pacman -S danxi-git # 最新 Git 版
7070
```
7171

72+
### NixOS
73+
74+
使用 Nix flake 构建和运行:
75+
76+
```shell
77+
# 直接运行(不安装)
78+
nix run github:DanXi-Dev/DanXi-nix
79+
```
80+
81+
```shell
82+
# 进入开发环境
83+
nix develop github:DanXi-Dev/DanXi-nix
84+
```
85+
7286
### 其他 Linux 发行版
7387

7488
打开 [release 页面](https://github.com/DanXi-Dev/DanXi/releases/latest) 下载最新版 zip 压缩包,解压运行即可。
@@ -130,6 +144,25 @@ dart run build_runner build --delete-conflicting-outputs
130144

131145
然后运行 `flutter run [ios/android]`即可运行应用。
132146

147+
### Nix Flake 构建
148+
149+
本项目提供 Nix flake,可在 NixOS 上构建(产物预设在 `./result/` 中):
150+
151+
```shell
152+
# Linux 桌面版
153+
nix build github:DanXi-Dev/DanXi-nix
154+
```
155+
156+
```shell
157+
# Android APK
158+
nix build github:DanXi-Dev/DanXi-nix#android
159+
```
160+
161+
```shell
162+
# Android APK,另一种方式
163+
nix develop github:DanXi-Dev/DanXi-nix -c flutter build apk
164+
```
165+
133166
## 赞助
134167

135168
由于 Apple Developer Program 费用(发布应用至 App Store 和 TestFlight 所必需)费用较高,如果您希望赞助我们,请通过邮件联系我们!

README_EN.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ You can install it from [AUR](https://aur.archlinux.org/danxi-git.git) or [archl
7474
sudo pacman -S danxi-git
7575
```
7676

77+
### NixOS
78+
79+
Using the Nix flake:
80+
81+
```shell
82+
# Run directly (without installing)
83+
nix run github:DanXi-nix/DanXi-nix
84+
```
85+
86+
```shell
87+
# Enter development shell
88+
nix develop github:DanXi-Dev/DanXi-nix
89+
```
90+
7791
### Other Linux distributions
7892

7993
Go to [release page](https://github.com/DanXi-Dev/DanXi/releases), just download the zip file and
@@ -135,3 +149,23 @@ dart run build_runner build --delete-conflicting-outputs
135149
```
136150

137151
and then `flutter run [ios/android]` to start the app.
152+
153+
### Build with Nix Flake
154+
155+
This project provides a Nix flake for builds on NixOS (this output will be in `./result/`):
156+
157+
```shell
158+
# Linux desktop
159+
nix build github:DanXi-Dev/DanXi-nix
160+
```
161+
162+
```shell
163+
# Android APK
164+
nix build github:DanXi-Dev/DanXi-nix#android
165+
```
166+
167+
```shell
168+
# cd DanXi-Dev/DanXi
169+
# Android APK, another method
170+
nix develop github:DanXi-Dev/DanXi-nix -c flutter build apk
171+
```

0 commit comments

Comments
 (0)