# Support for nix updates in Renovate

**URL:** https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248
**Category:** Announcements
**Created:** [November 15, 2022, 1:15am UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248 "2022-11-15T01:15:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![JamieMagee](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jamiemagee/32/36953_2.png) [@JamieMagee](https://discourse.nixos.org/u/JamieMagee)
#### Post date: [November 15, 2022, 1:15am UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248/1 "2022-11-15T01:15:39Z")

</div>

I recently added support for updating nix flakes to [Renovate](https://github.com/renovatebot/renovate/), a universal dependency update tool. Support currently includes:

- `flake.lock` updates
- nixpkgs updates in `flake.nix` (e.g. nixpkgs 21.11 to 22.05)

Here’s a minimal configuration if you’d like to try it out:

```json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:base"],
  "lockFileMaintenance": {
    "enabled": true,
    "extends": ["schedule:weekly"]
  },
  "nix": {
    "enabled": true
  }
}

```

Check out [the documentation](https://docs.renovatebot.com/modules/manager/nix/) for more information.

---

<div class="post-metadata">

### Author: ![fpletz](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fpletz/32/344_2.png) [@fpletz](https://discourse.nixos.org/u/fpletz)
#### Post date: [November 16, 2022, 2:36am UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248/2 "2022-11-16T02:36:06Z")

</div>

Thanks for your work! Would love to use it. But how exactly is this supposed to work?

I’m using the self-hosted version as a docker container and have a repo with your example as `renovate.json`. For testing, I’m trying to launch renovate with:

```auto
docker run --rm -v "$PWD/renovate-config.js:/usr/src/app/config.js" --env='GITHUB_COM_TOKEN=<redacted>' renovate/renovate --dry-run=true

```

And proceed to get the following error:

```auto
 WARN: Error updating flake.lock (repository=fpletz/test, branch=renovate/lock-file-maintenance)
       "err": {
         "name": "ExecError",
         "cmd": "/bin/sh -c install-tool nix 2.11.1",
         "stderr": "This script must be run as root\n",
         "stdout": "Installing v1 tool nix v2.11.1\n",
         "options": {
           "cwd": "/tmp/renovate/repos/gitea/fpletz/test",
           "encoding": "utf-8",
           "env": {
             "HOME": "/home/ubuntu",
             "PATH": "/home/ubuntu/.local/bin:/go/bin:/home/ubuntu/bin:/opt/buildpack/tools/python/3.11.0/bin:/home/ubuntu/.npm-global/bin:/home/ubuntu/.cargo/bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
             "LC_ALL": "C.UTF-8",
             "LANG": "C.UTF-8",
             "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/containerbase",
             "CONTAINERBASE_CACHE_DIR": "/tmp/renovate/cache/containerbase"
           },
           "maxBuffer": 10485760,
           "timeout": 900000
         },
         "exitCode": 1,
         "message": "Command failed: install-tool nix 2.11.1\nThis script must be run as root\n",
         "stack": "ExecError: Command failed: install-tool nix 2.11.1\nThis script must be run as root\n\n at ChildProcess.<anonymous> (/usr/src/app/node_modules/renovate/lib/util/exec/common.ts:99:11)\n at ChildProcess.emit (node:events:525:35)\n at ChildProcess.emit (node:domain:489:12)\n at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)"
       }

```

---

<div class="post-metadata">

### Author: ![JamieMagee](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jamiemagee/32/36953_2.png) [@JamieMagee](https://discourse.nixos.org/u/JamieMagee)
#### Post date: [November 16, 2022, 4:13am UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248/3 "2022-11-16T04:13:47Z")

</div>

It looks like you’ve got an older version of the renovate container image, or one of the older containerbase container images, cached locally. Can you `docker image rm` any `renovate` or `containerbase` images and try again? The feature was released in version `34.23.0`.

The first line of `stdout` should be `installing v2 tool nix v2.11`. Nix is dynamically installed in the container and in an earlier attempt I wrote required a root install. That’s the v1 from your logs. The v2 installer uses a chroot and doesn’t require root.

---

<div class="post-metadata">

### Author: ![l0b0](https://discourse.nixos.org/user_avatar/discourse.nixos.org/l0b0/32/39028_2.png) [@l0b0](https://discourse.nixos.org/u/l0b0)
#### Post date: [October 8, 2024, 2:12am UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248/4 "2024-10-08T02:12:25Z")

</div>

Is this currently working for anyone else? I’ve [enabled Nix updates](https://gitlab.com/engmark/renovate/-/blob/cfc11132854179952c41461927c9bb2a960859ef/renovate.json#L3-5), and in the relevant repo there’s [`nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";` in flake.nix](https://gitlab.com/engmark/mypy-exercises/blob/d0c39edb62c5e5c96aa8bc602d71f86b48e84c8a/flake.nix#L5-5). I can see the repo being processed overnight, but no mention of Nix, flakes, or any errors or warnings for the target repo.

Running `ghcr.io/renovatebot/renovate:38.110.4`.

---

<div class="post-metadata">

### Author: ![bbigras](https://discourse.nixos.org/user_avatar/discourse.nixos.org/bbigras/32/56_2.png) [@bbigras](https://discourse.nixos.org/u/bbigras)
#### Post date: [October 13, 2024, 3:41am UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248/5 "2024-10-13T03:41:16Z")

</div>

The last time I tried renovate, it seemed broken with nix. Maybe I was doing something wrong but there seem to be some improvement coming soon:

> <https://github.com/renovatebot/renovate/pull/31921>
>
> \## Changes
> 
> Before nix flakes where only updated if a github:nixos/nixpkgs inp…ut was used. Now all flake inputs are treated like a dependency and updated.
> 
> \## Context
> 
> 
> 
> 
> 
> \## Documentation (please check one with an \[x\])
> 
> \- \[x\] I have updated the documentation, or
> \- \[\] No documentation update is required
> 
> \## How I've tested my work (please select one)
> 
> I have verified these changes via:
> 
> \- \[\] Code inspection only, or
> \- \[x\] Newly added/modified unit tests, or
> \- \[\] No unit tests but ran on a real repository, or
> \- \[x\] Both unit tests + ran on a real repository

---

<div class="post-metadata">

### Author: ![l0b0](https://discourse.nixos.org/user_avatar/discourse.nixos.org/l0b0/32/39028_2.png) [@l0b0](https://discourse.nixos.org/u/l0b0)
#### Post date: [March 23, 2025, 6:07pm UTC](https://discourse.nixos.org/t/support-for-nix-updates-in-renovate/23248/6 "2025-03-23T18:07:25Z")

</div>

Long story short, [fix(nix): fix flake lock refresh by SuperSandro2000 · Pull Request #33991 · renovatebot/renovate · GitHub](https://github.com/renovatebot/renovate/pull/33991) fixes flake updates. Verified by [adding](https://github.com/renovatebot/renovate/pull/33991#issuecomment-2717693779)

```auto
nixpkgs.overlays = [
  (_final: prev: {
    renovate = prev.renovate.overrideAttrs {
      patches = prev.patches or [] ++ [
        (pkgs.fetchpatch {
          url = "https://github.com/renovatebot/renovate/pull/33991.diff";
          hash = "sha256-6ME048IiptweOkJhnK9QvQqfJ6QaXWX23SlY5TAmsFE=";
        })
      ];
    };
  })
];

```

to my configuration.
