From c58d08725fadfbdb2373ebbf653f0286d82f0da2 Mon Sep 17 00:00:00 2001 From: matthewcroughan Date: Wed, 13 Jul 2022 07:45:04 +0100 Subject: [PATCH] examples: init --- examples/launchCageOnBoot.nix | 17 +++++++++++++++++ examples/launchSwayOnBoot.nix | 10 ++++++++++ examples/mosquitto.nix | 18 ++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 examples/launchCageOnBoot.nix create mode 100644 examples/launchSwayOnBoot.nix create mode 100644 examples/mosquitto.nix diff --git a/examples/launchCageOnBoot.nix b/examples/launchCageOnBoot.nix new file mode 100644 index 0000000..78c9d66 --- /dev/null +++ b/examples/launchCageOnBoot.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: +let + welcomeMessage = "visionfive-nix"; + xtermWelcomeScript = pkgs.writeScript "xterm-visionfive-welcome.sh" '' + ${pkgs.figlet}/bin/figlet -c ${welcomeMessage} + ${pkgs.neofetch}/bin/neofetch + sh + ''; +in +{ + hardware.opengl.enable = true; + services.cage = { + enable = true; + user = "default"; + program = "${pkgs.xterm}/bin/xterm -fa 'Monospace' -fs 14 -bg black -fg white -e sh -c '${xtermWelcomeScript}'"; + }; +} diff --git a/examples/launchSwayOnBoot.nix b/examples/launchSwayOnBoot.nix new file mode 100644 index 0000000..98eb403 --- /dev/null +++ b/examples/launchSwayOnBoot.nix @@ -0,0 +1,10 @@ +{ + programs = { + sway.enable = true; + bash.loginShellInit = '' + if [[ "$(tty)" == /dev/tty1 ]]; then + exec sway &> /dev/null + fi + ''; + }; +} diff --git a/examples/mosquitto.nix b/examples/mosquitto.nix new file mode 100644 index 0000000..ef7c63d --- /dev/null +++ b/examples/mosquitto.nix @@ -0,0 +1,18 @@ +{ + networking.firewall.allowedTCPPorts = [ 1883 ]; + services.mosquitto = { + enable = true; + settings.max_keepalive = 300; + listeners = [ + { + port = 1883; + omitPasswordAuth = true; + users = {}; + settings = { + allow_anonymous = true; + }; + acl = [ "topic readwrite #" ]; + } + ]; + }; +}