Add some inline instructions to the demo

This commit is contained in:
Tim Van Baak 2023-06-19 12:33:39 -07:00
parent 1dbf7ddb60
commit 2f6321f6ca
5 changed files with 36 additions and 19 deletions

View File

@ -1,4 +0,0 @@
{
"username": "alice",
"secret": "alpha"
}

View File

@ -1,4 +0,0 @@
{
"username": "bob",
"secret": "beta"
}

View File

@ -7,11 +7,13 @@ flake: { pkgs, ... }:
users.users.alice = { users.users.alice = {
isNormalUser = true; isNormalUser = true;
password = "alpha"; password = "alpha";
uid = 1000;
}; };
users.users.bob = { users.users.bob = {
isNormalUser = true; isNormalUser = true;
password = "beta"; password = "beta";
uid = 1001;
}; };
# Put intake on both users' PATH # Put intake on both users' PATH
@ -46,16 +48,39 @@ flake: { pkgs, ... }:
# Create an activation script that copies and chowns the demo content # Create an activation script that copies and chowns the demo content
# chmod 777 because the users may not exist when the activation script runs # chmod 777 because the users may not exist when the activation script runs
system.activationScripts.demoSetup = '' system.activationScripts =
${pkgs.coreutils}/bin/mkdir -p /home/alice/.local/share/intake let
${pkgs.coreutils}/bin/cp -r /mnt/alice/* /home/alice/.local/share/intake/ userSetup = name: uid: ''
${pkgs.coreutils}/bin/chmod -R 777 /home/alice/.local ${pkgs.coreutils}/bin/mkdir -p /home/${name}/.local/share/intake
${pkgs.coreutils}/bin/cp -r /mnt/${name}/* /home/${name}/.local/share/intake/
${pkgs.coreutils}/bin/mkdir -p /home/bob/.local/share/intake ${pkgs.coreutils}/bin/chown -R ${uid} /home/${name}
${pkgs.coreutils}/bin/cp -r /mnt/bob/* /home/bob/.local/share/intake/ ${pkgs.findutils}/bin/find /home/${name} -type d -exec ${pkgs.coreutils}/bin/chmod 755 {} \;
${pkgs.coreutils}/bin/chmod -R 777 /home/bob/.local ${pkgs.findutils}/bin/find /home/${name} -type f -exec ${pkgs.coreutils}/bin/chmod 644 {} \;
''; '';
in
{
aliceSetup = userSetup "alice" "1000";
bobSetup = userSetup "bob" "1001";
};
# Put the demo sources on the global PATH # Put the demo sources on the global PATH
environment.variables.PATH = "/mnt/sources"; environment.variables.PATH = "/mnt/sources";
# Include some demo instructions
environment.etc.issue.text = ''
# Welcome to the intake demo! Log in as `alice` with password `alpha` to begin.
# Exit the VM with ctrl+a x, or switch to the qemu console with ctrl+a c and `quit`.
'';
users.motd = ''
# To set a password for the web interface, run `intake passwd` and set a password.
# Within this demo VM, the main intake entry point can be found at localhost:8080. This is also exposed on the host machine at localhost:5234. After you set a password, navigate to localhost:5234 on your host machine and log in to see the web interface.
# Try updating the currenttime source by running `intake update -s currenttime`. You should see a new item after refreshing the source's feed.
# The `echo` source demonstrates the use of `env` source configuration. Try changing the message in the web interface or via `intake edit -s echo`, then updating the source.
'';
} }

View File

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/sh
echo {\"id\": \"$(date +%Y-%m-%d-%H-%M)\"} echo {\"id\": \"$(date +%Y-%m-%d-%H-%M)\"}

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
import hashlib, json, os, sys import hashlib, json, os, sys