From bea9dac4c55f9b5f92bf7161db55881af94b5836 Mon Sep 17 00:00:00 2001 From: Fiscal Velvet Poet Date: Wed, 20 Jul 2022 14:34:07 +1000 Subject: [PATCH] jfdic-web: converted to flake --- flake.lock | 18 ++++++++++++++++++ flake.nix | 4 ++++ nixos/configurations.nix | 37 ------------------------------------- outputs.nix | 12 +++--------- profiles/jfdic-web.nix | 28 ++++++++++++++-------------- 5 files changed, 39 insertions(+), 60 deletions(-) delete mode 100644 nixos/configurations.nix diff --git a/flake.lock b/flake.lock index bf96bc2..bbd00ed 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,22 @@ { "nodes": { + "jfdic-web": { + "flake": false, + "locked": { + "lastModified": 1656489989, + "narHash": "sha256-cLsW+iddrxLyfUTV/uZTiXgmL8ZQ3cKG4NfKThc2tds=", + "ref": "consensus", + "rev": "6765cb4251eef6d660b761f7f40f99dbf51a739f", + "revCount": 31, + "type": "git", + "url": "https://source.jfdic.org/JFDIC/jfdic-web/" + }, + "original": { + "ref": "consensus", + "type": "git", + "url": "https://source.jfdic.org/JFDIC/jfdic-web/" + } + }, "lowdown-src": { "flake": false, "locked": { @@ -139,6 +156,7 @@ }, "root": { "inputs": { + "jfdic-web": "jfdic-web", "nix": "nix", "nixops": "nixops", "nixpkgs": "nixpkgs_3", diff --git a/flake.nix b/flake.nix index 552447a..b695fdf 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,10 @@ description = "jfdic-ops deployment"; inputs = { + jfdic-web = { + flake = false; + url = git+https://source.jfdic.org/JFDIC/jfdic-web/?ref=consensus; + }; nix.url = "github:NixOS/nix/?ref=2.10.3"; nixops.url = github:NixOS/nixops/?ref=master; nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.05; diff --git a/nixos/configurations.nix b/nixos/configurations.nix deleted file mode 100644 index 65945ab..0000000 --- a/nixos/configurations.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - self, - nixpkgs, - inputs, - nix, - ... -}: let - nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem; - customModules = import ../modules/modules-list.nix; - baseModules = [ - # make flake inputs accessiable in NixOS - {_module.args.inputs = inputs;} - { - imports = [ - ({pkgs, ...}: { - nix.nixPath = [ - "nixpkgs=${pkgs.path}" - ]; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - documentation.info.enable = false; - }) - ]; - } - ]; - defaultModules = baseModules ++ customModules; -in { - dionach = nixosSystem { - system = "x86_64-linux"; - modules = - defaultModules - ++ [ - #./hosts/toscano/configuration.nix - ]; - }; -} diff --git a/outputs.nix b/outputs.nix index 29d26ac..4cc3d0c 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,5 +1,6 @@ { self, + jfdic-web, nix, nixops, nixpkgs, @@ -30,17 +31,10 @@ in { }; }; defaults = { - config, - pkgs, - lib, - ... - }: { system.autoUpgrade.enable = false; # Disabled as it conflicts with NixOps + _module.args.inputs = inputs; # make flake inputs accessiable in NixOS + imports = [./profiles/host_common.nix]; }; toscano = import ./hosts/toscano.nix; }; - nixosConfigurations = import ./nixos/configurations.nix (inputs - // { - inherit inputs; - }); } diff --git a/profiles/jfdic-web.nix b/profiles/jfdic-web.nix index 897534e..e60fdec 100644 --- a/profiles/jfdic-web.nix +++ b/profiles/jfdic-web.nix @@ -1,14 +1,14 @@ # NixOps configuration for deploying the JFDIC website - -{ config, pkgs, ... }: - -let - sources = import ../nix/sources.nix; - jfdic-web = import sources.jfdic-web { }; +{ + self, + config, + inputs, + pkgs, + ... +}: let + jfdic-web = import inputs.jfdic-web {}; webdomain = "jfdic.org"; - in { - environment.sessionVariables = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; }; @@ -20,14 +20,15 @@ in { recommendedProxySettings = true; recommendedTlsSettings = true; virtualHosts = { - "${webdomain}" = { # website hostname + "${webdomain}" = { + # website hostname enableACME = true; # Use ACME certs forceSSL = true; # Force SSL root = "${jfdic-web}"; # Wesbite root }; - "www.${webdomain}" = { # Respect our elders :-) - locations."/".extraConfig = - "return 301 $scheme://${webdomain}$request_uri;"; + "www.${webdomain}" = { + # Respect our elders :-) + locations."/".extraConfig = "return 301 $scheme://${webdomain}$request_uri;"; }; }; }; @@ -42,6 +43,5 @@ in { }; }; - networking.firewall.allowedTCPPorts = [ 80 443 ]; - + networking.firewall.allowedTCPPorts = [80 443]; }