{
	description = "Bloggy time!";
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
		deploy-rs.url = "github:serokell/deploy-rs";
	};

	outputs = { self, nixpkgs, deploy-rs }: let
		systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
		forAllSystems = function:
			nixpkgs.lib.genAttrs systems (system: function (
				import nixpkgs {
					inherit system;
					config.allowUnfree = true;
				}
			));

	in {
		apps = forAllSystems (pkgs: {
			"deploy" = {
				type = "app";
				program = let
					ci = (pkgs.writeShellApplication {
						name = "ci.sh";
						text = ''
							nix build
						'';
					});
				in "${ci}/ci.sh";
			};
		});
		packages = forAllSystems (pkgs: {
			default = pkgs.callPackage ./package.nix {};
		});
		deploy.nodes.myblog = {
			hostname = "saji.dev";
			profiles.mysite = {
				sshUser = "static-site";
				user = "static-site";
				path = deploy-rs.lib.x86_64-linux.activate.custom self.packages.x86_64-linux.default ''
				rm -rf /var/lib/static-site/public
				ln -sn $PROFILE/public /var/lib/static-site/public
				'';
			};
		};

		devShells = forAllSystems (pkgs: {
			default = pkgs.mkShell {
				packages = with pkgs; [
					nodejs
					vips
					pkg-config
				];
			};
		});
	};

}
