summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-04-13 11:15:23 +0200
committerGitHub <noreply@github.com>2022-04-13 11:15:23 +0200
commitd8cec85ca62e9f6c1576a8d87ebd17350710b449 (patch)
treea3b2fef15885afb11dd469188816931e336b4fce /nixos
parentce75dc584d23cbeb9c8748e4db03a236ad3afaa8 (diff)
parent1eac8d2c54b1265159bb2a380439a63d5c86c21d (diff)
downloadnixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar
nixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.gz
nixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.bz2
nixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.lz
nixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.xz
nixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.tar.zst
nixpkgs-d8cec85ca62e9f6c1576a8d87ebd17350710b449.zip
Merge pull request #140607 from jkarlson/terminfo
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/terminfo.nix26
-rw-r--r--nixos/tests/all-terminfo.nix31
-rw-r--r--nixos/tests/all-tests.nix1
3 files changed, 57 insertions, 1 deletions
diff --git a/nixos/modules/config/terminfo.nix b/nixos/modules/config/terminfo.nix
index 1396640af67..693404a429c 100644
--- a/nixos/modules/config/terminfo.nix
+++ b/nixos/modules/config/terminfo.nix
@@ -1,9 +1,33 @@
 # This module manages the terminfo database
 # and its integration in the system.
-{ config, ... }:
+{ config, lib, pkgs, ... }:
+
+with lib;
+
 {
+
+  options.environment.enableAllTerminfo = with lib; mkOption {
+    default = false;
+    type = types.bool;
+    description = ''
+      Whether to install all terminfo outputs
+    '';
+  };
+
   config = {
 
+    # can be generated with: filter (drv: (builtins.tryEval (drv ? terminfo)).value) (attrValues pkgs)
+    environment.systemPackages = mkIf config.environment.enableAllTerminfo (map (x: x.terminfo) (with pkgs; [
+      alacritty
+      foot
+      kitty
+      mtm
+      rxvt-unicode-unwrapped
+      rxvt-unicode-unwrapped-emoji
+      termite
+      wezterm
+    ]));
+
     environment.pathsToLink = [
       "/share/terminfo"
     ];
diff --git a/nixos/tests/all-terminfo.nix b/nixos/tests/all-terminfo.nix
new file mode 100644
index 00000000000..dd47c66ee1c
--- /dev/null
+++ b/nixos/tests/all-terminfo.nix
@@ -0,0 +1,31 @@
+import ./make-test-python.nix ({ pkgs, ... }: rec {
+  name = "all-terminfo";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ jkarlson ];
+  };
+
+  nodes.machine = { pkgs, config, lib, ... }:
+    let
+      infoFilter = name: drv:
+        let
+          o = builtins.tryEval drv;
+        in
+        o.success && lib.isDerivation o.value && o.value ? outputs && builtins.elem "terminfo" o.value.outputs;
+      terminfos = lib.filterAttrs infoFilter pkgs;
+      excludedTerminfos = lib.filterAttrs (_: drv: !(builtins.elem drv.terminfo config.environment.systemPackages)) terminfos;
+      includedOuts = lib.filterAttrs (_: drv: builtins.elem drv.out config.environment.systemPackages) terminfos;
+    in
+    {
+      environment = {
+        enableAllTerminfo = true;
+        etc."terminfo-missing".text = builtins.concatStringsSep "\n" (builtins.attrNames excludedTerminfos);
+        etc."terminfo-extra-outs".text = builtins.concatStringsSep "\n" (builtins.attrNames includedOuts);
+      };
+    };
+
+  testScript =
+    ''
+      machine.fail("grep . /etc/terminfo-missing >&2")
+      machine.fail("grep . /etc/terminfo-extra-outs >&2")
+    '';
+})
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 0a735291353..a1d4e284657 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -35,6 +35,7 @@ in
   agate = handleTest ./web-servers/agate.nix {};
   agda = handleTest ./agda.nix {};
   airsonic = handleTest ./airsonic.nix {};
+  allTerminfo = handleTest ./all-terminfo.nix {};
   amazon-init-shell = handleTest ./amazon-init-shell.nix {};
   apfs = handleTest ./apfs.nix {};
   apparmor = handleTest ./apparmor.nix {};