]> Git — Sourcephile - julm/julm-nix.git/blob - nixos/profiles/system.nix
courge: fix GTK config
[julm/julm-nix.git] / nixos / profiles / system.nix
1 { config, pkgs, lib, inputs, ... }:
2 with lib;
3 {
4 boot.tmp.cleanOnBoot = mkDefault true;
5 boot.tmp.useTmpfs = mkDefault true;
6 services.logrotate.enable = true;
7 # NOTE: mostly useless on a server, and CPU intensive.
8 documentation = {
9 enable = mkDefault true;
10 dev.enable = mkDefault false;
11 doc.enable = mkDefault true;
12 info.enable = mkDefault false;
13 man.enable = mkDefault true;
14 nixos.enable = mkDefault false;
15 };
16 programs.vim.defaultEditor = mkDefault true;
17 environment.variables = {
18 EDITOR = "vim";
19 NIXPKGS_CONFIG = mkForce "";
20 PAGER = "less -R";
21 SYSTEMD_LESS = "FKMRX";
22 # Setting TZ= avoids a lot of useless syscalls reading /etc/localtime
23 # but requires to restart the session to change the time zone for all programs.
24 TZ = lib.mkDefault (if config.time.timeZone != null then config.time.timeZone else "Europe/Paris");
25 };
26 home-manager.users.root = {
27 imports = [
28 ../../home-manager/options.nix
29 ../../home-manager/profiles/essential.nix
30 ];
31 services.gpg-agent.pinentryPackage = pkgs.pinentry-curses;
32 };
33 nix = {
34 settings.auto-optimise-store = mkDefault true;
35 gc.automatic = mkDefault true;
36 gc.dates = mkDefault "weekly";
37 gc.options = mkDefault "--delete-older-than 7d";
38 nixPath = mkForce [ ];
39 # Pin the rev to the revision of the public Nixpkgs that the system was built from.
40 # This is the version which will be locked by flakes using flake:nixpkgs
41 #registry.nixpkgs = mkDefault { flake = inputs.nixpkgs; };
42 registry.nixpkgs = {
43 from = { id = "nixpkgs"; type = "indirect"; };
44 to = {
45 owner = "NixOS";
46 repo = "nixpkgs";
47 inherit (inputs.nixpkgs) rev;
48 type = "github";
49 };
50 };
51 package = pkgs.nixFlakes;
52 settings.experimental-features = [ "nix-command" "flakes" "repl-flake" ];
53 };
54 security.lockKernelModules = false;
55 services.journald = {
56 extraConfig = ''
57 Compress=true
58 MaxRetentionSec=1month
59 Storage=persistent
60 SystemMaxUse=100M
61 '';
62 };
63 # none is the recommended elevator for SSD, whereas HDD could use mq-deadline.
64 services.udev.extraRules = ''
65 ACTION=="add|change", KERNEL=="sd[a-z][0-9]*", ATTR{../queue/rotational}=="0", ATTR{../queue/scheduler}="none"
66 ACTION=="add|change", KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ATTR{../queue/rotational}=="0", ATTR{../queue/scheduler}="none"
67 '';
68 systemd.oomd = {
69 enable = mkDefault true;
70 enableRootSlice = mkDefault true;
71 enableSystemSlice = mkDefault true;
72 enableUserSlices = mkDefault true;
73 };
74 systemd.services.openssh = {
75 serviceConfig = {
76 ManagedOOMPreference = "omit";
77 };
78 };
79 /*
80 system.nixos.versionSuffix = ".${
81 substring 0 8 (inputs.self.lastModifiedDate or inputs.self.lastModified)}.${
82 inputs.self.shortRev or "dirty"}";
83 system.nixos.revision = mkIf (inputs.self ? rev) inputs.self.rev;
84 */
85 # Let 'nixos-version --json' know about the Git revision of this flake.
86 system.configurationRevision = mkIf (inputs.self ? rev) inputs.self.rev;
87 /*
88 system.configurationRevision =
89 if inputs.self ? rev
90 then inputs.self.rev
91 else throw "Refusing to build from a dirty Git tree!";
92 */
93 users.mutableUsers = false;
94 }