Compare commits

...

7 commits
main ... main

Author SHA1 Message Date
jade fe7f6ec62b Merge pull request 'Update readme' (#67) from cobaltcause/flake-compat:readme into main
Reviewed-on: lix-project/flake-compat#67
2024-11-26 06:42:46 +00:00
Charles Hall e44e6cf654
prefix fetchTarball with builtins. too
For consistency/clarity.
2024-11-25 11:30:47 -08:00
Charles Hall 8c1dda128e
document that flake = false is optional
Some projects like to set `flake = false` for all inputs; this is
good for them to know so they can stay consistent about it.
2024-11-25 11:30:23 -08:00
Charles Hall 6327d063de
don't depend on input that can change
That would break when:

* A flake.lock is created
* The main branch is updated
* The user doesn't have the tarball corresponding to the previous
  version of the main branch in their store

because the hashes won't match.
2024-11-25 11:30:14 -08:00
Charles Hall 1fadfb6600
remove warning about lix being private
Because it isn't anymore.
2024-11-25 11:28:22 -08:00
jade 33a2aba01c Merge pull request 'make flake inputs easily available to classic nix' (#68) from cobaltcause/flake-compat:expose-inputs into main
Reviewed-on: lix-project/flake-compat#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
2 changed files with 14 additions and 20 deletions

View file

@ -2,25 +2,14 @@
## 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://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/main.tar.gz";
inputs.flake-compat = {
url = "git+https://git.lix.systems/lix-project/flake-compat";
# Optional:
flake = false;
};
```
Afterwards, create a `default.nix` file containing the following:
@ -28,10 +17,13 @@ Afterwards, create a `default.nix` file containing the following:
```nix
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url;
sha256 = lock.nodes.flake-compat.locked.narHash;
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
inherit (lock.nodes.flake-compat.locked) narHash rev url;
in
builtins.fetchTarball {
url = "${url}/archive/${rev}.tar.gz";
sha256 = narHash;
}
)
{ src = ./.; }

View file

@ -228,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 {})