Add real source programs to PATH
This commit is contained in:
parent
e03b82dbea
commit
0c86a78d51
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"action": {
|
||||
"fetch": {
|
||||
"exe": "sh",
|
||||
"args": [
|
||||
"-c",
|
||||
"echo {\\\"id\\\": \\\"$(date +%Y-%m-%d-%H-%M)\\\"}"
|
||||
]
|
||||
"exe": "currenttime.sh",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"action": {
|
||||
"fetch": {
|
||||
"exe": "echo.py",
|
||||
"args": []
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"MESSAGE": "Hello, Alice!"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"action": {
|
||||
"fetch": {
|
||||
"exe": "echo.py",
|
||||
"args": []
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"MESSAGE": "Hello, Bob!"
|
||||
}
|
||||
}
|
|
@ -40,19 +40,22 @@ flake: { pkgs, ... }:
|
|||
extraMounts = {
|
||||
"/mnt/alice" = ./alice;
|
||||
"/mnt/bob" = ./bob;
|
||||
"/mnt/sources" = ./sources;
|
||||
};
|
||||
};
|
||||
|
||||
# Create an activation script that copies and chowns the demo content
|
||||
# chmod 777 because the users may not exist when the activation script runs
|
||||
system.activationScripts.demoSetup = ''
|
||||
${pkgs.coreutils}/bin/mkdir -p /home/alice/.local/share/intake
|
||||
${pkgs.coreutils}/bin/cp -r /mnt/alice/* /home/alice/.local/share/intake/
|
||||
${pkgs.coreutils}/bin/chgrp -R users /home/alice
|
||||
${pkgs.coreutils}/bin/chmod -R 775 /home/alice/.local
|
||||
${pkgs.coreutils}/bin/chmod -R 777 /home/alice/.local
|
||||
|
||||
${pkgs.coreutils}/bin/mkdir -p /home/bob/.local/share/intake
|
||||
${pkgs.coreutils}/bin/cp -r /mnt/bob/* /home/bob/.local/share/intake/
|
||||
${pkgs.coreutils}/bin/chgrp -R users /home/bob
|
||||
${pkgs.coreutils}/bin/chmod -R 775 /home/bob/.local
|
||||
${pkgs.coreutils}/bin/chmod -R 777 /home/bob/.local
|
||||
'';
|
||||
|
||||
# Put the demo sources on the global PATH
|
||||
environment.variables.PATH = "/mnt/sources";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
echo {\"id\": \"$(date +%Y-%m-%d-%H-%M)\"}
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import hashlib, json, os, sys
|
||||
|
||||
echo = os.environ.get("MESSAGE", "Hello, world!")
|
||||
item = {
|
||||
"id": hashlib.md5(echo.encode("utf8")).hexdigest(),
|
||||
"title": echo,
|
||||
}
|
||||
print(json.dumps(item), file=sys.stdout)
|
Loading…
Reference in New Issue