Skip to content

Commit

Permalink
fix(nix): Allow nixpkgs with no ref (#25068)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Oct 8, 2023
1 parent 3c0f71d commit 405ec17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions lib/modules/manager/nix/extract.spec.ts
Expand Up @@ -52,7 +52,7 @@ describe('modules/manager/nix/extract', () => {
]);
});

it('ignores nixpkgs with no explicit ref', () => {
it('includes nixpkgs with no explicit ref', () => {
const content = `{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
Expand All @@ -61,6 +61,16 @@ describe('modules/manager/nix/extract', () => {

const res = extractPackageFile(content);

expect(res).toBeNull();
expect(res).toMatchObject({
deps: [
{
currentValue: undefined,
datasource: 'git-refs',
depName: 'nixpkgs',
packageName: 'https://github.com/NixOS/nixpkgs',
versioning: 'nixpkgs',
},
],
});
});
});
2 changes: 1 addition & 1 deletion lib/modules/manager/nix/extract.ts
Expand Up @@ -3,7 +3,7 @@ import { GitRefsDatasource } from '../../datasource/git-refs';
import { id as nixpkgsVersioning } from '../../versioning/nixpkgs';
import type { PackageDependency, PackageFileContent } from '../types';

const nixpkgsRegex = regEx(/"github:nixos\/nixpkgs\/(?<ref>[a-z0-9-.]+)"/i);
const nixpkgsRegex = regEx(/"github:nixos\/nixpkgs(\/(?<ref>[a-z0-9-.]+))?"/i);

export function extractPackageFile(content: string): PackageFileContent | null {
const deps: PackageDependency[] = [];
Expand Down

0 comments on commit 405ec17

Please sign in to comment.