First real commit

This commit is contained in:
Ryan Pandya 2024-02-27 14:56:36 -08:00
parent 818a1d53a1
commit 3e2f18ae04
15 changed files with 546 additions and 0 deletions

1
elixir/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

33
elixir/flake.nix Normal file
View File

@ -0,0 +1,33 @@
{
description = "Nix-flake Elixir development environment (adds nodejs and fly.io)";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (pkgs.lib) optional optionals;
pkgs = import nixpkgs { inherit system; };
elixir = pkgs.beam.packages.erlang.elixir;
in
with pkgs;
{
devShell = pkgs.mkShell {
buildInputs = [
bashInteractive
elixir
elixir_ls
nodejs
glibcLocales
flyctl
] ++ optional stdenv.isLinux inotify-tools
++ optional stdenv.isDarwin terminal-notifier
++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
]);
};
});
}

27
flake.nix Normal file
View File

@ -0,0 +1,27 @@
{
description = "Ryan's Nix flake templates";
outputs = { self }: {
templates = {
python = {
path = ./python;
description = "Python shell flake";
};
elixir = {
path = ./elixir;
description = "Elixir flake";
};
latex = {
path = ./latex;
description = "LaTeX flake";
};
raw = {
path = ./raw;
description = "Raw flake";
};
};
};
}

1
latex/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

306
latex/.gitignore vendored Normal file
View File

@ -0,0 +1,306 @@
/result
/.direnv
*.pdf
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

7
latex/document.tex Normal file
View File

@ -0,0 +1,7 @@
% !TEX root = document.txt
\documentclass[a4paper]{article}
\begin{document}
Hello, World!
\end{document}

50
latex/flake.nix Normal file
View File

@ -0,0 +1,50 @@
{
description = "LaTeX flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils }:
let
rootName = "document";
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small latex-bin latexmk
metafont
chktex
latexindent
;
};
in
rec {
packages = {
document = pkgs.stdenvNoCC.mkDerivation rec {
name = rootName;
src = self;
buildInputs = [ pkgs.coreutils tex ];
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
latexmk -interaction=nonstopmode -pdf ${rootName}.tex
'';
installPhase = ''
mkdir -p $out
cp ${rootName}.pdf $out/
'';
};
default = packages.document;
};
devShells.default = pkgs.mkShellNoCC {
buildInputs = [
tex
];
};
});
}

2
python/.envrc Normal file
View File

@ -0,0 +1,2 @@
nix_direnv_watch_file requirements.txt
use flake

3
python/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
__pycache__
/.direnv

45
python/README.md Normal file
View File

@ -0,0 +1,45 @@
# python-shell
## Using
- dev shell: `nix develop`
- edit `requirements.txt` for dev shell requirements
## Jupyter in VSCode
To use jupyter in VSCode add these requirements:
```
ipykernel
nbformat
ipywidgets
```
## Updating mach-nix pypi deps db
Add to inputs:
```nix
pypi-deps-db = {
url = "github:davhau/pypi-deps-db/0000000000000000000000000000000000000000";
flake = false;
};
mach-nix.inputs.pypi-deps-db.follows = "pypi-deps-db";
```
## Adding git dependency
Add to mkPython ([more info](https://github.com/DavHau/mach-nix/blob/master/examples.md)):
```nix
packagesExtra = [
(mach.buildPythonPackage
{
src = builtins.fetchGit {
url = "https://github.com/user/repo";
ref = "branch";
rev = "0000000000000000000000000000000000000000";
};
})
];
```

35
python/flake.nix Normal file
View File

@ -0,0 +1,35 @@
{
description = "Python shell flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
mach-nix.url = "github:davhau/mach-nix";
};
outputs = { self, nixpkgs, mach-nix, flake-utils, ... }:
let
pythonVersion = "python39";
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mach = mach-nix.lib.${system};
pythonEnv = mach.mkPython {
python = pythonVersion;
requirements = builtins.readFile ./requirements.txt;
};
in
{
devShells.default = pkgs.mkShellNoCC {
packages = [ pythonEnv ];
shellHook = ''
export PYTHONPATH="${pythonEnv}/bin/python"
'';
};
}
);
}

3
python/main.py Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env python
print("Hello world!")

0
python/requirements.txt Normal file
View File

1
raw/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

32
raw/flake.nix Normal file
View File

@ -0,0 +1,32 @@
{
description = "Nix-flake development folder, raw";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (pkgs.lib) optional optionals;
pkgs = import nixpkgs { inherit system; };
in
with pkgs;
{
devShell = pkgs.mkShell {
buildInputs = [
bashInteractive
glibcLocales
git
emacs-nox
] ++ optional stdenv.isLinux inotify-tools
++ optional stdenv.isDarwin terminal-notifier
++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
]);
};
});
}