nix/vm: init, nix/default: fix building
Build and test / check (push) Successful in 1m24s
Build and test / build (push) Successful in 1m26s
Build and test / test (push) Successful in 2m0s
Build and test / docs (push) Successful in 3m54s

This commit is contained in:
2026-01-05 19:18:45 +09:00
parent 7d11f143b0
commit 8156fdea51
6 changed files with 91 additions and 6 deletions
+2
View File
@@ -18,6 +18,8 @@ rustPlatform.buildRustPackage {
# buildType = "releaselto";
RUSTFLAGS = "-Zhigher-ranked-assumptions";
meta = with lib; {
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
+16 -4
View File
@@ -12,7 +12,9 @@ in {
freeformType = format.type;
options = {
rwhod = {
enable = lib.mkEnableOption "the rwhod service";
enable = lib.mkEnableOption "the rwhod service" // {
default = true;
};
# TODO: allow configuring socket config
};
@@ -24,10 +26,20 @@ in {
};
config = lib.mkIf cfg.enable {
systemd.sockets.roowho2-client = {
wantedBy = [ "sockets.target" ];
description = "Roowho2 Client Communication Socket";
listenStreams = [ "/run/roowho2/roowho2.varlink" ];
socketConfig = {
Service = "roowho2.service";
FileDescriptorName = "client_socket";
};
};
systemd.sockets.roowhoo2-rwhod = lib.mkIf cfg.settings.rwhod.enable {
systemd.sockets.roowho2-rwhod = lib.mkIf cfg.settings.rwhod.enable {
wantedBy = [ "sockets.target" ];
description = "Roowho2 Rwhod Socket";
listenDatagrams = [ 513 ];
listenDatagrams = [ (toString 513) ];
socketConfig = {
Service = "roowho2.service";
FileDescriptorName = "rwhod_socket";
@@ -37,7 +49,7 @@ in {
systemd.services.roowho2 = {
serviceConfig = {
ExecStart = "${lib.getExe' cfg.package "roowho2d"} --config ${format.toFile cfg.settings}";
ExecStart = "${lib.getExe' cfg.package "roowhod"} --config ${format.generate "roowho2-config.toml" cfg.settings}";
Restart = "on-failure";
DynamicUser = true;
+47
View File
@@ -0,0 +1,47 @@
{ self, nixpkgs, ... }:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
self.overlays.roowho2
];
};
modules = [
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
"${nixpkgs}/nixos/tests/common/user-account.nix"
self.nixosModules.default
({ config, pkgs, ... }: {
system.stateVersion = config.system.nixos.release;
virtualisation.graphics = false;
services.getty.autologinUser = "alice";
users.motd = ''
=================================
Welcome to the roowho2 vm!
Try running any of:
rwho
Password for alice is 'foobar'
To exit, press Ctrl+A, then X
=================================
'';
services.roowho2 = {
enable = true;
};
programs.vim = {
enable = true;
defaultEditor = true;
};
environment.systemPackages = with pkgs; [ jq roowho2 ];
})
];
}