Flake.nix
Nix flake for dae and daed
Install / Use
/learn @daeuniverse/Flake.nixREADME
flake.nix
Use with flake
- Import nixosModule.
# flake.nix
{
inputs.daeuniverse.url = "github:daeuniverse/flake.nix";
# ...
outputs = {nixpkgs, ...} @ inputs: {
nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem {
modules = [
inputs.daeuniverse.nixosModules.dae
inputs.daeuniverse.nixosModules.daed
];
};
}
}
- Enable dae or daed module.
[!NOTE] To see full options, check
dae{,d}/module.nix.
# nixos configuration module
{
# ...
services.dae = {
enable = true;
openFirewall = {
enable = true;
port = 12345;
};
/* default options
package = inputs.daeuniverse.packages.x86_64-linux.dae;
disableTxChecksumIpGeneric = false;
configFile = "/etc/dae/config.dae";
assets = with pkgs; [ v2ray-geoip v2ray-domain-list-community ];
*/
# alternative of `assets`, a dir contains geo database.
# assetsPath = "/etc/dae";
};
}
# nixos configuration module
{
# daed - dae with a web dashboard
services.daed = {
enable = true;
openFirewall = {
enable = true;
port = 12345;
};
/* default options
package = inputs.daeuniverse.packages.x86_64-linux.daed;
configDir = "/etc/daed";
listen = "127.0.0.1:2023";
*/
};
}
Globally install packages
This flake contains serval different revision of packages:
- dae (alias of dae-release)
- dae-release (current latest release version)
- dae-unstable (keep sync with dae
mainbranch) - dae-experiment (specific pull request for untested features)
See details with nix flake show github:daeuniverse/flake.nix
# nixos configuration module
{
environment.systemPackages =
with inputs.daeuniverse.packages.x86_64-linux;
[ dae daed ]; # or dae-unstable dae-experient
}
[!WARNING] This Nix Flake provides two installation methods for the dae package:
- NixOS Modules via the services.dae service.
- Global System Package via environment.systemPackages.
Important: Do NOT enable both installation methods simultaneously, as this will result in incompatible binary version issues. Please choose one method to avoid conflicts.
Package Options
-
Nightly Build: Use the
dae-unstablepackage for early access to new features, always synced with the latest updates. For testing specific, unpublished changes, trydae-experiment, pinned to feature branch commits. -
Release Build: Use the
daeordae-releasepackage for stable, production-ready version. History versions are available with tags (e.g.refs/tags/dae-v0.8.0).
[!WARNING] Note that newly introduced features can sometimes be buggy; use at your own risk. However, we still highly encourage you to check out our latest builds as it may help us further analyze features stability and resolve potential bugs accordingly.
Script Usage
The main.nu script on top-level of this repo is able to help you update the package. See help message with ./main.nu.
The cmd args looks like:
# usage
commands: [sync] <PROJECT> [<VERSION>] [--rev <REVISION>]
About adding a new version, if the VERSION you provided doesn't match any of ["release" "unstable"], it will:
- Check the
--revarg and read its value - Run
nix-prefetch-gitto get its info - Adding a new record to
metadata.json - Update the vendorHash.
The --rev args could pass in with any sha1 or references:
- revision sha1 hash
- refs/heads/<branch>
- refs/tags/v0.0.0
Workflow for updating release and unstable:
./main.nu sync dae release unstable # or leave the last 2 args empty
workflow for updating single version:
./main.nu sync dae release # or unstable
workflow for adding a new version:
./main.nu sync dae sth-new --rev 'rev_hash' or refs/heads/<branch> or refs/tags/v0.0.0
# after this will produce a new package called dae-sth-new
Build the binary package locally
To build the binary package locally, you can use the following command:
# Build the package of the latest release version
just build {project}
# e.g. just build dae
# Build the package of the latest unstable version
just build {project}-unstable
# e.g. just build dae-unstable
Or you can use nix build directly:
nix build .#{project}
# e.g. nix build .#dae
nix build .#dae-unstable
# e.g. nix build .#dae-unstable
Verify the build result:
just version {project}
# e.g. just version dae
Or you may verify the build result directly with the binary:
./result/bin/{{ pkg }} --version
Binary cache
We use garnix cache and provide both x86_64-linux and aarch64-linux build products.
To setup the garnix cache:
nix.settings = {
substituters = ["https://cache.garnix.io"];
trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
};
License
ISC © 2023-2024 @daeuniverse
