✨nixify✨
This commit is contained in:
parent
e5dc6d7e46
commit
ba58283f1f
25
flake.lock
Normal file
25
flake.lock
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1697915759,
|
||||
"narHash": "sha256-WyMj5jGcecD+KC8gEs+wFth1J1wjisZf8kVZH13f1Zo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "51d906d2341c9e866e48c2efcaac0f2d70bfd43e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
43
flake.nix
Normal file
43
flake.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
description = "iFSR Manual";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||
in
|
||||
{
|
||||
|
||||
overlays.default = (_final: prev: {
|
||||
inherit (self.packages.${prev.system}) ese-manual;
|
||||
});
|
||||
|
||||
nixosModules.default = {
|
||||
imports = [ ./module.nix ];
|
||||
|
||||
nixpkgs.overlays = [ self.overlays.default ];
|
||||
};
|
||||
|
||||
packages = forAllSystems (system: rec {
|
||||
|
||||
default = ese-manual;
|
||||
|
||||
ese-manual = pkgs.${system}.stdenvNoCC.mkDerivation {
|
||||
name = "ese-manual";
|
||||
src = ./.;
|
||||
buildInputs = with pkgs.${system}.python3Packages; [
|
||||
mkdocs-material
|
||||
];
|
||||
# phases = [ "unpackPhase" "installPhase" ];
|
||||
buildPhase = ''
|
||||
mkdocs build
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r site/* $out
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
28
module.nix
Normal file
28
module.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
cfg = config.services.ese-manual;
|
||||
in
|
||||
{
|
||||
options.services.kpp = {
|
||||
enable = mkEnableOption "ese-manual";
|
||||
hostName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "manual.example.com";
|
||||
description = ''
|
||||
The hostname the application should be served on.
|
||||
If it is `null`, nginx will not be automatically configured.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nginx = lib.mkIf (cfg.hostName != null) {
|
||||
enable = true;
|
||||
virtualHosts.${cfg.hostName} = {
|
||||
root = pkgs.ese-manual;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue