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