aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-02 12:01:33 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-02 12:34:00 +0200
commitfdf6f74d3221e3dad853898f296149baea0aa476 (patch)
tree9fcd0db87425e2f533354a431d2fa81bd55cbe36
parent6e2dc958bc8c5aac4871d2a618741fa4628ed126 (diff)
downloadNix-fdf6f74d3221e3dad853898f296149baea0aa476.tar.gz
Nix-fdf6f74d3221e3dad853898f296149baea0aa476.tar.zst
Nix-fdf6f74d3221e3dad853898f296149baea0aa476.zip
Refactor configuration and overlays
-rw-r--r--config/config.nix30
-rw-r--r--config/overlays.nix1
-rw-r--r--default.nix122
-rw-r--r--libs.nix22
-rw-r--r--nixops/custom_nixops.nix2
-rw-r--r--nixops/eldiron.nix3
-rw-r--r--nixops/modules/websites/tools/ether/etherpad_lite.nix2
-rwxr-xr-xnixops/scripts/nixops_wrap2
-rwxr-xr-xnixops/scripts/pull_deployment2
-rwxr-xr-xnixops/scripts/push_deployment2
-rwxr-xr-xnixops/scripts/setup2
-rw-r--r--nixos_tools.nix4
-rw-r--r--overlays/default.nix5
-rw-r--r--overlays/environments/default.nix3
-rw-r--r--overlays/environments/immae-eu.nix114
-rw-r--r--pkgs/default.nix (renamed from overlays/mypkgs.nix)3
-rwxr-xr-xscripts/make-env2
17 files changed, 162 insertions, 159 deletions
diff --git a/config/config.nix b/config/config.nix
deleted file mode 100644
index d6b4714..0000000
--- a/config/config.nix
+++ /dev/null
@@ -1,30 +0,0 @@
1{
2 packageOverrides = pkgs: with pkgs; {
3 # buildEnv is not absolutely equivalent to
4 # `nix-env -i -f ./nixRoot/default.nix`, see
5 # https://github.com/NixOS/nix/issues/2682
6 immaePackages = pkgs.buildEnv {
7 name = "Immae-packages";
8 paths = builtins.attrValues (import ./nixRoot/default.nix);
9 pathsToLink = [ "/bin" "/etc" "/include" "/lib" "/libexec" "/share"];
10 extraOutputsToInstall = [ "bin" "man" "doc" "info" ];
11 };
12 # This adds header colors to the builds, but it rebuilds the whole
13 # world from scratch, so only use it to debug!
14 # add it as postHook in derivations
15 immaePostHook = ''
16 header() {
17 echo -ne "\033[1;36m"
18 echo -n "$1"
19 echo -e "\033[0m"
20 }
21
22 echoCmd() {
23 printf "\033[1;34m%s:\033[0m" "$1"
24 shift
25 printf ' %q' "$@"
26 echo
27 }
28 '';
29 };
30}
diff --git a/config/overlays.nix b/config/overlays.nix
new file mode 100644
index 0000000..1040d59
--- /dev/null
+++ b/config/overlays.nix
@@ -0,0 +1 @@
builtins.attrValues (import ./nixRoot/overlays)
diff --git a/default.nix b/default.nix
index 9c548a0..e092c33 100644
--- a/default.nix
+++ b/default.nix
@@ -1,112 +1,10 @@
1with import <nixpkgs> { overlays = builtins.attrValues (import ./overlays); }; 1{ pkgs ? import <nixpkgs> {} }:
2 # https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh 2let
3 # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks 3 pkgs_ = pkgs;
4 { # files in overlays/mypkgs.nix 4 mypkgs = import ./pkgs { pkgs = pkgs_; };
5 inherit boinctui; 5in
6 inherit cnagios; 6{
7 inherit duply; 7 lib = import ./libs.nix { pkgs = pkgs_; };
8 inherit flrn; 8 overlays = import ./overlays;
9 inherit genius; 9 pkgs = mypkgs;
10 inherit mtop; 10} // mypkgs
11 inherit muttprint;
12 inherit mutt-ics;
13 inherit nagios-cli;
14 #inherit nagnu;
15 inherit note;
16 inherit notmuch-python2;
17 inherit notmuch-python3;
18 inherit notmuch-vim;
19 inherit pg_activity;
20 inherit pgloader;
21 inherit telegram-cli;
22 inherit telegram-history-dump;
23 inherit telegramircd;
24 inherit terminal-velocity;
25 inherit tiv;
26 inherit unicodeDoc;
27
28 inherit cardano;
29 inherit iota-cli-app;
30 inherit sia;
31 } // { # overlays
32 inherit weboob;
33 inherit taskwarrior;
34 inherit slrn;
35 inherit sc-im;
36 inherit lesspipe;
37 inherit neomutt;
38 inherit weechat;
39 inherit goaccess;
40 inherit profanity;
41 inherit nixops;
42 inherit dwm;
43 inherit vit;
44 inherit pass;
45 inherit elinks;
46 inherit pelican;
47 inherit ldapvi;
48 inherit (mylibs.yarn2nixPackage) yarn2nix;
49 } // {
50 inherit nix-prefetch-scripts;
51 inherit nix-generate-from-cpan;
52 inherit timewarrior;
53 inherit pal;
54 inherit pdftk;
55 inherit googler;
56 inherit jrnl;
57 inherit apg pwgen;
58 inherit newsboat;
59 inherit vcsh;
60 inherit xmr-stak;
61 inherit urlwatch;
62 inherit ranger;
63 inherit irssi;
64 inherit abook khard khal;
65 inherit graphicsmagick;
66 inherit youtube-dl;
67 inherit ncmpc ncmpcpp;
68 inherit cadaver;
69 inherit mairix notmuch;
70 inherit ctags;
71 inherit s3cmd;
72 inherit solc; # solidity
73 inherit rtorrent;
74 inherit strace;
75 inherit vdirsyncer;
76 inherit w3m lynx links;
77 inherit gitRepo;
78 inherit valgrind;
79 inherit iotop iperf;
80 inherit keybase;
81 inherit bogofilter;
82 inherit mtr;
83 inherit urlview;
84 inherit rr;
85 inherit nix-zsh-completions;
86 inherit browsh;
87 inherit monero;
88 inherit nextcloud-client;
89 inherit feh imagemagick;
90 inherit lftp;
91 stgit = gitAndTools.stgit;
92 inherit bundix;
93 bower2nix = nodePackages.bower2nix;
94 inherit firefox;
95 inherit jq;
96 inherit lzo unzip bzip2 p7zip xz;
97 # unrar is unfree
98 inherit tig;
99 inherit emacs26-nox;
100 inherit highlight sourceHighlight;
101 pygmentize = python3Packages.pygments;
102 inherit iftop htop;
103 inherit fetchmail;
104 inherit bc;
105 inherit cpulimit;
106 inherit dmenu st;
107 inherit poppler_utils;
108 inherit tmux;
109 inherit netcat-gnu;
110 inherit ledger;
111 inherit ffmpeg libxslt;
112 }
diff --git a/libs.nix b/libs.nix
index 981039e..630b139 100644
--- a/libs.nix
+++ b/libs.nix
@@ -1,5 +1,5 @@
1{ nixpkgs }: 1{ pkgs }:
2with nixpkgs; 2with pkgs;
3rec { 3rec {
4 yarn2nixPackage = let 4 yarn2nixPackage = let
5 src = fetchFromGitHub { 5 src = fetchFromGitHub {
@@ -57,4 +57,22 @@ rec {
57 makeWrapper "$f" "$out" ${toString args} 57 makeWrapper "$f" "$out" ${toString args}
58 ''; 58 '';
59 59
60 # This adds header colors to the builds, but it rebuilds the whole
61 # world from scratch, so only use it to debug!
62 # add it as postHook in derivations
63 immaePostHook = ''
64 header() {
65 echo -ne "\033[1;36m"
66 echo -n "$1"
67 echo -e "\033[0m"
68 }
69
70 echoCmd() {
71 printf "\033[1;34m%s:\033[0m" "$1"
72 shift
73 printf ' %q' "$@"
74 echo
75 }
76 '';
77
60} 78}
diff --git a/nixops/custom_nixops.nix b/nixops/custom_nixops.nix
new file mode 100644
index 0000000..f024a4d
--- /dev/null
+++ b/nixops/custom_nixops.nix
@@ -0,0 +1,2 @@
1with import <nixpkgs> { overlays = builtins.attrValues (import ../overlays); };
2nixops
diff --git a/nixops/eldiron.nix b/nixops/eldiron.nix
index 4994041..718d483 100644
--- a/nixops/eldiron.nix
+++ b/nixops/eldiron.nix
@@ -11,8 +11,7 @@
11 _module.args = { 11 _module.args = {
12 pkgsNext = import <nixpkgsNext> {}; 12 pkgsNext = import <nixpkgsNext> {};
13 pkgsPrevious = import <nixpkgsPrevious> {}; 13 pkgsPrevious = import <nixpkgsPrevious> {};
14 mylibs = import ../libs.nix { nixpkgs = pkgs; }; 14 mylibs = import ../libs.nix { inherit pkgs; };
15 mypkgs = import ../default.nix;
16 myconfig = { 15 myconfig = {
17 inherit privateFiles; 16 inherit privateFiles;
18 env = import "${privateFiles}/environment.nix"; 17 env = import "${privateFiles}/environment.nix";
diff --git a/nixops/modules/websites/tools/ether/etherpad_lite.nix b/nixops/modules/websites/tools/ether/etherpad_lite.nix
index 14ad565..e67497b 100644
--- a/nixops/modules/websites/tools/ether/etherpad_lite.nix
+++ b/nixops/modules/websites/tools/ether/etherpad_lite.nix
@@ -47,7 +47,7 @@ let
47 text = 47 text =
48 # Make sure we’re not rebuilding whole libreoffice just because of a 48 # Make sure we’re not rebuilding whole libreoffice just because of a
49 # dependency 49 # dependency
50 let libreoffice = (import <nixpkgs> {}).libreoffice-fresh; 50 let libreoffice = (import <nixpkgs> { overlays = []; }).libreoffice-fresh;
51 in 51 in
52 '' 52 ''
53 { 53 {
diff --git a/nixops/scripts/nixops_wrap b/nixops/scripts/nixops_wrap
index 12f661a..d03784e 100755
--- a/nixops/scripts/nixops_wrap
+++ b/nixops/scripts/nixops_wrap
@@ -9,7 +9,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" 9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
10export NIXOPS_DEPLOYMENT="$DeploymentUuid" 10export NIXOPS_DEPLOYMENT="$DeploymentUuid"
11source $(dirname $(dirname $DIR))/nix_path_env 11source $(dirname $(dirname $DIR))/nix_path_env
12nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" 12nixops="$(nix-build --no-out-link "$(dirname $DIR)/custom_nixops.nix")/bin/nixops"
13 13
14TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files) 14TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files)
15chmod go-rwx $TEMP 15chmod go-rwx $TEMP
diff --git a/nixops/scripts/pull_deployment b/nixops/scripts/pull_deployment
index bc4a999..10f71fe 100755
--- a/nixops/scripts/pull_deployment
+++ b/nixops/scripts/pull_deployment
@@ -9,7 +9,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" 9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
10export NIXOPS_DEPLOYMENT="$DeploymentUuid" 10export NIXOPS_DEPLOYMENT="$DeploymentUuid"
11source $(dirname $(dirname $DIR))/nix_path_env 11source $(dirname $(dirname $DIR))/nix_path_env
12nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" 12nixops="$(nix-build --no-out-link "$(dirname $DIR)/custom_nixops.nix")/bin/nixops"
13 13
14export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" 14export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
15 15
diff --git a/nixops/scripts/push_deployment b/nixops/scripts/push_deployment
index 067b665..6c67fab 100755
--- a/nixops/scripts/push_deployment
+++ b/nixops/scripts/push_deployment
@@ -9,6 +9,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" 9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
10export NIXOPS_DEPLOYMENT="$DeploymentUuid" 10export NIXOPS_DEPLOYMENT="$DeploymentUuid"
11source $(dirname $(dirname $DIR))/nix_path_env 11source $(dirname $(dirname $DIR))/nix_path_env
12nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" 12nixops="$(nix-build --no-out-link "$(dirname $DIR)/custom_nixops.nix")/bin/nixops"
13 13
14$nixops export | pass insert -m $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/Deployment 14$nixops export | pass insert -m $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/Deployment
diff --git a/nixops/scripts/setup b/nixops/scripts/setup
index 55dd9d9..1586265 100755
--- a/nixops/scripts/setup
+++ b/nixops/scripts/setup
@@ -136,7 +136,7 @@ fi
136 136
137DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 137DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
138source $(dirname $(dirname $DIR))/nix_path_env 138source $(dirname $(dirname $DIR))/nix_path_env
139nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" 139nixops="$(nix-build --no-out-link "$(dirname $DIR)/custom_nixops.nix")/bin/nixops"
140export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" 140export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
141export NIXOPS_DEPLOYMENT="$DeploymentUuid" 141export NIXOPS_DEPLOYMENT="$DeploymentUuid"
142 142
diff --git a/nixos_tools.nix b/nixos_tools.nix
deleted file mode 100644
index 0b52e8d..0000000
--- a/nixos_tools.nix
+++ /dev/null
@@ -1,4 +0,0 @@
1_:
2with import <nixpkgs/nixos> { configuration = {}; };
3with config.system.build;
4 [ nixos-generate-config nixos-install nixos-enter manual.manpages ]
diff --git a/overlays/default.nix b/overlays/default.nix
index ac7e401..dcb122e 100644
--- a/overlays/default.nix
+++ b/overlays/default.nix
@@ -1,6 +1,6 @@
1{ 1{
2 mylibs = self: super: { mylibs = import ../libs.nix { nixpkgs = self; }; }; 2 mylibs = self: super: { mylibs = import ../libs.nix { pkgs = self; }; };
3 mypkgs = import ./mypkgs.nix; 3 mypkgs = self: super: import ../pkgs { pkgs = self; };
4 4
5 bitlbee = import ./bitlbee; 5 bitlbee = import ./bitlbee;
6 dwm = import ./dwm; 6 dwm = import ./dwm;
@@ -25,3 +25,4 @@
25 ympd = import ./ympd; 25 ympd = import ./ympd;
26} 26}
27// import ./python-packages 27// import ./python-packages
28// import ./environments
diff --git a/overlays/environments/default.nix b/overlays/environments/default.nix
new file mode 100644
index 0000000..630b0bd
--- /dev/null
+++ b/overlays/environments/default.nix
@@ -0,0 +1,3 @@
1{
2 immae-eu = import ./immae-eu.nix;
3}
diff --git a/overlays/environments/immae-eu.nix b/overlays/environments/immae-eu.nix
new file mode 100644
index 0000000..303ab0f
--- /dev/null
+++ b/overlays/environments/immae-eu.nix
@@ -0,0 +1,114 @@
1self: super: with self;
2let
3 # https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh
4 # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks
5 paths = [
6 # archives
7 lzo unzip bzip2 p7zip xz
8 # unrar is unfree
9
10 # backups
11 duply
12
13 # calendar/contacts
14 abook khard khal cadaver vdirsyncer pal
15
16 # computing
17 boinctui
18
19 # cryptocurrencies
20 cardano sia monero
21 xmr-stak
22 solc
23 iota-cli-app
24
25 # debugging
26 rr valgrind netcat-gnu strace
27
28 # documentations
29 unicodeDoc
30
31 # e-mails
32 muttprint mutt-ics
33 notmuch-python2 notmuch-python3 notmuch-vim
34 neomutt mairix notmuch
35 bogofilter fetchmail
36
37 # git
38 vcsh gitRepo gitAndTools.stgit tig
39
40 # graphical tools
41 nextcloud-client firefox
42 dwm dmenu st
43
44 # images
45 feh imagemagick tiv graphicsmagick
46
47 # internet browsing
48 w3m lynx links elinks browsh weboob urlview googler urlwatch
49
50 # less
51 python3Packages.pygments lesspipe highlight sourceHighlight
52
53 # monitoring
54 cnagios mtop pg_activity nagios-cli mtr
55 iftop htop iotop iperf
56 goaccess
57 # nagnu
58
59 # messaging/forums/news
60 flrn slrn
61 telegram-cli telegram-history-dump telegramircd
62 weechat profanity
63 newsboat irssi
64
65 # nix
66 mylibs.yarn2nixPackage.yarn2nix
67 nixops nix-prefetch-scripts nix-generate-from-cpan
68 nix-zsh-completions bundix nodePackages.bower2nix
69 # (nixos {}).nixos-generate-config
70 # (nixos {}).nixos-install
71 # (nixos {}).nixos-enter
72 # (nixos {}).manual.manpages
73
74 # note taking
75 note terminal-velocity jrnl
76
77 # office
78 sc-im ranger
79 genius bc
80 ledger
81 tmux
82 rtorrent
83 ldapvi
84
85 # password management
86 pass apg pwgen
87
88 # pdf
89 pdftk poppler_utils
90
91 # programming
92 pelican emacs26-nox ctags
93
94 # security
95 keybase
96
97 # todolist/time management
98 taskwarrior vit timewarrior
99
100 # video/music
101 youtube-dl ncmpc ncmpcpp ffmpeg
102
103 # other tools
104 pgloader s3cmd lftp jq cpulimit libxslt
105 ];
106in
107{
108 myEnvironments.immae-eu = buildEnv {
109 name = "immae-eu-packages";
110 inherit paths;
111 pathsToLink = [ "/bin" "/etc" "/include" "/lib" "/libexec" "/share"];
112 extraOutputsToInstall = [ "bin" "man" "doc" "info" ];
113 };
114}
diff --git a/overlays/mypkgs.nix b/pkgs/default.nix
index f0bdf95..3c09e30 100644
--- a/overlays/mypkgs.nix
+++ b/pkgs/default.nix
@@ -1,4 +1,5 @@
1self: super: with self; 1{ pkgs }:
2with pkgs;
2{ 3{
3 boinctui = callPackage ../pkgs/boinctui {}; 4 boinctui = callPackage ../pkgs/boinctui {};
4 cnagios = callPackage ../pkgs/cnagios {}; 5 cnagios = callPackage ../pkgs/cnagios {};
diff --git a/scripts/make-env b/scripts/make-env
index 415bd5b..fc52adc 100755
--- a/scripts/make-env
+++ b/scripts/make-env
@@ -3,4 +3,4 @@
3DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 3DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4 4
5source $(dirname $DIR)/nix_path_env 5source $(dirname $DIR)/nix_path_env
6nix-env -r -i -A immaePackages -f "<nixpkgs>" "$@" 6nix-env -r -i -A myEnvironments.immae-eu -f "<nixpkgs>" "$@"