diff --git a/flake.lock b/flake.lock index e9a6253..5b46b2c 100644 --- a/flake.lock +++ b/flake.lock @@ -32,11 +32,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1649667661, - "narHash": "sha256-9cbstidkXdAC3ZzokV6clgCoeLSbbs2tis9KFsqCzTM=", + "lastModified": 1650097359, + "narHash": "sha256-5yz+ws47yxpu2BOZr8+Ht9t44yPsb6kWz1r1eftLg0I=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a48aeae76ad50bb15ad9bda2cf51d7ae5c621853", + "rev": "70d0e2456857dc10dd7d2654277fc1dd8d8cc216", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index abf9954..30dfb4f 100644 --- a/flake.nix +++ b/flake.nix @@ -60,50 +60,48 @@ ''; }; defaultPackage = self.packages.${system}.site; - - # also need a module that refreshes this flake.lock, but maybe that shouldn't live here? - nixosModule = { options, lib, config, pkgs, ... }: - let - serverName = "anish.lakhwara.com"; - webRoot = "/var/www/${serverName}"; - - serviceConfig = config.services."${serverName}"; - options = { - enable = lib.mkEnableOption "${serverName} service"; - }; - in - { - options.services.${serverName} = options; - config = lib.mkIf serviceConfig.enable { - systemd.services."source-${serverName}" = { - description = '' - https://${serverName} source - ''; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - DynamicUser = "yes"; - }; - startAt = "*00:00:00"; - path = with pkgs; [ nix gnutar gzip curl jq ] ++ [ self.packages.${system}.site ]; - script = '' - set -ex - - ln -sfT ${self.packages.${system}.site} ${webRoot} - ''; - }; - # Allow nginx through the firewall - networking.firewall.allowedTCPPorts = [ 80 ]; - services.nginx.enable = true; - services.nginx.virtualHosts.${serverName} = { - forceSSL = true; - enableACME = true; - locations."/" = { root = "${webRoot}"; }; - }; - - }; - }; }) // { + # also need a module that refreshes this flake.lock, but maybe that shouldn't live here? + nixosModule = { options, lib, config, pkgs, ... }: + let + serverName = "anish.lakhwara.com"; + webRoot = "/var/www/"; + + serviceConfig = config.services."${serverName}"; + options = { + enable = lib.mkEnableOption "${serverName} service"; + }; + in + { + options.services.${serverName} = options; + config = lib.mkIf serviceConfig.enable { + systemd.services."source-${serverName}" = { + description = '' + https://${serverName} source + ''; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + }; + startAt = "*00:00:00"; + path = with pkgs; [ nix ] ++ [ self.packages.${system}.site ]; + script = '' + set -ex + + mkdir -p ${webRoot} + ln -sfT ${self.packages.${pkgs.system}.site} ${webRoot}${serverName} + ''; + }; + # Allow nginx through the firewall + networking.firewall.allowedTCPPorts = [ 80 ]; + services.nginx.enable = true; + services.nginx.virtualHosts.${serverName} = { + #forceSSL = true; + #enableACME = true; + locations."/" = { root = "${webRoot}${serverName}"; index = "/home.html"; }; + }; + }; + }; # Test container nixosConfigurations."test" = nixpkgs.lib.nixosSystem { system = "x86_64-linux";