From b996c05034579149e926ca845205b0d179c1bdde 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 | 20 ++++----- flake.nix | 9 ++-- 3 files changed, 73 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..beab319 100644 --- a/flake.lock +++ b/flake.lock @@ -9,27 +9,27 @@ "resume": "resume" }, "locked": { - "lastModified": 1676876227, - "narHash": "sha256-0pIG95qAG8/bFxCpOEunkspDssJeX3ZuB47sAFPSzyw=", + "lastModified": 1681181670, + "narHash": "sha256-MsoGEzIKZHUjPAGzyADR/yROxarBWqUbZJdlX3vKm6Q=", "ref": "master", - "rev": "d44e5fc12f6abb505d900d6088cd8c446797c2d7", - "revCount": 114, + "rev": "ab4b92d031a4d46ad59f49e33f39e9d2ef7041f9", + "revCount": 116, "type": "git", - "url": "https://dev.danilafe.com/DanilaFe/blog-static-flake" + "url": "https://dev.danilafe.com/Nix-Configs/blog-static-flake.git" }, "original": { "type": "git", - "url": "https://dev.danilafe.com/DanilaFe/blog-static-flake" + "url": "https://dev.danilafe.com/Nix-Configs/blog-static-flake.git" } }, "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 ]; }; }; }