Skip to content

Commit

Permalink
fix: openMCT Service, updated openMCT 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-logger committed Nov 23, 2023
1 parent a91a1bf commit 2e5e855
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 202 deletions.
2 changes: 1 addition & 1 deletion nixOS/Systems/Base/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
package = pkgs.nixVersions.unstable;
#registry.nixpkgs.flake = inputs.nixpkgs;
extraOptions = ''
experimental-features = nix-command flakes
experimental-features = nix-command flakes repl-flake
keep-outputs = true
keep-derivations = true
'';
Expand Down
11 changes: 6 additions & 5 deletions nixOS/Systems/Base/sky360mct.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{ ... }: {
{ pkgs, sky360, ... }: {
imports = [
# ../../dream2nix/packages/openmct
../../dream2nix/packages/openmct/sky360mct_service.nix
];

# imports = [
# ./services/openmct.nix # TODO: move to the flake.nix of sky360
# ];
services.sky360.openmct = {
services.sky360.openmct = {
enable = true;
openFirewall = true;
# TODO: need to test
Expand Down
2 changes: 1 addition & 1 deletion nixOS/Systems/cyclop/networking.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ config, pkgs, ... }:
{
networking.firewall.allowedTCPPorts = [ 8080 ]; # 45563 - obs-teleport
# networking.firewall.allowedTCPPorts = [ 8080 ]; # 45563 - obs-teleport

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions nixOS/dream2nix/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
description = "My flake with dream2nix packages";

inputs = {
dream2nix.url = "github:nix-community/dream2nix";
nixpkgs.follows = "dream2nix/nixpkgs";
# flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs =
inputs @ { self
, dream2nix
, nixpkgs
# , flake-parts
, ...
}:
let
system = "aarch64-linux"; # TODO: support multi-systems using flake-utils or flake-parts
in {
packages.${system}.packages = dream2nix.lib.importPackages {
packageSets.nixpkgs = nixpkgs.legacyPackages.${system};
projectRoot = ./.;
projectRootFile = "flake.nix";
packagesDir = ./packages;
};
};
}
33 changes: 0 additions & 33 deletions nixOS/dream2nix/packages/flake.nix

This file was deleted.

4 changes: 2 additions & 2 deletions nixOS/dream2nix/packages/openmct/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
dream2nix.modules.dream2nix.nodejs-granular-v3
];

name = "sky360_openmct";
version = "0.0.1";
name = "openmct";
version = "0.1.0";

mkDerivation = {
src = ./.;
Expand Down
46 changes: 0 additions & 46 deletions nixOS/dream2nix/packages/openmct/flake.nix

This file was deleted.

10 changes: 5 additions & 5 deletions nixOS/dream2nix/packages/openmct/lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"ws": "^6.1.2"
},
"bin": {
"sky360_openmct": "src/server.js"
"openmct": "src/server.js"
}
},
"node_modules/accepts": {
Expand Down Expand Up @@ -477,9 +477,9 @@
}
},
"node_modules/openmct": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/openmct/-/openmct-3.0.2.tgz",
"integrity": "sha512-gKCV0aLXGSyF4bJGPmQnR9I580KpsS6m8DaW3cSvdKGYNyd5d71CgjjXGU7MRe/c7dObXZo/J92WPT4OIerPKw==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/openmct/-/openmct-3.1.1.tgz",
"integrity": "sha512-BUc+lNPj8ENqbqEBcK48RdF/5QGz9m/qj12kea8LMHPaUOYsOt0IojGE9/nrkyYuEIeX7H3eqmo+X8smSF0p7A==",
"engines": {
"node": ">=16.19.1 <20"
}
Expand Down Expand Up @@ -705,5 +705,5 @@
}
}
},
"invalidationHash": "6190f66346eff2ca4558d419bf387c149900d17fe51f2dd6be80d9325563529c"
"invalidationHash": "0f739b7d77f1743dee2c79f8cb682ebcf65a73f67558d3594e40eaa04e9dc984"
}
2 changes: 1 addition & 1 deletion nixOS/dream2nix/packages/openmct/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"clean": "rm -rf node_modules package-lock.json"
},
"bin": {
"sky360_openmct": "src/server.js"
"openmct": "src/server.js"
},
"repository": {
"type": "git",
Expand Down
25 changes: 16 additions & 9 deletions nixOS/dream2nix/packages/openmct/sky360mct_service.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, sky360, ... }:

with lib;

let
cfg = config.services.sky360.openmct;
defaultUser = "openmct";
defaultGroup = defaultUser;
sky360Packages.openmct = "${./flake.nix}.packages.sky360_openmct";
# FIXME: remove hardcoded system `aarch64-linux`
defaultPackage = sky360.packages.aarch64-linux.packages.openmct;
# defaultPackage = sky360.packages.openmct;
in
{
options.services.sky360.openmct = {
enable = mkEnableOption (mdDoc "Sky360's openMCT service");

# package = mkOption {
# default = sky360Packages.openmct;
# defaultText = literalExpression "sky360Packages.openmct";
# type = types.package;
# description = lib.mdDoc "openMCT package to use";
# };
package = mkOption {
default = defaultPackage;
defaultText = literalExpression "sky360.packages.openmct";
type = types.package;
description = lib.mdDoc "openMCT package to use";
};

openFirewall = mkOption {
type = types.bool; # NOTE: this is why nix language can not be dynamic and require a proper type system. I just don't get it sometimes...the compliation of the code won't slow down compare to a build....
Expand Down Expand Up @@ -70,17 +72,22 @@ in
allowedTCPPorts = [ cfg.port ];
};

environment.systemPackages = with pkgs; [
# cfg.package
];

systemd.services.openmct = {
description = "Sky360 openMCT Service";
wantedBy = [ "multi-user.target" ];
after = [ "networking.target" ];
environment = { HOME = cfg.userDir; };
path = [ cfg.package ];
serviceConfig = mkMerge [{
User = cfg.security.user;
Group = cfg.security.group;
# TODO: support --port and more params
# ExecStart = "${sky360Packages.openmct}/bin/sky360_openmct --port $toString cfg.port}";
ExecStart = "${sky360Packages.openmct}/bin/sky360_openmct";
ExecStart = "${cfg.package}/bin/openmct";
PrivateTmp = true;
Restart = "always"; # TODO: write options
WorkingDdddirectory = cfg.userDir;
Expand Down
Loading

0 comments on commit 2e5e855

Please sign in to comment.