From 3a1dcee2dbdc63ce82a954bf7c45d32464bd0258 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 21 Sep 2025 20:07:00 +0200 Subject: [PATCH 1/3] package.nix: set `mainProgram` --- nix/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix/package.nix b/nix/package.nix index 00fbfb0..85ef8fb 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -51,4 +51,6 @@ stdenvNoCC.mkDerivation { install -Dm555 "$wrapperPath" "$out"/bin/qotd runHook postInstall ''; + + meta.mainProgram = "qotd"; } -- 2.51.2 From d15e8e5cf9c0d78e503ef98a02ad30e3e838252c Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 21 Sep 2025 20:07:56 +0200 Subject: [PATCH 2/3] flake.nix: add vm + runnables --- .gitignore | 1 + flake.nix | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 96dd39d..549b46f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.uasm result +*.qcow2 diff --git a/flake.nix b/flake.nix index e061171..0ba2601 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs }: let inherit (nixpkgs) lib; @@ -16,6 +16,19 @@ pkgs = nixpkgs.legacyPackages.${system}; in f system pkgs); in { + apps = forAllSystems ( + system: pkgs: { + default = { + type = "app"; + program = "${lib.getExe self.packages.${system}.default}"; + }; + vm = { + type = "app"; + program = "${self.nixosConfigurations.vm.config.system.build.vm}/bin/run-nixos-vm"; + }; + } + ); + devShells = forAllSystems (system: pkgs: { default = pkgs.mkShell { nativeBuildInputs = [ @@ -33,5 +46,64 @@ }; nixosModules.default = ./nix/module.nix; + + nixosConfigurations.vm = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + pkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ + self.overlays.default + ]; + }; + + modules = [ + "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" + self.nixosModules.default + ({ config, pkgs, ... }: { + system.stateVersion = config.system.nixos.release; + virtualisation.graphics = false; + users.extraUsers.root.password = "root"; + services.getty.autologinUser = "root"; + + environment.systemPackages = with pkgs; [ + netcat + ]; + + users.motd = '' + ======================= + + Welcome to the qotd vm! + + Try running: + + nc localhost 17 + + ======================= + ''; + + services.qotd = { + enable = true; + quotes = [ + '' + "rm -rf /" + + - felixalb on bekkalokk, 2026 (probably) + '' + '' + ( U I U A ) + 汎用配列指向プログラミング言語 + + - frero, 2025 + '' + '' + bwaaa :3 + + - oysteikt on gitea, 2024 + '' + ]; + }; + }) + ]; + }; }; } -- 2.51.2 From 77998b3ef5d52462da35049a5c2cc89b1fa00844 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 21 Sep 2025 20:10:09 +0200 Subject: [PATCH 3/3] README: clean, add build instructions --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92f1969..d38cefa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,23 @@ -this is wip +# QOTD daemon -the idea was to create a uiua program that serves the [qotd port +> [! CAUTION] +> This is WIP + +The idea was to create a uiua program that serves the [qotd port 17](https://en.wikipedia.org/wiki/QOTD) then host it on one of pvv's machines. this to learn about socket programming in uiua, and to show some love to the oft-forgotten port 17. + +## Building and running + +**Build:** + +```console +$ nix build +``` + +**Run in VM:** + +```console +$ nix run .#vm +``` -- 2.51.2