git: tweak config
[julm/julm-nix.git] / nixos / profiles / system.nix
index e17a18291294c7e60351481fba4d870bbc42805d..f243ae76e2310be0e8f6272f88606a0fa93b272d 100644 (file)
@@ -1,8 +1,15 @@
-{ config, pkgs, lib, inputs, ... }:
+{
+  config,
+  pkgs,
+  lib,
+  inputs,
+  ...
+}:
 with lib;
 {
   boot.tmp.cleanOnBoot = mkDefault true;
   boot.tmp.useTmpfs = mkDefault true;
+
   services.logrotate.enable = true;
   # NOTE: mostly useless on a server, and CPU intensive.
   documentation = {
@@ -14,6 +21,7 @@ with lib;
     nixos.enable = mkDefault false;
   };
   programs.vim.defaultEditor = mkDefault true;
+  programs.vim.enable = mkDefault true;
   environment.variables = {
     EDITOR = "vim";
     NIXPKGS_CONFIG = mkForce "";
@@ -28,7 +36,7 @@ with lib;
       ../../home-manager/options.nix
       ../../home-manager/profiles/essential.nix
     ];
-    services.gpg-agent.pinentryFlavor = "curses";
+    services.gpg-agent.pinentryPackage = pkgs.pinentry-curses;
   };
   nix = {
     settings.auto-optimise-store = mkDefault true;
@@ -36,9 +44,27 @@ with lib;
     gc.dates = mkDefault "weekly";
     gc.options = mkDefault "--delete-older-than 7d";
     nixPath = mkForce [ ];
+    # Pin the rev to the revision of the public Nixpkgs that the system was built from.
+    # This is the version which will be locked by flakes using flake:nixpkgs
     #registry.nixpkgs = mkDefault { flake = inputs.nixpkgs; };
-    package = pkgs.nixFlakes;
-    settings.experimental-features = [ "nix-command" "flakes" "repl-flake" ];
+    registry.nixpkgs = {
+      from = {
+        id = "nixpkgs";
+        type = "indirect";
+      };
+      to = {
+        owner = "NixOS";
+        repo = "nixpkgs";
+        inherit (inputs.nixpkgs) rev;
+        # May be overriden by nixos/modules/installer/cd-dvd/channel.nix
+        type = mkDefault "github";
+      };
+    };
+    package = pkgs.nixVersions.stable;
+    settings.experimental-features = [
+      "nix-command"
+      "flakes"
+    ];
   };
   security.lockKernelModules = false;
   services.journald = {
@@ -49,13 +75,18 @@ with lib;
       SystemMaxUse=100M
     '';
   };
+  # none is the recommended elevator for SSD, whereas HDD could use mq-deadline.
+  services.udev.extraRules = ''
+    ACTION=="add|change", KERNEL=="sd[a-z][0-9]*", ATTR{../queue/rotational}=="0", ATTR{../queue/scheduler}="none"
+    ACTION=="add|change", KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ATTR{../queue/rotational}=="0", ATTR{../queue/scheduler}="none"
+  '';
   systemd.oomd = {
     enable = mkDefault true;
     enableRootSlice = mkDefault true;
     enableSystemSlice = mkDefault true;
-    enableUserServices = mkDefault true;
+    enableUserSlices = mkDefault true;
   };
-  systemd.services.openssh = {
+  systemd.services.sshd = {
     serviceConfig = {
       ManagedOOMPreference = "omit";
     };