-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv.sh
107 lines (83 loc) · 1.93 KB
/
env.sh
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
# Based on https://github.com/grafted-in/dev-onboarding/blob/master/env.sh
NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/$(whoami)/channels/nixpkgs":$NIX_PATH
export NIX_PATH
nixpkgs_channel=https://nixos.org/channels/nixpkgs-unstable
function user-packages() {
# Other packages
# echo google-chrome
# echo htop
# Common tools
echo curl
echo gnugrep
echo gnumake
echo gzip
echo less
echo tree
echo unzip
echo wget
echo xclip
echo zip
# Nix tools
echo nix
echo nix-prefetch-scripts
echo nix-repl
# Security tools
echo gnupg
echo keybase
echo ssh-ident
# Tools for working with code
echo git
echo git-crypt
echo shellcheck
echo vim
echo vscode
# Haskell-specific tools
echo ghc
echo stack
echo haskellPackages.hlint
echo haskellPackages.intero
echo haskellPackages.stylish-haskell
}
function vscode-extensions() {
echo bbenoist.Nix
echo hoovercj.haskell-linter
echo justusadam.language-haskell
echo timonwong.shellcheck
echo Vans.haskero
echo vigoo.stylish-haskell
}
function user-nix-config() {
cat <<'NIX'
{
allowUnfree = true;
}
NIX
}
function user-apply-app-config() {
# Stack can't install its own GHC on NixOS
stack config set system-ghc --global true
git config --global gpg.program gpg2
for ext in $(vscode-extensions); do
code --install-extension "$ext"
done
}
function user-set-channel() {
nix-channel --add "$nixpkgs_channel" nixpkgs
}
function user-upgrade-channel() {
user-set-channel
nix-channel --update
}
function user-build() {
source "${BASH_SOURCE[0]}" # Be sure to use the most recent version of this file
# Apply the nixpkgs channel
user-set-channel
# Apply nixpkgs config
mkdir -p "$HOME/.config/nixpkgs"
user-nix-config > "$HOME/.config/nixpkgs/config.nix"
# Apply packages
nix-env -f '<nixpkgs>' --remove-all -iA $(user-packages)
# Apply various configurations
user-apply-app-config
}