blob: 9631392c2411eb8e21266e2170dd6e2eab348837 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# Packing your Yoshi configuration with nix
If you want to declare Yoshi in your nixos configuration, here's how.
First, add Yoshi to your nix flake:
```nix
{
inputs = {
yoshi = {
url = "github:bluedragon1221/yoshi";
flake = false;
};
};
}
```
Next, write a package for Yoshi. This is how I achieved it:
```sh
{
pkgs,
inputs,
...
}: let
yossh = pkgs.writeText "yossh.lua" ''
yoshi = dofile'${inputs.yoshi-lua}/yoshi.lua'
yoshi.hosts["box"] = yoshi.ssh{
HostName = "192.168.50.3",
User = "yoshi"
}
yoshi.run(arg)
'';
in
pkgs.writeShellScriptBin "yossh" ''
exec ${pkgs.lua}/bin/lua ${yossh} "$@"
''
```
Then add the package in `environment.systemPackages`:
```nix
environment.systemPackages = [
(pkgs.callPackage ./yossh.nix {inherit inputs;})
]
```
|