From 18fc8b2aaa8d965ff7f74ae02b0a3a573b775789 Mon Sep 17 00:00:00 2001 From: efim Date: Sun, 8 Oct 2023 13:41:45 +0000 Subject: [PATCH] feat: adding a license for pushing to repo --- LICENSE | 8 ++++++++ auth-notes.org | 1 + flake.nix | 28 +++++++++++++++++++--------- 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eeaf025 --- /dev/null +++ b/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) Copyright (c) 2023 - present, Efim Nefedov + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/auth-notes.org b/auth-notes.org index 62cb9cb..b52bf92 100644 --- a/auth-notes.org +++ b/auth-notes.org @@ -175,6 +175,7 @@ oh, but if i'm using nginx i'll need my own certificate, that makes sence *** maybe things are ok? let's try to plaintext deploy? + ** TODO add docker image from nix *** TODO add cli for port and host ** TODO add readme and comments diff --git a/flake.nix b/flake.nix index 7ba2ada..5e17ab4 100644 --- a/flake.nix +++ b/flake.nix @@ -71,12 +71,15 @@ "Whether pocketbase should serve on https and issue own certs. Main case for true - when not under nginx"; }; }; - config = lib.mkIf cfg.enable { - users.groups."${shortName}-group" = { }; - users.users."${shortName}-user" = { - isSystemUser = true; - group = "${shortName}-group"; - }; + config = let + username = "${shortName}-group"; + groupname = "${shortName}-user"; + in lib.mkIf cfg.enable { + # users.groups."${groupname}" = { }; + # users.users."${username}" = { + # isSystemUser = true; + # group = "${groupname}"; + # }; systemd.services.${shortName} = let protocol = if cfg.usePbTls then "https" else "http"; serverHost = if cfg.useNginx then "127.0.0.1" else cfg.host; @@ -90,11 +93,18 @@ serviceConfig = { ExecStart = "${packages.auth-pocketbase-attempt}/bin/${pname} serve ${servedAddress} --dir=/home/${ - config.users.users."${shortName}-user" + "${username}" }"; Restart = "on-failure"; - User = "${shortName}-user"; - Group = "${shortName}-group"; + User = "${username}"; + Group = "${groupname}"; + }; + }; + services.nginx = lib.mkIf cfg.useNginx { + virtualHosts.${cfg.host} = { + locations."/".proxyPass = + "http://127.0.0.1:${toString cfg.port}"; + # TODO doesn't include tls sadly }; }; };