]> Git — Sourcephile - sourcephile-nix.git/blob - nixos/defaults.nix
nix: shell: add dig
[sourcephile-nix.git] / nixos / defaults.nix
1 { pkgs, lib, config, ... }:
2 let inherit (lib) types;
3 in
4 {
5 imports = [
6 ./modules.nix
7 ./defaults/predictable-interface-names.nix
8 ];
9 config = {
10 nix = {
11 autoOptimiseStore = true;
12 extraOptions = ''
13 '';
14 # Use gc.automatic to keep disk space under control.
15 gc = {
16 automatic = true;
17 dates = "weekly";
18 options = "--delete-older-than 30d";
19 };
20 };
21
22 nixpkgs = {
23 config = {
24 allowUnfree = false;
25 /*
26 packageOverrides = pkgs: {
27 postfix = pkgs.postfix.override {
28 withLDAP = true;
29 };
30 };
31 */
32 };
33 #overlays = import ../overlays.nix;
34 };
35
36 documentation.nixos = {
37 enable = false; # NOTE: useless on a server, and CPU intensive.
38 };
39
40 # Clean /tmp automatically on boot.
41 boot.cleanTmpDir = true;
42
43 time = {
44 timeZone = "Europe/Paris";
45 };
46
47 i18n = {
48 consoleFont = "Lat2-Terminus16";
49 consoleKeyMap = "fr";
50 defaultLocale = "fr_FR.UTF-8";
51 };
52
53 services = {
54 openssh = {
55 enable = true;
56 extraConfig = ''
57 '';
58 };
59 journald = {
60 extraConfig = ''
61 SystemMaxUse=50M
62 '';
63 };
64 };
65
66 environment = {
67 systemPackages = with pkgs; [
68 binutils
69 dnsutils
70 htop
71 inetutils
72 iotop
73 lsof
74 mailutils
75 multitail
76 ncdu
77 pv
78 swaplist
79 tcpdump
80 tmux
81 tree
82 vim
83 which
84 ];
85
86 etc."inputrc".text = lib.readFile defaults/readline/inputrc;
87 };
88
89 programs = {
90 bash = {
91 interactiveShellInit = ''
92 bind '"\e[A":history-search-backward'
93 bind '"\e[B":history-search-forward'
94
95 # Ignore duplicate commands, ignore commands starting with a space
96 export HISTCONTROL=erasedups:ignorespace
97 export HISTSIZE=42000
98
99 # Append to the history instead of overwriting (good for multiple connections)
100 shopt -s histappend
101 '';
102 shellAliases = {
103 cl = "clear";
104 l = "ls -alh";
105 ll = "ls -l";
106 ls = "ls --color=tty";
107 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
108
109 s="sudo systemctl";
110 s-u="systemctl --user";
111
112 nixos-clean="sudo nix-collect-garbage -d";
113 nixos-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
114 nixos-rollback="sudo nixos-rebuild switch --rollback";
115 nixos-update="sudo nix-channel --update";
116 nixos-upgrade="sudo nixos-rebuild switch";
117 nixos-upstream="sudo nix-channel --list";
118 };
119 };
120 mtr.enable = true;
121 };
122 };
123 }