Skip to content

shomykohai/reflake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❄️ Reflake ❄️

An automatic flake updater for NixOS

Reflake is a NixOS Flake that allows you to automatically update your flake.nix inputs with ease

✨ Features

  • Automatic update of the flake.lock file 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

📦 Installation & Usage

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 };

⚙️ Available options

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.)

⚠️ Warnings!!

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.

⚖️ License

This project is under the GPL-3.0-or-later license, see LICENSE.

Releases

No releases published