94 lines
3.1 KiB
Nix
94 lines
3.1 KiB
Nix
{
|
|
description = "Reproducible Environment for anish.lakhwara.com";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
poonam.url = "git+ssh://gitea@git.sealight.xyz/aynish/kitaab?ref=main";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, poonam }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
my-python = pkgs.python3;
|
|
python-with-my-packages = my-python.withPackages (p: with p; [
|
|
jinja2
|
|
click
|
|
# other python packages you want in the devShell
|
|
]);
|
|
python-deps = with pkgs.python3Packages; [
|
|
# Packages necessary at runtime to run build script
|
|
jinja2
|
|
python-ctags3
|
|
];
|
|
in
|
|
{
|
|
devShell = pkgs.mkShell {
|
|
buildInputs = [
|
|
python-with-my-packages
|
|
pkgs.pandoc
|
|
];
|
|
shellHook = ''
|
|
PYTHONPATH=${python-with-my-packages}/${python-with-my-packages.sitePackages}
|
|
# This only works when you have ~/vimwiki locally, since I'm not putting my unfiltered kitaab online
|
|
alias build='python3 src/kitaab-public/main.py'
|
|
# maybe set more env-vars
|
|
'';
|
|
};
|
|
packages.basant = pkgs.python3Packages.buildPythonPackage {
|
|
pname = "basant";
|
|
src = ./.;
|
|
version = "0.1";
|
|
propagatedBuildInputs = [ python-deps ];
|
|
doCheck = false;
|
|
};
|
|
packages.site = pkgs.stdenv.mkDerivation {
|
|
name = "anish-lakhwara-site";
|
|
src = ./.;
|
|
buildInputs = [ poonam.defaultPackage.${system} self.packages.${system}.basant ];
|
|
configurePhase = ''
|
|
cp -r ${poonam.defaultPackage.${system}}/public/ ./
|
|
'';
|
|
buildPhase = ''
|
|
${self.packages.${system}.basant}/bin/main.py
|
|
'';
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -R output/* $out/
|
|
'';
|
|
};
|
|
defaultPackage = self.packages.${system}.site;
|
|
#nixosModule = { options, lib, config, pkgs, ... }:
|
|
# let
|
|
# serverName = "anish.lakhwara.com";
|
|
# webRoot = "/var/www/${serverName}";
|
|
|
|
# serviceConfig = config.services."${serverName}";
|
|
# options = {
|
|
# enable = lib.mkEnableOption "${serverName} service";
|
|
# };
|
|
# in
|
|
# {
|
|
# options.services.${serverName} = options;
|
|
# config = lib.mkIf serviceConfig.enable {
|
|
# systemd.services."source-${serverName}" = {
|
|
# description = ''
|
|
# https://${serverName} source
|
|
# '';
|
|
# serviceConfig = {
|
|
# Type = "oneshot";
|
|
# };
|
|
# startAt = "*00:00:00";
|
|
# path = with pkgs; [ nix gnutar gzip curl jq ];
|
|
# script = ''
|
|
# set -ex
|
|
|
|
# ln -sfT ${flake.packages.system.site} ${webRoot}
|
|
# '';
|
|
# };
|
|
# };
|
|
# };
|
|
});
|
|
}
|