]> Git — Sourcephile - sourcephile-nix.git/blob - nixos/defaults.nix
nix: avoid useless nix-shell's cache loading
[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 passwordAuthentication = false;
57 extraConfig = ''
58 '';
59 };
60 journald = {
61 extraConfig = ''
62 SystemMaxUse=50M
63 '';
64 };
65 };
66
67 environment = {
68 systemPackages = with pkgs; [
69 binutils
70 dnsutils
71 htop
72 inetutils
73 iotop
74 lsof
75 mailutils
76 multitail
77 ncdu
78 pv
79 swaplist
80 tcpdump
81 tmux
82 tree
83 vim
84 which
85 ];
86
87 etc."inputrc".text = lib.readFile defaults/readline/inputrc;
88 };
89
90 programs = {
91 bash = {
92 interactiveShellInit = ''
93 bind '"\e[A":history-search-backward'
94 bind '"\e[B":history-search-forward'
95
96 # Ignore duplicate commands, ignore commands starting with a space
97 export HISTCONTROL=erasedups:ignorespace
98 export HISTSIZE=42000
99
100 # Append to the history instead of overwriting (good for multiple connections)
101 shopt -s histappend
102 '';
103 shellAliases = {
104 cl = "clear";
105 l = "ls -alh";
106 ll = "ls -l";
107 ls = "ls --color=tty";
108 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
109
110 s="sudo systemctl";
111 s-u="systemctl --user";
112
113 nixos-clean="sudo nix-collect-garbage -d";
114 nixos-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
115 nixos-rollback="sudo nixos-rebuild switch --rollback";
116 nixos-update="sudo nix-channel --update";
117 nixos-upgrade="sudo nixos-rebuild switch";
118 nixos-upstream="sudo nix-channel --list";
119 };
120 };
121 mtr.enable = true;
122 };
123 };
124 }