diff --git a/flake.lock b/flake.lock index 1bb48ae..10091ea 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,44 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711535911, + "narHash": "sha256-SzgDrsyBskLyipFzsKwPOKP9FMgGB+6tUQ0VpeGQ/1Y=", + "ref": "refs/heads/main", + "rev": "80221fa4d735fbc232d97d3384c8af0e40a4e331", + "revCount": 9, + "type": "git", + "url": "https://git.sondell.org/glennwso/home.git" + }, + "original": { + "type": "git", + "url": "https://git.sondell.org/glennwso/home.git" + } + }, "nixpkgs": { "locked": { "lastModified": 1709237383, @@ -18,8 +57,24 @@ }, "root": { "inputs": { + "home": "home", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 12caad0..d733922 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,18 @@ { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.home.url = "git+https://git.sondell.org/glennwso/home.git"; + inputs.home.inputs.nixpkgs.follows = "nixpkgs"; - outputs = { self, nixpkgs }@attrs: { + outputs = { self, nixpkgs, home }@attrs: + let + system = "x86_64-linux"; + homepage = home.packages.${system}.default; + in + { # replace 'joes-desktop' with your hostname here. - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem + { + inherit system; specialArgs = attrs; modules = [ ./configuration.nix @@ -16,6 +24,7 @@ ./filebrowser.nix ./tail.nix ./matrix.nix + (import ./homepage.nix {inherit homepage;}) # ./coturn.nix # disabled becouse tls not solved ]; diff --git a/homepage.nix b/homepage.nix new file mode 100644 index 0000000..b250c47 --- /dev/null +++ b/homepage.nix @@ -0,0 +1,29 @@ +{ homepage, ... }: + +let + domain = "sondell.org"; + port = "8118"; +in +{ + systemd.services.homepage = { + enable = true; + description = "homepage with links to selfhosted services"; + wantedBy = [ "multi-user.target" ]; + unitConfig = { + After="network-online.target"; + }; + serviceConfig = { + ExecStart = "${homepage}/bin/homepage -p ${port}"; + User= "sondell"; + Type= "simple"; + }; + }; + + services.nginx.virtualHosts.${domain} = { + locations."/" = { + proxyPass = "http://localhost:${port}/"; + proxyWebsockets = true; + }; + }; +} + diff --git a/matrix.nix b/matrix.nix index 2b19a33..41aaa84 100644 --- a/matrix.nix +++ b/matrix.nix @@ -64,23 +64,23 @@ services.postgresql = { locations."/_synapse/client".proxyPass = "http://[::1]:8008"; }; - ${domain} = { - # enableACME = true; - # forceSSL = true; - locations."/" = { - proxyPass = "http://localhost:8008"; - }; - # This section is not needed if the server_name of matrix-synapse is equal to - # the domain (i.e. example.org from @foo:example.org) and the federation port - # is 8448. - # Further reference can be found in the docs about delegation under - # https://element-hq.github.io/synapse/latest/delegate.html - locations."= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig; - # This is usually needed for homeserver discovery (from e.g. other Matrix clients). - # Further reference can be found in the upstream docs at - # https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixclient - locations."= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig; - }; + # ${domain} = { + # # enableACME = true; + # # forceSSL = true; + # locations."/" = { + # proxyPass = "http://localhost:8008"; + # }; + # # This section is not needed if the server_name of matrix-synapse is equal to + # # the domain (i.e. example.org from @foo:example.org) and the federation port + # # is 8448. + # # Further reference can be found in the docs about delegation under + # # https://element-hq.github.io/synapse/latest/delegate.html + # locations."= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig; + # # This is usually needed for homeserver discovery (from e.g. other Matrix clients). + # # Further reference can be found in the upstream docs at + # # https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixclient + # locations."= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig; + # }; }; } diff --git a/tunnel.nix b/tunnel.nix index 739c85e..cb34469 100644 --- a/tunnel.nix +++ b/tunnel.nix @@ -13,6 +13,7 @@ default = "http_status:404"; ingress = { "*.sondell.org" = "http://localhost:1234"; + "sondell.org" = "http://localhost:1234"; }; }; };