Add NixOS module

This commit is contained in:
Rebecca Turner 2024-03-12 17:04:24 -07:00
parent 2498b5e59c
commit 5165d5f337
Signed by: rbt
SSH key fingerprint: SHA256:SiNaEWabvotTldoNb5jIKqjJ3RnpS4aRXA4KLAdW5vs
2 changed files with 85 additions and 0 deletions

26
flake.lock Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1710287966,
"narHash": "sha256-W/Ny8KSyZqbBncGdcyv8K63pXkZFSESJrbQi4EKWbdU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "54dce4f0ac3334c35093d38b17fe3799eab929b4",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

59
flake.nix Normal file
View file

@ -0,0 +1,59 @@
{
description = "Zola homepage for lix.systems";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
forAllSystems = function:
builtins.mapAttrs
(system: pkgs: function (pkgs.appendOverlays [self.overlays.default]))
nixpkgs.legacyPackages;
in {
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
inputsFrom = [pkgs.lix-systems-website];
};
});
packages = forAllSystems (pkgs: {
default = pkgs.lix-systems-website;
});
overlays.default = final: prev: {
lix-systems-website = final.stdenv.mkDerivation {
name = "lix.systems";
src = self;
nativeBuildInputs = [final.zola];
buildPhase = ''
zola build
'';
installPhase = ''
cp -r public "$out"
'';
};
};
nixosModules.default = {pkgs}: let
host = "lix.systems";
in {
nixpkgs.overlays = [self.overlays.default];
services.nginx = {
enable = true;
virtualHosts = {
"${host}" = {
forceSSL = true;
enableACME = true;
root = "${pkgs.lix-systems-website}";
};
};
};
};
};
}