{"action":"created","issue":{"url":"https://api.github.com/repos/Holo-Host/holoportos/issues/13","repository_url":"https://api.github.com/repos/Holo-Host/holoportos","labels_url":"https://api.github.com/repos/Holo-Host/holoportos/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/Holo-Host/holoportos/issues/13/comments","events_url":"https://api.github.com/repos/Holo-Host/holoportos/issues/13/events","html_url":"https://github.com/Holo-Host/holoportos/issues/13","id":366008917,"node_id":"MDU6SXNzdWUzNjYwMDg5MTc=","number":13,"title":"solve dynamic loading of container configuration in configuration.nix","user":{"login":"samrose","id":115821,"node_id":"MDQ6VXNlcjExNTgyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/115821?v=4","gravatar_id":"","url":"https://api.github.com/users/samrose","html_url":"https://github.com/samrose","followers_url":"https://api.github.com/users/samrose/followers","following_url":"https://api.github.com/users/samrose/following{/other_user}","gists_url":"https://api.github.com/users/samrose/gists{/gist_id}","starred_url":"https://api.github.com/users/samrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samrose/subscriptions","organizations_url":"https://api.github.com/users/samrose/orgs","repos_url":"https://api.github.com/users/samrose/repos","events_url":"https://api.github.com/users/samrose/events{/privacy}","received_events_url":"https://api.github.com/users/samrose/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"samrose","id":115821,"node_id":"MDQ6VXNlcjExNTgyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/115821?v=4","gravatar_id":"","url":"https://api.github.com/users/samrose","html_url":"https://github.com/samrose","followers_url":"https://api.github.com/users/samrose/followers","following_url":"https://api.github.com/users/samrose/following{/other_user}","gists_url":"https://api.github.com/users/samrose/gists{/gist_id}","starred_url":"https://api.github.com/users/samrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samrose/subscriptions","organizations_url":"https://api.github.com/users/samrose/orgs","repos_url":"https://api.github.com/users/samrose/repos","events_url":"https://api.github.com/users/samrose/events{/privacy}","received_events_url":"https://api.github.com/users/samrose/received_events","type":"User","site_admin":false},"assignees":[{"login":"samrose","id":115821,"node_id":"MDQ6VXNlcjExNTgyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/115821?v=4","gravatar_id":"","url":"https://api.github.com/users/samrose","html_url":"https://github.com/samrose","followers_url":"https://api.github.com/users/samrose/followers","following_url":"https://api.github.com/users/samrose/following{/other_user}","gists_url":"https://api.github.com/users/samrose/gists{/gist_id}","starred_url":"https://api.github.com/users/samrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samrose/subscriptions","organizations_url":"https://api.github.com/users/samrose/orgs","repos_url":"https://api.github.com/users/samrose/repos","events_url":"https://api.github.com/users/samrose/events{/privacy}","received_events_url":"https://api.github.com/users/samrose/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-10-02T17:48:51Z","updated_at":"2018-10-03T15:12:42Z","closed_at":"2018-10-02T18:18:28Z","author_association":"CONTRIBUTOR","body":"A script should be able to create a nix expression file from a template, and nixos should be able to find this nix expression file in a specific directory, and follow it's instructions to create and start a container.\r\n\r\nWhen the container configuration file is removed from the same directory, the container should also be stopped, and removed.\r\n\r\nThe following solution worked:\r\n\r\n```\r\n{ config, pkgs, lib, ... }:\r\n{ \r\n  containers.<containername> =\r\n    {  privateNetwork = true;\r\n       hostAddress = \"<ipaddr>\";\r\n       localAddress = \"<ipaddr>\";\r\n       autoStart = true;\r\n       #not supported under 18.03 extraFlags = [];\r\n      config =\r\n      { config, pkgs, ... }:\r\n      { \r\n        #services enabled go here, for exmaple:\r\n        #services.postgresql.enable = true;\r\n        #services.postgresql.package = pkgs.postgresql96;\r\n        #create a non-root user in the container    \r\n        users.extraUsers.<user> = {\r\n          isNormalUser = true;\r\n          extraGroups = [ \"<group>\" ];\r\n        };\r\n      };\r\n  };\r\n}\r\n```\r\n\r\nthe importing of the files from the dir worked by using:\r\n\r\n```\r\n{  config, pkgs, lib, ... }:\r\nwith lib;\r\n\r\n{\r\n\r\n \r\n  # use the nix module system to have type validation and inherit meaningful default values for options which are not set explicitly\r\n  config = {\r\n  };\r\n\r\n  imports =\r\n  let\r\n    cDir = builtins.toPath (./config);\r\n\r\n    filesToLoad = attrNames (filterAttrs (k: v: v == \"regular\") (builtins.readDir cDir));\r\n    configsFromPath = map (el: (cDir + (\"/\" + el) )) filesToLoad;\r\n  in\r\n    fold (el: c: c ++ [(import el)]) [  ] configsFromPath;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Holo-Host/holoportos/issues/comments/426674519","html_url":"https://github.com/Holo-Host/holoportos/issues/13#issuecomment-426674519","issue_url":"https://api.github.com/repos/Holo-Host/holoportos/issues/13","id":426674519,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjY3NDUxOQ==","user":{"login":"samrose","id":115821,"node_id":"MDQ6VXNlcjExNTgyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/115821?v=4","gravatar_id":"","url":"https://api.github.com/users/samrose","html_url":"https://github.com/samrose","followers_url":"https://api.github.com/users/samrose/followers","following_url":"https://api.github.com/users/samrose/following{/other_user}","gists_url":"https://api.github.com/users/samrose/gists{/gist_id}","starred_url":"https://api.github.com/users/samrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samrose/subscriptions","organizations_url":"https://api.github.com/users/samrose/orgs","repos_url":"https://api.github.com/users/samrose/repos","events_url":"https://api.github.com/users/samrose/events{/privacy}","received_events_url":"https://api.github.com/users/samrose/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T15:12:41Z","updated_at":"2018-10-03T15:12:41Z","author_association":"CONTRIBUTOR","body":"Live rebuild of OS does stop all containers (other configuration changes do not stop all containers).\r\n\r\nHowever, they are all gracefully stopped as mentioned above"}}
{"actor":{"display_login":"samrose"}}