Reformat some templates to be a bit easier to read

This commit is contained in:
Evie Litherland-Smith 2024-05-29 11:58:59 +01:00
parent de96cd3bf2
commit d326ff8034

113
templates
View file

@ -122,15 +122,37 @@ org-mode
nix-mode
(buildphase > "buildPhase= ''" n (p "Build Instructions") n " '';")
(checkPhase > "checkPhase= ''" n (p "") n " '';")
(configurephase > "configurePhase= ''" n (p "") n " '';")
(fixupphase > "fixupPhase= ''" n (p "") n " '';")
(distphase > "distPhase= ''" n (p "") n " '';")
(patchphase > "patchPhase= ''" n (p "") n " '';")
(unpackphase > "unpackPhase= ''" n (p "") n " '';")
(installCheckPhasephase > "installCheckPhasePhase= ''" n (p "") n " '';")
(installphase > "installphase= ''" n p " mkdir -p $out/bin" n> "for f in $(find . -executable -type f);" n> "do" n> "cp $f $out/bin" n> "done}" n> " '';")
(buildphase > "buildPhase= ''" n
(p "Build Instructions") n
" '';")
(checkPhase > "checkPhase= ''" n
(p "") n
" '';")
(configurephase > "configurePhase= ''" n
(p "") n
" '';")
(fixupphase > "fixupPhase= ''" n
(p "") n
" '';")
(distphase > "distPhase= ''" n
(p "") n
" '';")
(patchphase > "patchPhase= ''" n
(p "") n
" '';")
(unpackphase > "unpackPhase= ''" n
(p "") n
" '';")
(installCheckPhasephase > "installCheckPhasePhase= ''" n
(p "") n
" '';")
(installphase > "installphase= ''" n
p " mkdir -p $out/bin" n
> "for f in $(find . -executable -type f);" n
> "do" n
> "cp $f $out/bin" n
> "done}" n
> " '';")
(gitpackage "{ lib" n ", stdenv" n ", fetchFromGitHub" n ", " (p "inputs") n ", " (p "inputs") n "}:" n n>
"stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n>
@ -145,46 +167,45 @@ nix-mode
"platforms = platforms."
(p (completing-read "Platform: " '("all" "allBut" "arm" "cygwin" "darwin" "freebsd" "gnu" "i686" "illumos" "linux" "mesaPlatforms" "mips" "netbsd" "none" "openbsd" "unix" "x86"))) ";" n> q "};" n> "}"
)
(pythonshell "with import " (p "<nixpkgs>") " {};"
n> "mkShellNoCC {"
n> "packages = ["
n> "(" (p "python3") ".withPackages"
n> "(ps: with ps; ["(p "python-lsp-server isort mypy") "]))"
n> q
n> "];"
n> "}")
(poetryshell "# See https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md#cases"
n "# for edgecases like setuptools not found"
n "with import " (p "<nixpkgs>") " {};"
n "with (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};"
n> "(mkPoetryEnv rec {"
n> "projectDir = ./.;"
n> "preferWheels = true;"
n> "extras = [\"*\"];"
n> "editablePackageSources = {" (p "package") "=projectDir;};"
n> "extraPackages = ps: with ps; [" (p "python-lsp-server isort mypy") " " q "];"
n> "})"
n> ".env")
(poetryoverride "overrides = defaultPoetryOverrides.extend"
n> "(self: super: {"
n> (s package) " ="
n> "super." package ".overridePythonAttrs"
n> "(old: {"
n> "buildInputs = (old.buildInputs or []) ++ [super." (p "setuptools" ) "];"
n> "});"
n> "});")
(pythonshell "with import " (p "<nixpkgs>") " {};" n
> "mkShellNoCC {" n
> "packages = [" n
> "(" (p "python3") ".withPackages" n
> "(ps: with ps; ["(p "python-lsp-server isort mypy") "]))" n
> q n
> "];" n
> "}")
(poetryshell "# See https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md#cases" n
"# for edgecases like setuptools not found" n
"with import " (p "<nixpkgs>") " {};" n
"with (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};" n
> "(mkPoetryEnv rec {" n
> "projectDir = ./.;" n
> "preferWheels = true;" n
> "extras = [\"*\"];" n
> "editablePackageSources = {" (p "package") "=projectDir;};" n
> "extraPackages = ps: with ps; [" (p "python-lsp-server isort mypy") " " q "];" n
> "})" n
> ".env")
(poetryoverride "overrides = defaultPoetryOverrides.extend" n
> "(self: super: {" n
> (s package) " =" n
> "super." package ".overridePythonAttrs" n
> "(old: {" n
> "buildInputs = (old.buildInputs or []) ++ [super." (p "setuptools" ) "];" n
> "});" n
> "});")
python-base-mode
(main "def main(" (p "*args, **kwargs") ") -> " (p "None") ":"
n> q "return"
n
n "if __name__ == \"__main__\":"
n> "main()")
(args "def parse_arguments() -> argparse.Namespace:"
n> "parser = argparse.ArgumentParser(description=\"" p "\")"
n> p
n> "return parser.parse_args()")
(main "def main(" (p "*args, **kwargs") ") -> " (p "None") ":" n
> q "return" n n
"if __name__ == \"__main__\":" n
> "main()")
(args "def parse_arguments() -> argparse.Namespace:" n
> "parser = argparse.ArgumentParser(description=\"" p "\")" n
> p n
> "return parser.parse_args()")
(logg "logger = logging.getLogger(__name__)")
(nimp "raise NotImplementedError")