diff --git a/npins/default.nix b/npins/default.nix index 6e3194a2..78ca0251 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -64,7 +64,17 @@ let then mkTarballSource spec else builtins.throw "Unknown source type ${spec.type}"; in - spec // {outPath = mayOverride name path;}; + spec + // rec { + outPath = mayOverride name path; + + # Waiting for discussion upstream + # https://github.com/andir/npins/issues/159 + asFlake = + if sources ? flake-compat + then (import sources.flake-compat {src = outPath;}).outputs + else throw ".asFlake needs flake-compat as a source"; + }; mkGitSource = { repository, @@ -146,7 +156,10 @@ let url = locked_url; sha256 = hash; }; + + sources = + if version == 5 + then builtins.mapAttrs mkSource data.pins + else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"; in - if version == 5 - then builtins.mapAttrs mkSource data.pins - else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" + sources diff --git a/npins/sources.json b/npins/sources.json index ca96c40b..2fa25473 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -75,6 +75,23 @@ "url": null, "hash": "07d2mzjnggbxlpqarcj65xdndkqxcab38lkbbqh65cyfqzqahdg0" }, + "flake-compat": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "edolstra", + "repo": "flake-compat" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v1.1.0", + "revision": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "url": "https://api.github.com/repos/edolstra/flake-compat/tarball/v1.1.0", + "hash": "19d2z6xsvpxm184m41qrpi1bplilwipgnzv9jy17fgw421785q1m", + "frozen": true + }, "home-manager": { "type": "Git", "repository": {