diff --git a/lib/modules/manager/nix/__fixtures__/flake.8.lock b/lib/modules/manager/nix/__fixtures__/flake.8.lock new file mode 100644 index 00000000000000..ae61fdc2725739 --- /dev/null +++ b/lib/modules/manager/nix/__fixtures__/flake.8.lock @@ -0,0 +1,28 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "ref": "nixos-unstable", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "shallow": true, + "type": "git", + "url": "https://github.com/NixOS/nixpkgs" + }, + "original": { + "ref": "nixos-unstable", + "shallow": true, + "type": "git", + "url": "https://github.com/NixOS/nixpkgs" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/lib/modules/manager/nix/extract.spec.ts b/lib/modules/manager/nix/extract.spec.ts index e54ac96903e48e..8118d3bd8673e6 100644 --- a/lib/modules/manager/nix/extract.spec.ts +++ b/lib/modules/manager/nix/extract.spec.ts @@ -9,6 +9,7 @@ const flake4Lock = Fixtures.get('flake.4.lock'); const flake5Lock = Fixtures.get('flake.5.lock'); const flake6Lock = Fixtures.get('flake.6.lock'); const flake7Lock = Fixtures.get('flake.7.lock'); +const flake8Lock = Fixtures.get('flake.8.lock'); describe('modules/manager/nix/extract', () => { it('returns null when no inputs', () => { @@ -75,4 +76,15 @@ describe('modules/manager/nix/extract', () => { it('test other version', () => { expect(extractPackageFile(flake7Lock, 'flake.lock')).toBeNull(); }); + + it('includes nixpkgs with ref and shallow arguments', () => { + expect(extractPackageFile(flake8Lock, 'flake.lock')?.deps).toMatchObject([ + { + currentDigest: '5633bcff0c6162b9e4b5f1264264611e950c8ec7', + datasource: 'git-refs', + depName: 'nixpkgs', + packageName: 'https://github.com/NixOS/nixpkgs', + }, + ]); + }); }); diff --git a/lib/modules/manager/nix/schema.ts b/lib/modules/manager/nix/schema.ts index fabf2fa32fd066..559ee84c68a96e 100644 --- a/lib/modules/manager/nix/schema.ts +++ b/lib/modules/manager/nix/schema.ts @@ -18,6 +18,7 @@ export const LockedInput = z.object({ ref: z.string().optional(), rev: z.string(), revCount: z.number().optional(), + shallow: z.boolean().optional(), type: InputType, url: z.string().optional(), });