jfdic-web: converted to flake

This commit is contained in:
Fiscal Velvet Poet 2022-07-20 14:34:07 +10:00
parent 05b661a495
commit bea9dac4c5
Signed by: fiscalvelvetpoet
GPG key ID: D8EBFD58B023BD47
5 changed files with 39 additions and 60 deletions

View file

@ -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",

View file

@ -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;

View file

@ -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
];
};
}

View file

@ -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;
});
}

View file

@ -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];
}