Skip to content

Commit

Permalink
Format alignment between netboot and iso specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaesharp committed Jun 5, 2024
1 parent c4db724 commit 2e6ebff
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 19 deletions.
42 changes: 34 additions & 8 deletions repo/modules/services/openmesh/xnode/admin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ in
options.services.openmesh.xnode.admin = {
enable = mkEnableOption "Management service for Xnode";

localDir = mkOption {
stateDir = mkOption {
type = types.str;
default = "/var/lib/openmesh/config.nix";
description = "Local repository for nix configurations, typically a cloned git repository.";
default = "/var/lib/openmesh-xnode-admin";
description = "State storage directory.";
};

localStateFilename = mkOption {
type = types.str;
default = "config.nix";
description = "Local file destination for nix configurations.";
};

package = mkOption {
Expand All @@ -39,15 +45,35 @@ in
};

config = lib.mkIf cfg.enable {
#environment.systemPackages = [ cfg.package ];
environment.systemPackages = [ cfg.package ];

systemd.services.openmesh-xnode-admin = {
description = "Openmesh Xnode Administration and Configuration Subsystem Daemon";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];

serviceConfig = {
DynamicUser = true;
ExecStart = ''${lib.getExe cfg.package} -p ${cfg.stateDir}/${cfg.localStateFilename} ${cfg.remoteDir} ${toString cfg.searchInterval}'';
Restart = "always";
ExecStart = "${cfg.package}/src/nix_rebuilder.py \
${cfg.localDir} ${cfg.remoteDir} ${toString cfg.searchInterval}
";
WorkingDirectory = cfg.stateDir;
StateDirectory = "openmesh-xnode-admin";
RuntimeDirectory = "openmesh-xnode-admin";
RuntimeDirectoryMode = "0755";
PrivateTmp = true;
DynamicUser = true;
DevicePolicy = "closed";
LockPersonality = true;
PrivateUsers = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
RestrictNamespaces = true;
RestrictRealtime = true;
SystemCallArchitectures = "native";
UMask = "0077";
};
};

Expand Down
7 changes: 4 additions & 3 deletions repo/pkgs/openmesh/xnode/admin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pkgs.python3Packages.buildPythonPackage rec {
src = pkgs.fetchFromGitHub {
owner = "Openmesh-Network";
repo = pname;
rev = "96ee992e5f2cc95672964d7f5a55168549e501d4";
sha256 = "0p11b039vfn9696zrnl1hl6hrm60mpkhg76jrwk57rg29vy1lcfv";
rev = "568ca78e3881f1b2af988b6846ab59f316f2e731";
sha256 = "e/GVoWFKEp54gZNkllAf7Q9rBogJ0bSa3aT62pelutw=";
};

nativeBuildInputs = [
Expand All @@ -25,7 +25,8 @@ pkgs.python3Packages.buildPythonPackage rec {
meta = with lib; {
homepage = "https://openmesh.network/";
description = "Agent service for Xnode reconfiguration and management";
mainProgram = "openmesh-xnode-admin";
#license = with licenses; [ x ];
maintainers = with maintainers; [ harrys522 ];
maintainers = with maintainers; [ harrys522 j-openmesh ];
};
}
17 changes: 10 additions & 7 deletions systems/iso.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ let
};
services = {
getty = {
greetingLine = ''<<< Welcome to Openmesh Xnode/OS ${config.system.nixos.label} (\m) - \l >>>'';
greetingLine = ''<<< Welcome to Openmesh XnodeOS ${config.system.nixos.label} (\m) - \l >>>'';
};
openmesh.xnode.admin = {
enable = true;
openmesh = {
xnode = {
admin = {
enable = true;
};
};
};
};
boot = {
Expand All @@ -34,13 +38,11 @@ let
makeBiosBootable = true;
makeEfiBootable = true;
makeUsbBootable = true;
squashfsCompression = "gzip -Xcompression-level 1";
};
environment = {
systemPackages = with pkgs; [
prometheus
grafana
# (callPackage ./xnode-admin {})
# (callPackage ./openmesh-core {})
nyancat
];
};
networking = {
Expand All @@ -51,6 +53,7 @@ let
"xnode" = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
Expand Down
6 changes: 5 additions & 1 deletion systems/netboot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ let
};
};
getty = {
greetingLine = ''<<< Welcome to Openmesh Xnode/OS ${config.system.nixos.label} (\m) - \l >>>'';
greetingLine = ''<<< Welcome to Openmesh XnodeOS ${config.system.nixos.label} (\m) - \l >>>'';
};
};
environment = {
systemPackages = with pkgs; [
nyancat
];
};
netboot = {
squashfsCompression = "gzip -Xcompression-level 1";
};
networking = {
hostName = "xnode";
};
Expand All @@ -38,6 +41,7 @@ let
xnode = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
Expand Down

0 comments on commit 2e6ebff

Please sign in to comment.