Reflake is a NixOS Flake that allows you to automatically update your flake.nix inputs with ease
- Automatic update of the
flake.lockfile with a systemd service - Possibility to define a custom interval for update checking
- Granular control over input updates
- Optional GUI that automatically pops up to show available updates and diff, and asks the user for confirmation
To install reflake, first include it in your flake inputs:
{ description = "Nixos config flake"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; reflake = { url = "github:shomykohai/reflake"; inputs.nixpkgs.follows = "nixpkgs"; }; };Then when you add your system modules, add reflake module
outputs = { self, nixpkgs, reflake, ... } @inputs: { nixosConfigurations = { my-nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./configuration.nix reflake.nixosModules.default ]; }; }; };Finally, enable the service in your configuration.nix and pass the directory where your flake.nix is located.
# configuration.nix services.reflake = { enable = true; flakePath = "/home/myuser/nix-config/"; };A full configuration might look like:
# configuration.nix services.reflake = { enable = true; flakePath = "/home/myuser/nix-config/"; updateInterval = 259200; # 3 Days in seconds inputsToUpdate = [ "nixpkgs" "home-manager" "reflake" ]; # Only update this inputs automatically. Other inputs will not be automatically, and will require user intervention with `nix flake update`. showUiPrompt = true; # A UI prompt will popup showing a summary of the available update to the flake };| Option | Type | Default | Description |
|---|---|---|---|
enable | bool | false | Enables the reflake service. |
flakePath | path | /etc/nixos/flake.nix | Path to the flake file to be updated. |
updateInterval | int | 86400 (24h) | Interval (in seconds) between update checks. |
inputsToUpdate | list of str | [] | List of specific flake inputs to update. If empty, all inputs are updated. |
showUiPrompt | bool | false | Shows a GUI prompt for reviewing changes and confirming the update. |
confirmOnlyForUi | bool | true | If true, only shows confirmation prompts in GUI mode. If false, prompts on CLI too. (Note: systemd service bypasses confirmation unless showUiPrompt is true.) |
Make sure you do not put an update interval that's too low, or you will be get rate limited by GitHub.
If you want to not get rate limited, modify your nix.conf (nix options in configuration.nix) to include an access token.
This project is under the GPL-3.0-or-later license, see LICENSE.