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