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": { "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": { "lowdown-src": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -139,6 +156,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"jfdic-web": "jfdic-web",
"nix": "nix", "nix": "nix",
"nixops": "nixops", "nixops": "nixops",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",

View file

@ -2,6 +2,10 @@
description = "jfdic-ops deployment"; description = "jfdic-ops deployment";
inputs = { 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"; nix.url = "github:NixOS/nix/?ref=2.10.3";
nixops.url = github:NixOS/nixops/?ref=master; nixops.url = github:NixOS/nixops/?ref=master;
nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.05; 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, self,
jfdic-web,
nix, nix,
nixops, nixops,
nixpkgs, nixpkgs,
@ -30,17 +31,10 @@ in {
}; };
}; };
defaults = { defaults = {
config,
pkgs,
lib,
...
}: {
system.autoUpgrade.enable = false; # Disabled as it conflicts with NixOps 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; 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 # NixOps configuration for deploying the JFDIC website
{
{ config, pkgs, ... }: self,
config,
let inputs,
sources = import ../nix/sources.nix; pkgs,
jfdic-web = import sources.jfdic-web { }; ...
}: let
jfdic-web = import inputs.jfdic-web {};
webdomain = "jfdic.org"; webdomain = "jfdic.org";
in { in {
environment.sessionVariables = { environment.sessionVariables = {
LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
}; };
@ -20,14 +20,15 @@ in {
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
virtualHosts = { virtualHosts = {
"${webdomain}" = { # website hostname "${webdomain}" = {
# website hostname
enableACME = true; # Use ACME certs enableACME = true; # Use ACME certs
forceSSL = true; # Force SSL forceSSL = true; # Force SSL
root = "${jfdic-web}"; # Wesbite root root = "${jfdic-web}"; # Wesbite root
}; };
"www.${webdomain}" = { # Respect our elders :-) "www.${webdomain}" = {
locations."/".extraConfig = # Respect our elders :-)
"return 301 $scheme://${webdomain}$request_uri;"; locations."/".extraConfig = "return 301 $scheme://${webdomain}$request_uri;";
}; };
}; };
}; };
@ -43,5 +44,4 @@ in {
}; };
networking.firewall.allowedTCPPorts = [80 443]; networking.firewall.allowedTCPPorts = [80 443];
} }