A CLI tool to deduplicate your Nix flake's inputs as if you added `inputs.*.inputs.*.follows = "*"` everywhere.

Overview

Allfollow

What is this?

Take this flake's inputs, for example.

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    systems = {
      url = "github:nix-systems/default";
      flake = false;
    };
  };

This would be the content of the flake.lock for the above inputs,

{
  "nodes": {
    "nixpkgs": {
      // ...
    },
    "nixpkgs_2": {
      // ...
    },
    "rust-overlay": {
      "inputs": {
        "nixpkgs": "nixpkgs_2"
      },
      // ...
    },
    "systems": {
      // ...
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs",
        "rust-overlay": "rust-overlay",
        "systems": "systems"
      }
    }
  },
  "root": "root",
  "version": 7
}

You can see two instances of nixpkgs. This means our flake's closure size is rather large, and we don't really want to download nixpkgs twice.

This can be fixed by defining rust-overlay.inputs.nixpkgs.follows to the name of our nixpkgs.

  inputs = {
    # ...
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    # ...
  };

That change would result in the following in the lock file:

  {
    "nodes": {
      "nixpkgs": {
        // ...
      },
-     "nixpkgs_2": {
-       // ...
-     },
      "rust-overlay": {
        "inputs": {
-         "nixpkgs": "nixpkgs_2"
+         "nixpkgs": [
+           "nixpkgs"
+         ]
        },
        // ...
      },
      // ...
    },
    "root": "root",
    "version": 7
  }

This tool, allfollow, will effectively do the same as a post-process to your flake.lock.

Okay, why?

Large flakes that aggregate other packages need to add inputs.*.inputs.*.follows = "*" for each input of every top-level input, perhaps even recursively.

Take a look at the [Hyprland's flake.nix]. Every single repository in the HyprWM organization with a flake.nix is riddled with the words inputs and follows, and it is a pain to maintain this web of dependencies manually.

As of writing, for my flake Hyprnix, I was successfully able to remove 47+ tediously-maintained lines from the flake.nix. the original flake.lock is 933 lines long, the only 150 after using allfollow.

You might also like...
A Yocto setup and management tool that helps you keep your environment up-to-date and in-sync with your team
A Yocto setup and management tool that helps you keep your environment up-to-date and in-sync with your team

yb (Yocto Buddy) yb is designed to make it easy to setup and (perhaps more importantly) keep Yocto environments up-to-date and in-sync with your team.

Dura - You shouldn't ever lose your work if you're using Git

Dura Dura is a background process that watches your Git repositories and commits your uncommitted changes without impacting HEAD, the current branch,

Sero is a web server that allows you to easily host your static sites without pain. The idea was inspired by surge.sh but gives you full control.

sero Lightning-fast, static web publishing with zero configuration and full control 📖 Table Of Contents 📖 Table Of Contents 🔧 Tools ❓ About The Pro

Run if inputs have changed, otherwise use cache
Run if inputs have changed, otherwise use cache

Boost Why Boost? Our planet is burning, and everywhere I look I see CI pipelines repeating work that has already been done. Tools such as TurboRepo, N

Pure Rust Fault Proof Program that runs the rollup state-transition to verify an L2 output from L1 inputs.

palmtop palmtop is a fault proof program that runs the rollup state transition to verify an L2 output from L1 inputs. The verifiable L2 output can the

Dog command for *nix systems, Rust port of dog.

dog-rs Dog command for *nix systems, Rust port of dog. Because there is a cat command, should be a dog command too. It was written completely using VS

A flexible simple theme manager for *nix systems

tema A theme manager for *nix systems respecting the FHS spec configuration As of now all the configuration is done via $XDG_CONFIG_HOME/tema/config.y

A simple gtk4/libadwaita software center to easily install and manage nix packages
A simple gtk4/libadwaita software center to easily install and manage nix packages

Nix Software Center A graphical app store for Nix built with libadwaita, GTK4, and Relm4. Heavily inspired by GNOME Software. Features Install package

Generate Nix packages from URLs
Generate Nix packages from URLs

Generate Nix packages from URLs with hash prefetching, dependency inference, license detection, and more

Owner
Jacob Birkett
I write Rust and Nix mostly, but have learned much else over the years. I do FOSS for fun (if you call it that) and eventually--hopefully--for profit.
Jacob Birkett
A `nix` and `nix-shell` wrapper for shells other than `bash`

nix-your-shell A nix and nix-shell wrapper for shells other than bash. nix develop and nix-shell use bash as the default shell, so nix-your-shell prin

Mercury 15 Apr 10, 2023
Progress In Nix - Pacman inspired frontend for Nix

Progress In Nix Pinix is a Pacman inspired frontend for Nix. It wraps a regular Nix command and replaces the output with a more modern and informative

Rémi Dupré 23 Mar 9, 2024
Rich terminals. follows Python's rich conventions

richterm use richterm::print; use richterm::text; use richterm::track; use richterm::progress; use std::{thread, time}; fn main() { let vec = ve

Abdur-Rahmaan Janhangeer 14 Aug 5, 2023
zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets you're watching easily into watchlists for easy access on your terminal.

zigfi zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets

Aldrin Zigmund Cortez Velasco 18 Oct 24, 2022
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and much more.

rpsc rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and mu

null 3 Dec 15, 2022
A CLI tool which can help you automatically kill process of your choice. Useful for freeing up memory and CPU usage!

Quickiller There are always programs such as chrome that keep eating up your resources even when closed! The only way to prevent this is to kill all o

Codingsquirrel 1 Dec 8, 2021
A CLI companion tool for paste.misterio.me, allowing you to easily upload and manage your pastes

This is a CLI companion tool for paste.misterio.me, allowing you to easily upload and manage your pastes, as well as download any pastes you want.

Gabriel Fontes 1 Jan 26, 2022
Sleek is a CLI tool for formatting SQL. It helps you maintain a consistent style across your SQL code, enhancing readability and productivity.

Sleek: SQL Formatter ✨ Sleek is a CLI tool for formatting SQL. It helps you maintain a consistent style across your SQL code, enhancing readability an

Nick Rempel 40 Apr 20, 2023
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

Harikesh Ranjan Sinha 5 May 2, 2024