refactor: propose changing to working example found at (#1422)
This commit is contained in:
parent
759d977879
commit
b7e327c690
2 changed files with 3 additions and 35 deletions
|
|
@ -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
|
||||
|
|
|
|||
36
doc/nix.md
36
doc/nix.md
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue