refactor: propose changing to working example found at (#1422)

This commit is contained in:
samrose 2022-11-17 10:58:20 -05:00 committed by GitHub
parent 759d977879
commit b7e327c690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 35 deletions

View file

@ -11,7 +11,7 @@ A preview of the next release can be installed from
- Compile distributed uberjar using GraalVM, fixes `babashka.process/exec` for Nix
- [#1414](https://github.com/babashka/babashka/issues/1414): preserve metadata on exec task function argument map
- [#1269](https://github.com/babashka/babashka/issues/1269): add lib tests for sluj ([@bobisageek](https://github.com/bobisageek))
- Update nix app example in docs
## 1.0.165 (2022-11-01)
- Fix [#1401](https://github.com/babashka/babashka/issues/1401): mutation of `deftype` field should be visible in protocol method

View file

@ -81,39 +81,7 @@ After running `direnv allow`, babashka should be available on the `$PATH`, when
You can write babashka scripts with native dependencies using [WriteBabashkaApplication](https://github.com/sohalt/write-babashka-application).
Here is an example `flake.nix` using `cowsay` as an external dependency:
The WriteBabashkaApplication repository has an [example](https://github.com/Sohalt/write-babashka-application/tree/main/example) `flake.nix` using `cowsay` as an external dependency.
```nix
{
inputs.wbba.url = "github:sohalt/write-babashka-application";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { nixpkgs, flake-utils, wbba, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ wbba.overlay ];
};
hello-babashka = pkgs.writeBabashkaApplication {
name = "hello";
runtimeInputs = with pkgs;[
cowsay # add your dependencies here
];
text = ''
(ns hello
(:require [babashka.process :refer [sh]]))
(-> (sh ["cowsay" "hello from babashka"])
:out
print)
'';
};
in
{
defaultApp = hello-babashka;
defaultPackage = hello-babashka;
});
}
```
You can then build the application using `nix build` or run it using `nix run`.
You can download that example, and then build the application using `nix build` or run it using `nix run`.