Git Product home page Git Product logo

fast-flake-update's Introduction

fast-flake-update

Written next to a pool in Mahalapye, Botswana.

This tool improves the efficiency of updating flake inputs in nix from local git repository checkouts.

When using nix flake update with inputs from GitHub or GitLab, the entire archive needs to be re-downloaded for every commit change. This process becomes especially slow for repositories like nixpkgs.

fast-flake-update uses of a local git checkout for updating the flake lock. Additionally, it adds the checkout to the nix store. This approach allows for faster iterations when testing changes, significantly improving development efficiency.

This is conceptually similar to nix flake lock --update-input inputA ~/code/inputA but avoids the round-trip of pushing to a git remote, and then re-acquiring the git archive. Since this copies to the store, and uses the same archive format, it results in the same diff to flake.lock.

Usage

usage: fast-flake-update [-h] [--rev REV] inputname repo

Update flake.lock with the latest commit of a local checkout

positional arguments:
  inputname   Name of the input in flake.lock to update
  repo        Path to the local checkout

options:
  -h, --help  show this help message and exit
  --rev REV   Revision to use

Example

Let's say you have a project with the following flake.nix:

{
  description = "Your flake with the nixpkgs input";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = { ... }: {
    # ...
  };
}

Now you can quickly do some commits in your local nixpkgs fork that is located at ../nixpkgs. Then you can update your project's flake.lock to the same commit like that:

fast-flake-update nixpkgs ../nixpkgs

Installation

You can run fast-flake-update like this from the repository:

nix run github:Mic92/fast-flake-update nixpkgs ../nixpkgs

fast-flake-update's People

Contributors

bors[bot] avatar colemickens avatar dependabot[bot] avatar github-actions[bot] avatar mic92 avatar zi3m5f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fast-flake-update's Issues

Local checkout is in 'detached HEAD' state after usage.

Hey Jörg,
thanks for your tool!

Using it leaves my local checkout in 'detached HEAD' state and it seems like setting worktree by env var doesn't work anymore?

I fixed it for me in my pull request. Feel free to use it or not :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.