Last active
July 18, 2021 00:24
-
-
Save jonaprieto/53e55263405ee48a831d700f27843931 to your computer and use it in GitHub Desktop.
From (https://github.com/bbarker/LearningAgda): NixOS support file for Agda-Pkg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
standard-library==v1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let | |
thisAgda = pkgs.haskellPackages.ghcWithPackages ( p: [p.Agda p.ieee754] ); | |
in | |
agda.mkDerivation(self: { | |
name = "commonAgdaDeps"; | |
dontUnpack = true; | |
myAgda = thisAgda; | |
buildDepends = [ | |
thisAgda | |
# Using agda-pkg instead for deps for now: | |
# pkgs.AgdaStdlib (pkgs.haskellPackages.ghcWithPackages ( p: [p.ieee]) ) | |
# pkgs.agdaPrelude (pkgs.haskellPackages.ghcWithPackages ( p: [p.ieee]) ) | |
]; | |
src = null; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
let | |
myEmacs = pkgs.emacs26-nox; | |
emacsWithPackages = (pkgs.emacsPackagesGen myEmacs).emacsWithPackages; | |
deps = (import ./deps.nix); | |
in | |
emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ | |
magit # ; Integrate git <C-x g> | |
zerodark-theme # ; Nicolas' theme | |
]) ++ (with epkgs.melpaPackages; [ | |
# undo-tree # ; <C-x u> to show the undo tree | |
# zoom-frm # ; increase/decrease font size for all buffers %lt;C-x C-+> | |
]) ++ (with epkgs.elpaPackages; [ | |
auctex # ; LaTeX mode | |
beacon # ; highlight my cursor when scrolling | |
nameless # ; hide current package name everywhere in elisp code | |
]) ++ [ | |
deps.myAgda # This is where agda-mode is located | |
# pkgs.notmuch # From main packages set | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module hello-world where | |
open import IO | |
main = run (putStrLn "Hello, World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let | |
deps = (import ./deps.nix); | |
myEmacs = (import ./emacs.nix { inherit pkgs; }); | |
in | |
agda.mkDerivation(self: { | |
name = "agdaShellEnv"; | |
dontUnpack = true; | |
buildDepends = deps.buildDepends; | |
buildInputs = deps.buildInputs ++ [ | |
myEmacs | |
# these packages are required for virtualenv and pip to work: | |
# | |
mypy | |
python38Full | |
python38Packages.virtualenv | |
]; | |
# libPath = deps.libPath; | |
src = null; | |
shellHook = '' | |
# set SOURCE_DATE_EPOCH so that we can use python wheels | |
SOURCE_DATE_EPOCH=$(date +%s) | |
export LANG=en_US.UTF-8 | |
activate_python_env () { | |
source venv/bin/activate | |
export PATH=$PWD/venv/bin:$PATH | |
export PYTHONPATH=$PWD:$PYTHONPATH | |
} | |
if [ ! -d "venv" ]; then | |
# initialize python environment | |
virtualenv venv | |
activate_python_env | |
pip install agda-pkg | |
else | |
activate_python_env | |
fi | |
export AGDA_PROJ_DIR=$PWD | |
export AGDA_DIR=$AGDA_PROJ_DIR/.agda | |
if [ ! -d "$AGDA_DIR" ]; then | |
mkdir -p "$AGDA_DIR" | |
apkg init | |
apkg upgrade | |
apkg install -r agda_requirements.txt | |
fi | |
if [ ! -f "$AGDA_PROJ_DIR/.emacs" ]; then | |
export ORIG_HOME=$HOME | |
export HOME=$AGDA_PROJ_DIR | |
echo '(load (expand-file-name "~/.emacs") "" nil t)' > $AGDA_PROJ_DIR/.emacs | |
agda-mode setup | |
export EMACS_USER_FILE="$AGDA_PROJ_DIR/.emacs_user_config" | |
if [ -f "$EMACS_USER_FILE" ]; then | |
cat "$EMACS_USER_FILE" >> $AGDA_PROJ_DIR/.emacs | |
fi | |
export HOME=$ORIG_HOME | |
unset ORIG_HOME | |
rmdir .emacs.d | |
unset EMACS_USER_FILE | |
fi | |
mymacs () { | |
emacs -Q --load $AGDA_PROJ_DIR/.emacs $@ | |
} | |
''; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I recently found a few issues in deps.nix and shell.nix: I put in fixes at https://gist.github.com/bbarker/c0c7f014a9ee677f83b03a3fe6c93bf9