From 3eb00b88cd6dc9e7405c813e1e6c4e573eaa9b6e Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 11 Apr 2023 02:57:45 +0000 Subject: [PATCH] Update configuration to work with updated blog static flake --- configuration.nix | 111 ++++++++++++++++++++++++---------------------- flake.lock | 17 +++---- flake.nix | 9 ++-- 3 files changed, 70 insertions(+), 67 deletions(-) diff --git a/configuration.nix b/configuration.nix index be4faac..82318b4 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,55 +1,62 @@ -{ pkgs, system, builders, ... }: { - imports = [ - ./hardware-configuration.nix - ./networking.nix # generated at runtime by nixos-infect - ]; - - nix = { - package = pkgs.nixUnstable; - extraOptions = '' - experimental-features = nix-command flakes - ''; +{ pkgs, system, blog, ... }: +let + productionSite = blog.english { + ssl = true; + host = "danilafe.com"; }; - - environment.systemPackages = with pkgs; [ - git - ]; - - boot.cleanTmpDir = true; - networking.hostName = "nixos-droplet-v2"; - networking.firewall.allowPing = true; - networking.firewall.allowedTCPPorts = [ 22 80 443 ]; - - services.openssh.enable = true; - users.users.root.openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXYJZfEOgccfCa3uQV9z2rHvGn4AuVnXbIDXv27HgEk vanilla@arch-xps" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOzk0SnRBJhpfNpPBgkReQoDpul2Egl2yJhRw7ldYEzF NixOS" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAoyFSuik6XRU2b+O4v9C1bc7rKJyjKgzUeaBaVNQKN6 vanilla-pinebook" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPjTgUFIwo/mtoB1kyj1zJ4QxAwLAgdvvePGXmLqjeY1 vanilla@Daniels-MBP.home" - ]; - - users.groups.www = {}; - services.nginx.group = "www"; - - services.danilafe-blog = { - enable = true; - challengePath = "/var/www/challenges"; - sites = [ - (builders.english { - ssl = true; - host = "danilafe.com"; - }) - (builders.english { - drafts = true; - host = "drafts.danilafe.com"; - }) + draftSite = blog.english { + drafts = true; + host = "drafts.danilafe.com"; + }; + allVirtualHosts = map blog.virtualHostFor [productionSite draftSite]; +in + { + imports = [ + ./hardware-configuration.nix + ./networking.nix # generated at runtime by nixos-infect ]; - }; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - programs.zsh.ohMyZsh = { - enable = true; - plugins = [ "git" ]; - }; -} + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + environment.systemPackages = with pkgs; [ + git + ]; + + boot.cleanTmpDir = true; + networking.hostName = "nixos-droplet-v2"; + networking.firewall.allowPing = true; + networking.firewall.allowedTCPPorts = [ 22 80 443 ]; + + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXYJZfEOgccfCa3uQV9z2rHvGn4AuVnXbIDXv27HgEk vanilla@arch-xps" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOzk0SnRBJhpfNpPBgkReQoDpul2Egl2yJhRw7ldYEzF NixOS" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAoyFSuik6XRU2b+O4v9C1bc7rKJyjKgzUeaBaVNQKN6 vanilla-pinebook" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPjTgUFIwo/mtoB1kyj1zJ4QxAwLAgdvvePGXmLqjeY1 vanilla@Daniels-MBP.home" + ]; + + security.acme = { + defaults.email = "danila.fedorin@gmail.com"; + acceptTerms = true; + }; + + users.groups.www = {}; + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedProxySettings = true; + virtualHosts = pkgs.lib.mkMerge allVirtualHosts; + }; + + users.defaultUserShell = pkgs.zsh; + programs.zsh.enable = true; + programs.zsh.ohMyZsh = { + enable = true; + plugins = [ "git" ]; + }; + } diff --git a/flake.lock b/flake.lock index e6ed9a8..a456611 100644 --- a/flake.lock +++ b/flake.lock @@ -10,26 +10,23 @@ }, "locked": { "lastModified": 1676876227, - "narHash": "sha256-0pIG95qAG8/bFxCpOEunkspDssJeX3ZuB47sAFPSzyw=", - "ref": "master", - "rev": "d44e5fc12f6abb505d900d6088cd8c446797c2d7", - "revCount": 114, + "narHash": "sha256-V3d9KJb4vmaqS2sqAfPXSVQXEESsXNZHTUgToZUpxn0=", "type": "git", - "url": "https://dev.danilafe.com/DanilaFe/blog-static-flake" + "url": "file:///etc/nixos-custom/blog-static-flake" }, "original": { "type": "git", - "url": "https://dev.danilafe.com/DanilaFe/blog-static-flake" + "url": "file:///etc/nixos-custom/blog-static-flake" } }, "blog-source": { "flake": false, "locked": { - "lastModified": 1676875795, - "narHash": "sha256-MnzRvG3Ct7D+zU1vwpLGMAe5Zoz/Y0WQRnZh7Ts40/s=", + "lastModified": 1681105957, + "narHash": "sha256-9cjA5X5ZP4FkT48L2kHoujyB9l4WRnagdo5Sa+mKxHY=", "ref": "master", - "rev": "cc2b5ef918ad8da4c1fe84be34e42a53627f9c7b", - "revCount": 628, + "rev": "a71c0c4e74d881af8631b17947ebe4bcb5c4ce0e", + "revCount": 634, "submodules": true, "type": "git", "url": "https://dev.danilafe.com/Web-Projects/blog-static.git" diff --git a/flake.nix b/flake.nix index 9eb13a4..24e36ac 100644 --- a/flake.nix +++ b/flake.nix @@ -1,18 +1,17 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - blog.url = "git+https://dev.danilafe.com/DanilaFe/blog-static-flake"; + blog.url = "git+https://dev.danilafe.com/Nix-Configs/blog-static-flake.git"; }; outputs = { self, nixpkgs, blog }: let system = "x86_64-linux"; - builders = blog.buildersFor system; in { nixosConfigurations.nixos-droplet-v2 = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { inherit system builders; }; - modules = [ ./configuration.nix blog.nixosModule ]; + inherit system; + specialArgs = { inherit system; blog = blog.lib."${system}"; }; + modules = [ ./configuration.nix ]; }; }; }