-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
92 lines (74 loc) · 2.11 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
with import <nixpkgs> {};
let
deps = [
dmd dtools
dotnet-sdk omnisharp-roslyn mono6
fsharp
gfortran
go
guile
lua
nasm
nodejs yarn
ocaml
perl
python3
R
ruby
rustc
X11basic
];
binPath = lib.makeBinPath deps;
babix-lisp = runCommand "babix-lisp" {} ''
cp -r ${./lisp} $out
'';
in writeScriptBin "babix" ''
#!${pkgs.stdenv.shell}
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
themes="default one one-light vibrant acario-dark acario-light city-lights challenger-deep dark+ dracula ephemeral fairy-floss flatwhite gruvbox gruvbox-light henna horizon Iosvkem laserwave material manegarm miramare molokai monokai-classic monokai-pro moonlight nord nord-light nova oceanic-next old-hope opera opera-light outrun-electric palenight plain peacock rouge snazzy solarized-dark solarized-light sourcerer spacegrey tomorrow-day tomorrow-night wilmersdorf zenburn mono-dark mono-light tron"
help="babix [BABIX-OPTS] [EMACS-OPTS] FILE
BABIX-OPTS:
-h list usage
-themes print theme names & exit
-theme NAME use theme called NAME
EMACS-OPTS:
typical Emacs options"
if [[ " $@[@] " =~ "-h" ]]; then
echo "$help"
exit 0
fi
if [[ " $@[@] " =~ "-themes" ]]; then
echo "Available themes:"
for t in $themes; do
let "i=$RANDOM % 256"
echo -en "\e[38;5;''${i}m$t \e[0m";
done
exit 0
fi
themeFlag=""
export theme="default"
for arg do
shift
if [ ! -z "$themeFlag" ]; then
if [[ ! " $themes[@] " =~ " $arg " ]]; then
printf "''${RED}✗''${YELLOW} '$arg' is not a valid theme.''${NC}\n"
for t in $themes; do
let "i=$RANDOM % 256"
echo -en "\e[38;5;''${i}m$t \e[0m";
done
exit 1
fi
export theme="$arg"
themeFlag=""
continue
fi
if [ "$arg" = "-theme" ]; then
themeFlag="1"
continue
fi
set -- "$@" "$arg"
done
env PATH=${binPath}:$PATH ${emacs}/bin/emacs -Q -l ${babix-lisp}/bootstrap.el $@
''