A template for NUR repositories
- Click on Use this template to start a repo based on this template. (Do not fork it.)
- Add your packages to the pkgs directory and to
default.nix
- Remember to mark the broken packages as
broken = true;in themetaattribute, or travis (and consequently caching) will fail! - Library functions, modules and overlays go in the respective directories
- Remember to mark the broken packages as
- Choose your CI: Depending on your preference you can use github actions (recommended) or Travis ci.
- Github actions: Change your NUR repo name and optionally add a cachix name in .github/workflows/build.yml and change the cron timer to a random value as described in the file
- Travis ci: Change your NUR repo name and optionally your cachix repo name in .travis.yml. Than enable travis in your repo. You can add a cron job in the repository settings on travis to keep your cachix cache fresh
- Change your travis and cachix names on the README template section and delete the rest
- Add yourself to NUR
My personal NUR repository
nix flake update # 可选,将 flake.lock 中的 Nixpkgs 等仓库更新到最新版
nix build ".#example-package"对于使用 Nix Flake 的用户,在 flake.nix 中的 inputs 一节中添加如下定义:
inputs = {
# ...
myRepo = {
url = "github:Yibo-Zhang/nur-packages";
inputs.nixpkgs.follows = "nixpkgs";
};
# ...
};然后,在 flake.nix 中的 output 一节,你的 nixosConfigurations 定义中,为每个系统添加一个 module:
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations."nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
# 在 modules 的开头添加下面这几行
({
nixpkgs.overlays = [
(final: prev: {
myRepo = inputs.myRepo.packages."${prev.system}";
})
];
})
# 在 modules 的开头添加上面这几行
./configuration.nix
];
};
};这样操作后,你就能用类似于 pkgs.myRepo.example-package 的方式使用你打的包了。