docs: add nix/nixos docs & update deps
Co-authored-by: juve <juevmail8@gmail.com>
This commit is contained in:
parent
c2b687b271
commit
b5f40b0fd7
|
|
@ -0,0 +1,172 @@
|
|||
## Add to NixOS system configuration
|
||||
|
||||
Add DBX as a flake input and include the package in `environment.systemPackages`.
|
||||
|
||||
### `flake.nix`
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
dbx = {
|
||||
url = "github:t8y2/dbx";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # optional
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, dbx, ... }: {
|
||||
nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
{
|
||||
environment.systemPackages = [
|
||||
dbx.packages.x86_64-linux.dbx-desktop
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Apply
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake .#my-machine
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Add via Home Manager
|
||||
|
||||
This method installs DBX for a specific user through [Home Manager](https://github.com/nix-community/home-manager).
|
||||
|
||||
> [!NOTE]
|
||||
> The `inputs.nixpkgs.follows = "nixpkgs"` line is **optional**.
|
||||
> It prevents Nix from downloading a second copy of nixpkgs, but it also makes
|
||||
> DBX ineligible for the upstream binary cache (it will be built locally).
|
||||
> Remove that line if you prefer to download a pre-built binary.
|
||||
|
||||
### `flake.nix` (standalone Home Manager)
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
dbx = {
|
||||
url = "github:t8y2/dbx";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # optional
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, dbx, ... }: {
|
||||
homeConfigurations."youruser" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
{
|
||||
home.packages = [
|
||||
dbx.packages.x86_64-linux.dbx-desktop
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### `flake.nix` (NixOS + Home Manager as a NixOS module)
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
dbx = {
|
||||
url = "github:t8y2/dbx";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # optional
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, dbx, ... }: {
|
||||
nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.youruser = {
|
||||
home.packages = [
|
||||
dbx.packages.x86_64-linux.dbx-desktop
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
> Replace `youruser` with your actual Linux username and `my-machine` with your hostname.
|
||||
|
||||
### Apply (standalone)
|
||||
|
||||
```bash
|
||||
home-manager switch --flake .#youruser
|
||||
```
|
||||
|
||||
### Apply (NixOS module)
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake .#my-machine
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Development Shell
|
||||
|
||||
If you are contributing to DBX or building it from a local clone, the flake provides a fully configured development shell with Rust, Node.js, pnpm, and all GTK/WebKit system libraries:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/t8y2/dbx
|
||||
cd dbx
|
||||
nix develop
|
||||
```
|
||||
|
||||
Inside the shell:
|
||||
|
||||
| Task | Command |
|
||||
|---|---|
|
||||
| Desktop app (Tauri) | `pnpm install && pnpm dev:tauri` |
|
||||
| Web frontend only | `pnpm dev:web` |
|
||||
| Web backend only | `pnpm dev:backend` |
|
||||
| Release build | `pnpm tauri build` |
|
||||
|
||||
---
|
||||
|
||||
## Building from Source
|
||||
|
||||
Build the `dbx-desktop` package directly from the flake:
|
||||
|
||||
```bash
|
||||
nix build github:t8y2/dbx#dbx-desktop
|
||||
# or, from a local clone:
|
||||
nix build .#dbx-desktop
|
||||
```
|
||||
|
||||
The resulting binary is available at `./result/bin/dbx`.
|
||||
|
||||
---
|
||||
|
|
@ -252,6 +252,10 @@ No additional dependencies required.
|
|||
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev
|
||||
```
|
||||
|
||||
**NIXOS/NIX :**
|
||||
|
||||
<a href="README-NIX.md">See README-NIX.md</a>
|
||||
|
||||
**Windows:**
|
||||
|
||||
No additional dependencies required.
|
||||
|
|
|
|||
|
|
@ -251,6 +251,10 @@ environment:
|
|||
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev
|
||||
```
|
||||
|
||||
**NIXOS/NIX :**
|
||||
|
||||
<a href="README-NIX.md">查看 README-NIX.md</a>
|
||||
|
||||
**Windows:**
|
||||
|
||||
无需额外安装。
|
||||
|
|
|
|||
12
flake.lock
12
flake.lock
|
|
@ -20,11 +20,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1782467914,
|
||||
"narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
|
||||
"lastModified": 1782723713,
|
||||
"narHash": "sha256-oPXCU/SSUokcGaJREHibG1CBX3+s/W7orDWQOZDsEeQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
|
||||
"rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -48,11 +48,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1782703273,
|
||||
"narHash": "sha256-WJPfr9EAWVIuTMyb/ilHKUYlg/RNa0xrNiWR+p1iHUg=",
|
||||
"lastModified": 1782789458,
|
||||
"narHash": "sha256-CR55gKCChD9ffN1Ag5az20Z3RD4tylHlcM1SSohkMA8=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "5106a604b3d67cffe8eb51a8bd9f04e607f0d31d",
|
||||
"rev": "067959ef838c440558ca519cf08ca87f43c3db3a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue