Compare commits

..

1 commit

Author SHA1 Message Date
Jairo Llopis a46249687a
fix: never attempt to call builtins.storePath in pure evaluation mode
After 5a16547d46, I started getting errors like https://github.com/nix-community/home-manager/issues/2409.

@moduon MT-1075
2023-11-22 11:22:23 +00:00
3 changed files with 22 additions and 23 deletions

18
.github/workflows/flakehub-publish.yml vendored Normal file
View file

@ -0,0 +1,18 @@
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,25 +2,10 @@
## Usage ## 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`: 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 ```nix
inputs.flake-compat.url = "https://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/main.tar.gz"; inputs.flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
``` ```
Afterwards, create a `default.nix` file containing the following: Afterwards, create a `default.nix` file containing the following:
@ -30,7 +15,7 @@ Afterwards, create a `default.nix` file containing the following:
( (
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball { fetchTarball {
url = lock.nodes.flake-compat.locked.url; url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; sha256 = lock.nodes.flake-compat.locked.narHash;
} }
) )

View file

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