diff --git a/config/hosts/lisa.nix b/config/hosts/lisa.nix index 972d95c..231e57c 100644 --- a/config/hosts/lisa.nix +++ b/config/hosts/lisa.nix @@ -37,6 +37,7 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; luj.mediaserver.enable = true; + luj.homepage.enable = true; networking.hostName = "lisa"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. diff --git a/config/web-services/lisa-services.nix b/config/web-services/lisa-services.nix deleted file mode 100644 index 74a0b32..0000000 --- a/config/web-services/lisa-services.nix +++ /dev/null @@ -1,121 +0,0 @@ -{ config, pkgs, ... }: -{ - -services.jellyfin = { - enable = true; - group = "tv"; - package = pkgs.jellyfin; -}; - -services.sonarr = { - enable = true; - openFirewall = true; - group = "tv"; -}; - -services.radarr = { - enable = true; - openFirewall = true; - group = "tv"; -}; - -services.transmission = { - enable = true; - group = "tv"; - downloadDirPermissions = "774"; - settings = { - rpc-port = 9091; - download-dir = "/home/transmission/Downloads/"; - incomplete-dir = "/home/transmission/Incomplete/"; - incomplete-dir-enable = true; - }; -}; - -services.jackett = { - enable = true; - openFirewall = true; -}; - - -services.nginx = { - enable = true; - - virtualHosts."julienmalka.me" = { - enableACME = true; - forceSSL = true; - root = "/var/www/julienmalka.me"; - default = true; - }; - - virtualHosts."www.julienmalka.me" = { - enableACME = true; - forceSSL = true; - root = "/var/www/julienmalka.me"; - }; - - virtualHosts."tv.julienmalka.me" = { - addSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:8096"; - }; - }; - - virtualHosts."series.julienmalka.me" = { - addSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:8989"; - }; - }; - - virtualHosts."downloads.julienmalka.me" = { - addSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:9091"; - }; - }; - - virtualHosts."jackett.julienmalka.me" = { - addSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:9117"; - }; - }; - -virtualHosts."films.julienmalka.me" = { - addSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:7878"; - }; - }; - - - - -}; - - - - - - -security.acme.certs = { -"www.julienmalka.me".email = "julien.malka@me.com"; - "julienmalka.me".email = "julien.malka@me.com"; - "tv.julienmalka.me".email = "julien.malka@me.com"; - "series.julienmalka.me".email = "julien.malka@me.com"; - "downloads.julienmalka.me".email = "julien.malka@me.com"; - "jackett.julienmalka.me".email = "julien.malka@me.com"; - "films.julienmalka.me".email = "julien.malka@me.com"; -}; - -security.acme.acceptTerms = true; - - - - -} diff --git a/flake.lock b/flake.lock index acdf96b..77b13f0 100644 --- a/flake.lock +++ b/flake.lock @@ -51,6 +51,22 @@ "type": "github" } }, + "homepage": { + "flake": false, + "locked": { + "lastModified": 1638627658, + "narHash": "sha256-1mGBNxJqzvbQG4HcHfRLVn5sx+nTx5g/DzeihloGbr8=", + "owner": "JulienMalka", + "repo": "homepage", + "rev": "20d331990ad8c889ef6817ad4f84638947880ac4", + "type": "github" + }, + "original": { + "owner": "JulienMalka", + "repo": "homepage", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils", @@ -142,11 +158,11 @@ }, "nur": { "locked": { - "lastModified": 1638622311, - "narHash": "sha256-Jcn+xvme8X57vmB1THosjYHMhUqMmKiQeLbAI9rtuEA=", + "lastModified": 1638628541, + "narHash": "sha256-3xNNiD+UKdI0zMqo6FAP0/53nm6Q/GPwRITPJkYYUvg=", "owner": "nix-community", "repo": "NUR", - "rev": "3d283655b37acadb5485768bfb89d68e5263458e", + "rev": "8f0ed744fa090ccc90feea252ea0290d80c9a0d9", "type": "github" }, "original": { @@ -157,6 +173,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "homepage": "homepage", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs_3", "nur": "nur" diff --git a/flake.nix b/flake.nix index 7903e18..77e8167 100644 --- a/flake.nix +++ b/flake.nix @@ -1,43 +1,57 @@ { - description = "A flake for my personnal configurations"; - inputs = { - nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + description = "A flake for my personnal configurations"; + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + neovim-nightly-overlay = { + url = "github:nix-community/neovim-nightly-overlay"; + }; + + homepage = { + url = "github:JulienMalka/homepage"; + flake = false; + }; + + }; + + outputs = inputs@{ self, home-manager, nixpkgs, neovim-nightly-overlay, nur, ... }: + { + nixosModules = builtins.listToAttrs (map + (x: { + name = x; + value = import (./modules + "/${x}"); + }) + (builtins.attrNames (builtins.readDir ./modules))); + + nixosConfigurations = { + lisa = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + }; + system = "x86_64-linux"; + modules = builtins.attrValues self.nixosModules ++ [ + ./configuration.nix + ./config/hosts/lisa.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.julien = import ./config/home/home-lisa.nix; + nixpkgs.overlays = [ + inputs.neovim-nightly-overlay.overlay + ]; + + } + ]; - neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; }; -}; - -outputs = { self, home-manager, nixpkgs, neovim-nightly-overlay, nur, ... }@inputs : -{ - nixosModules = builtins.listToAttrs (map (x: { - name = x; - value = import (./modules + "/${x}"); - }) (builtins.attrNames (builtins.readDir ./modules))); - - nixosConfigurations = { - lisa = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = builtins.attrValues self.nixosModules ++ [./configuration.nix ./config/hosts/lisa.nix - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.julien = import ./config/home/home-lisa.nix; - nixpkgs.overlays = [ - inputs.neovim-nightly-overlay.overlay - ]; - - }]; - - }; - - }; -}; + }; + }; diff --git a/modules/filerun/default.nix b/modules/filerun/default.nix index e01d648..0985be7 100644 --- a/modules/filerun/default.nix +++ b/modules/filerun/default.nix @@ -71,7 +71,7 @@ in luj.nginx.enable = true; - virtualHosts."cloud.julienmalka.me" = { + services.nginx.virtualHosts."cloud.julienmalka.me" = { forceSSL = true; enableACME = true; locations."/" = { @@ -88,4 +88,6 @@ in - } + }; + +} diff --git a/modules/homepage/default.nix b/modules/homepage/default.nix new file mode 100644 index 0000000..208368d --- /dev/null +++ b/modules/homepage/default.nix @@ -0,0 +1,29 @@ +{ lib, pkgs, inputs, config, ... }: +with lib; +let + cfg = config.luj.homepage; +in +{ + options.luj.homepage = { + enable = mkEnableOption "enable homepage"; + }; + + config = mkIf cfg.enable + { + luj.nginx.enable = true; + services.nginx.virtualHosts."julienmalka.me" = { + enableACME = true; + forceSSL = true; + root = inputs.homepage; + default = true; + }; + + services.nginx.virtualHosts."www.julienmalka.me" = { + enableACME = true; + forceSSL = true; + root = inputs.homepage; + }; + + + }; +}