Compare commits

..

6 commits

Author SHA1 Message Date
jade 33a2aba01c Merge pull request 'make flake inputs easily available to classic nix' (#68) from cobaltcause/flake-compat:expose-inputs into main
Reviewed-on: #68
Reviewed-by: jade <jade@noreply.git.lix.systems>
2024-11-25 18:56:35 +00:00
Charles Hall 127c86e1d4
make flake inputs easily available to classic nix
This makes it easier to control the "shape" of the `default.nix`.
2024-11-24 19:06:44 -08:00
jade 5adafc5bfb fix wrong comment 2024-05-02 20:09:04 -07:00
jade 87e36b9f18 un-flakes your hub
fixes #66
2024-05-02 19:56:08 -07:00
jade 1be18e491b Merge pull request 'Check for pure eval mode before calling builtins.storePath' (#65) from 9999years/fix-64 into master
Reviewed-on: #65
2024-04-30 19:53:03 +00:00
Rebecca Turner baa7aa7bd0
Check for pure eval mode before calling builtins.storePath 2024-03-08 16:32:20 -08:00
3 changed files with 23 additions and 22 deletions

View file

@ -1,18 +0,0 @@
name: "Publish to FlakeHub"
on:
push:
tags:
- "v*.*.*"
jobs:
flakehub-publish:
runs-on: "ubuntu-latest"
permissions:
id-token: "write"
contents: "read"
steps:
- uses: "actions/checkout@v3"
- uses: "DeterminateSystems/nix-installer-action@main"
- uses: "DeterminateSystems/flakehub-push@main"
with:
name: "edolstra/flake-compat"
visibility: "public"

View file

@ -2,10 +2,25 @@
## Usage
> [!WARNING]
> During the Lix private beta period during which Forgejo is private, this
> requires configuring netrc in Lix for the tarball download to work.
>
> Your netrc should look something like so:
> ```
> machine git.lix.systems login YOUR-USERNAME password SOME-PERSONAL-ACCESS-TOKEN-REPO-READ
> ```
>
> We are terribly sorry for the UX for this being very bad
> ([issue](https://git.lix.systems/lix-project/lix/issues/254)).
To use, add the following to your `flake.nix`:
<!-- FIXME: this can use the standard non-api archive url when we are
un-privated -->
```nix
inputs.flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
inputs.flake-compat.url = "https://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/main.tar.gz";
```
Afterwards, create a `default.nix` file containing the following:
@ -15,7 +30,7 @@ Afterwards, create a `default.nix` file containing the following:
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
url = lock.nodes.flake-compat.locked.url;
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)

View file

@ -73,7 +73,7 @@ let
shortRev = builtins.substring 0 7 info.rev;
}
else
# FIXME: add Mercurial, tarball inputs.
# FIXME: add Mercurial inputs.
throw "flake input has unsupported input type '${info.type}'";
callFlake4 = flakeSrc: locks:
@ -109,7 +109,9 @@ let
# Massage `src` into a store path.
if builtins.isPath src
then
if builtins ? currentSystem && dirOf (toString src) == builtins.storeDir
if dirOf (toString src) == builtins.storeDir
# `builtins.storePath` is not available in pure-eval mode.
&& builtins ? currentSystem
then
# If it's already a store path, don't copy it again.
builtins.storePath src
@ -226,6 +228,8 @@ let
in
rec {
inputs = result.inputs // { self = result; };
defaultNix =
(builtins.removeAttrs result ["__functor"])
// (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {})