about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-01-05 04:22:04 +0300
committerAzat Bahawi <azat@bahawi.net>2023-01-05 04:22:04 +0300
commit5e81e4814d6da25ce8531baf0bc2d23da7fc26b3 (patch)
treecd887f80d9f98d42db556b4a42bcb8d5faa91c84 /modules
parent2022-12-17 (diff)
2023-01-05
Diffstat (limited to '')
-rw-r--r--modules/darwin/emacs.nix8
-rw-r--r--modules/nixfiles/common/nix/default.nix5
-rw-r--r--modules/nixfiles/discord.nix22
-rw-r--r--modules/nixfiles/emacs/default.nix4
-rw-r--r--modules/nixfiles/emacs/doom/init.el26
-rw-r--r--modules/nixos/common/networking.nix186
-rw-r--r--modules/nixos/common/nix.nix3
-rw-r--r--modules/nixos/discord.nix2
-rw-r--r--modules/nixos/emacs.nix2
-rw-r--r--modules/nixos/games/minecraft.nix4
-rw-r--r--modules/nixos/libvirtd.nix8
-rw-r--r--modules/nixos/matrix/default.nix8
-rw-r--r--modules/nixos/profiles/dev/default.nix4
-rw-r--r--modules/nixos/profiles/headful.nix5
14 files changed, 145 insertions, 142 deletions
diff --git a/modules/darwin/emacs.nix b/modules/darwin/emacs.nix
index 02bfb83..fd32276 100644
--- a/modules/darwin/emacs.nix
+++ b/modules/darwin/emacs.nix
@@ -7,9 +7,9 @@ with lib; let
   cfg = config.nixfiles.modules.emacs;
 in {
   config = mkIf cfg.enable {
-    # services.emacs = {
-    #   enable = true;
-    #   package = config.hm.programs.doom-emacs.package;
-    # };
+    services.emacs = {
+      enable = false; # TODO Figure out how to use this.
+      inherit (config.hm.programs.doom-emacs) package;
+    };
   };
 }
diff --git a/modules/nixfiles/common/nix/default.nix b/modules/nixfiles/common/nix/default.nix
index aeb25bd..436ce15 100644
--- a/modules/nixfiles/common/nix/default.nix
+++ b/modules/nixfiles/common/nix/default.nix
@@ -29,14 +29,12 @@ with lib; {
   in {
     # https://github.com/NixOS/nix/blob/master/src/libutil/experimental-features.cc
     extraOptions = ''
-      max-jobs = auto
       warn-dirty = false
       flake-registry = ${inputs.flake-registry}/flake-registry.json
       extra-experimental-features = ca-derivations
       extra-experimental-features = flakes
       extra-experimental-features = nix-command
       extra-experimental-features = recursive-nix
-      keep-going = true
       keep-derivations = ${
         if this.isHeadful
         then "true"
@@ -120,9 +118,8 @@ with lib; {
         tor-browser = tor-browser-bundle-bin;
       }))
     emacs-overlay.overlay
-    # nil.overlays.default
     nur.overlay
-    # pollymc.overlay
+    # nil.overlays.default
   ];
 
   environment.systemPackages = with pkgs;
diff --git a/modules/nixfiles/discord.nix b/modules/nixfiles/discord.nix
deleted file mode 100644
index 190b5fc..0000000
--- a/modules/nixfiles/discord.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-  config,
-  lib,
-  pkgs,
-  ...
-}:
-with lib; let
-  cfg = config.nixfiles.modules.discord;
-in {
-  options.nixfiles.modules.discord.enable =
-    mkEnableOption "Steam runtime";
-
-  config = mkIf cfg.enable {
-    nixfiles.modules.common.nix.allowedUnfreePackages = ["discord"];
-
-    hm.home.packages = with pkgs; [
-      (discord.override {
-        withOpenASAR = true;
-      })
-    ];
-  };
-}
diff --git a/modules/nixfiles/emacs/default.nix b/modules/nixfiles/emacs/default.nix
index 933a32e..499dd59 100644
--- a/modules/nixfiles/emacs/default.nix
+++ b/modules/nixfiles/emacs/default.nix
@@ -59,7 +59,7 @@ in {
             gotests # :lang go
             graphviz # :lang (org +roam2) :lang plantuml
             haskell-language-server # :lang (haskell +lsp)
-            haskellPackages.brittany # :lang haskell :editor format
+            # haskellPackages.brittany # :lang haskell :editor format # FIXME Dependency marked as broken.
             haskellPackages.cabal-fmt # :lang haskell :editor format
             haskellPackages.cabal-install # :lang haskell
             haskellPackages.hoogle # :lang haskell
@@ -105,7 +105,7 @@ in {
 
           (setq custom-file (file-name-concat doom-emacs-dir "custom.el"))
 
-          Font must be set to n+2 because otherwise it looks too small.
+          ;; Font must be set to n+2 because otherwise it looks too small.
           (setq doom-font (font-spec :family "${config.fontScheme.monospaceFont.family}"
                                      :size ${toString (config.fontScheme.monospaceFont.size + 2)})
                 doom-unicode-font doom-font)
diff --git a/modules/nixfiles/emacs/doom/init.el b/modules/nixfiles/emacs/doom/init.el
index efb831e..4d7dd66 100644
--- a/modules/nixfiles/emacs/doom/init.el
+++ b/modules/nixfiles/emacs/doom/init.el
@@ -13,7 +13,7 @@
        ;; doom-dashboard
        ;; doom-quit
        hl-todo
-       ;; indent-guides
+       indent-guides
        ;; ligatures
        ;; modeline
        ;; nav-flash
@@ -25,7 +25,7 @@
        (vc-gutter +diff-hl +pretty)
        window-select
        workspaces
-       ;; zen
+       zen
 
        :editor
        (evil +everywhere)
@@ -58,10 +58,10 @@
        ;; grammar
 
        :tools
-       ;; ansible
+       ansible
        (debugger +lsp)
        direnv
-       ;; (docker +lsp)
+       (docker +lsp)
        editorconfig
        (eval +overlay)
        (lookup +dictionary +offline)
@@ -75,14 +75,15 @@
        ;; upload
 
        :os
-       (tty +osc)
+       (:if IS-MAC macos)
+       ;; (tty +osc)
 
        :lang
        (cc +lsp +tree-sitter)
-       ;; (common-lisp +lsp +tree-sitter)
-       ;; (csharp +lsp +tree-sitter)
+       (common-lisp +lsp +tree-sitter)
+       (csharp +lsp +tree-sitter)
        data
-       ;; (dhall +lsp +tree-sitter)
+       (dhall +lsp +tree-sitter)
        (emacs-lisp +lsp +tree-sitter)
        (go +lsp +tree-sitter)
        ;; graphql
@@ -90,17 +91,18 @@
        (java +lsp +tree-sitter)
        (javascript +lsp +tree-sitter)
        json
+       (kotlin +lsp +tree-sitter)
        (latex +lsp +tree-sittter)
-       ;; (lua +lsp +tree-sitter)
+       (lua +lsp +tree-sitter)
        (markdown +lsp +tree-sitter)
        (nix +lsp)
        (org +pandoc +roam2)
        plantuml
        (python +lsp +tree-sitter)
-       ;; (racket +lsp +tree-sitter)
+       (racket +lsp +tree-sitter)
        ;; rst
-       ;; (rust +lsp +tree-sitter)
-       ;; (scheme +lsp +tree-sitter +racket)
+       (rust +lsp +tree-sitter)
+       (scheme +lsp +tree-sitter +racket)
        (sh +lsp +tree-sitter)
        web
        yaml
diff --git a/modules/nixos/common/networking.nix b/modules/nixos/common/networking.nix
index 6109933..0c44159 100644
--- a/modules/nixos/common/networking.nix
+++ b/modules/nixos/common/networking.nix
@@ -5,104 +5,118 @@
   this,
   ...
 }:
-with lib; {
-  # TODO Support multiple interfaces and IP addresses.
-  networking = mkMerge [
-    {
-      domain = my.domain.shire;
+with lib; let
+  cfg = config.nixfiles.modules.common.networking;
+in {
+  options.nixfiles.modules.common.networking.onlyDefault =
+    mkEnableOption "custom networking settings";
 
-      hostName = this.hostname;
-      hostId = substring 0 8 (builtins.hashString "md5" this.hostname);
+  config = mkIf (!cfg.onlyDefault) {
+    # TODO Support multiple interfaces and IP addresses.
+    networking = mkMerge [
+      {
+        domain = my.domain.shire;
 
-      # Remove default hostname mappings. This is required at least by the current
-      # implementation of the montoring module.
-      hosts = {
-        "127.0.0.2" = mkForce [];
-        "::1" = mkForce [];
-      };
+        hostName = this.hostname;
+        hostId = substring 0 8 (builtins.hashString "md5" this.hostname);
 
-      nameservers = mkDefault dns.const.quad9.default;
+        # Remove default hostname mappings. This is required at least by the current
+        # implementation of the montoring module.
+        hosts = {
+          "127.0.0.2" = mkForce [];
+          "::1" = mkForce [];
+        };
 
-      useDHCP = false;
+        nameservers = mkDefault dns.const.quad9.default;
 
-      firewall = {
-        enable = true;
+        useDHCP = false;
 
-        rejectPackets = false;
+        firewall = {
+          enable = true;
 
-        allowPing = true;
-        pingLimit = "--limit 1/minute --limit-burst 5";
+          rejectPackets = false;
 
-        logRefusedConnections = false;
-        logRefusedPackets = false;
-        logRefusedUnicastsOnly = false;
-        logReversePathDrops = false;
-      };
-    }
-    (let
-      interface = "eth0"; # This assumes `usePredictableInterfaceNames` is false.
-    in
-      mkIf (hasAttr "ipv4" this && hasAttr "ipv6" this) {
-        usePredictableInterfaceNames = false; # NOTE This can break something!
-        interfaces.${interface} = {
-          ipv4.addresses = with this.ipv4;
-            optional (isString address && isInt prefixLength) {
-              inherit address prefixLength;
-            };
+          allowPing = true;
+          pingLimit = "--limit 1/minute --limit-burst 5";
 
-          ipv6.addresses = with this.ipv6;
-            optional (isString address && isInt prefixLength) {
-              inherit address prefixLength;
-            };
+          logRefusedConnections = false;
+          logRefusedPackets = false;
+          logRefusedUnicastsOnly = false;
+          logReversePathDrops = false;
         };
-        defaultGateway = with this.ipv4;
-          mkIf (isString gatewayAddress) {
-            inherit interface;
-            address = gatewayAddress;
-          };
-        defaultGateway6 = with this.ipv6;
-          mkIf (isString gatewayAddress) {
-            inherit interface;
-            address = gatewayAddress;
+      }
+      (let
+        interface = "eth0"; # This assumes `usePredictableInterfaceNames` is false.
+      in
+        mkIf (hasAttr "ipv4" this && hasAttr "ipv6" this) {
+          usePredictableInterfaceNames = false; # NOTE This can break something!
+          interfaces.${interface} = {
+            ipv4.addresses = with this.ipv4;
+              optional (isString address && isInt prefixLength) {
+                inherit address prefixLength;
+              };
+
+            ipv6.addresses = with this.ipv6;
+              optional (isString address && isInt prefixLength) {
+                inherit address prefixLength;
+              };
           };
-      })
-    (mkIf this.isHeadful {
-      interfaces = {
-        eth0.useDHCP = mkDefault true;
-        wlan0.useDHCP = mkDefault true;
-      };
+          defaultGateway = with this.ipv4;
+            mkIf (isString gatewayAddress) {
+              inherit interface;
+              address = gatewayAddress;
+            };
+          defaultGateway6 = with this.ipv6;
+            mkIf (isString gatewayAddress) {
+              inherit interface;
+              address = gatewayAddress;
+            };
+        })
+      (mkIf this.isHeadful {
+        interfaces = {
+          eth0.useDHCP = mkDefault true;
+          wlan0.useDHCP = mkDefault true;
+        };
 
-      networkmanager = {
-        enable = mkDefault true;
-        wifi.backend = "iwd";
-      };
+        networkmanager = {
+          enable = mkDefault true;
+          wifi.backend = "iwd";
+        };
 
-      wireless = {
-        enable = false;
-        iwd.enable = mkDefault true;
-        userControlled.enable = true;
-        allowAuxiliaryImperativeNetworks = true;
-      };
-    })
-  ];
+        wireless = {
+          enable = false;
+          iwd.enable = mkDefault true;
+          userControlled.enable = true;
+          allowAuxiliaryImperativeNetworks = true;
+        };
+      })
+    ];
 
-  environment.shellAliases = listToAttrs (map
-    ({
-      name,
-      value,
-    }:
-      nameValuePair name "${pkgs.iproute2}/bin/${value}") [
-      {
-        name = "bridge";
-        value = "bridge -color=always";
-      }
-      {
-        name = "ip";
-        value = "ip -color=always";
-      }
-      {
-        name = "tc";
-        value = "tc -color=always";
-      }
-    ]);
+    environment = {
+      shellAliases = listToAttrs (map
+        ({
+          name,
+          value,
+        }:
+          nameValuePair name "${pkgs.iproute2}/bin/${value}") [
+          {
+            name = "bridge";
+            value = "bridge -color=always";
+          }
+          {
+            name = "ip";
+            value = "ip -color=always";
+          }
+          {
+            name = "tc";
+            value = "tc -color=always";
+          }
+        ]);
+
+      systemPackages = with pkgs; [
+        ethtool
+        nethogs
+      ];
+    };
+  };
 }
diff --git a/modules/nixos/common/nix.nix b/modules/nixos/common/nix.nix
index 07136a0..71f62fd 100644
--- a/modules/nixos/common/nix.nix
+++ b/modules/nixos/common/nix.nix
@@ -22,8 +22,9 @@ in {
 
       overlays = with inputs; [
         agenix.overlay
-        # nix-minecraft-servers.overlays.default
+        pollymc.overlay
         xmonad-ng.overlays.default
+        # nix-minecraft-servers.overlays.default
       ];
     };
 
diff --git a/modules/nixos/discord.nix b/modules/nixos/discord.nix
index 190b5fc..69ab525 100644
--- a/modules/nixos/discord.nix
+++ b/modules/nixos/discord.nix
@@ -15,7 +15,7 @@ in {
 
     hm.home.packages = with pkgs; [
       (discord.override {
-        withOpenASAR = true;
+        withOpenASAR = false; # This doesnt work.
       })
     ];
   };
diff --git a/modules/nixos/emacs.nix b/modules/nixos/emacs.nix
index 800d411..2db8120 100644
--- a/modules/nixos/emacs.nix
+++ b/modules/nixos/emacs.nix
@@ -17,7 +17,7 @@ in {
     nixfiles.modules.x11.enable = true;
 
     hm = {
-      programs.doom-emacs.extraConfig = ''
+      programs.doom-emacs.extraConfig = mkAfter ''
         (appendq! auth-sources '("${config.secrets.authinfo.path}"))
       '';
 
diff --git a/modules/nixos/games/minecraft.nix b/modules/nixos/games/minecraft.nix
index e53f9eb..7b21195 100644
--- a/modules/nixos/games/minecraft.nix
+++ b/modules/nixos/games/minecraft.nix
@@ -22,7 +22,7 @@ in {
 
   config = mkMerge [
     (mkIf cfg.client.enable {
-      hm.home.packages = with pkgs; [pollymc];
+      hm.home.packages = with pkgs; [prismlauncher];
     })
     (mkIf cfg.server.enable {
       # Configurations, opslist, whitelist and plugins are managed imperatively.
@@ -31,7 +31,7 @@ in {
         enable = true;
         eula = true;
 
-        package = pkgs.minecraftServers.purpur_1_19_2;
+        package = pkgs.minecraftServers.purpur_1_19_3;
 
         # TODO Make a PR fixing trailing whitespace on this.
         jvmOpts =
diff --git a/modules/nixos/libvirtd.nix b/modules/nixos/libvirtd.nix
index ae8b336..58dfc50 100644
--- a/modules/nixos/libvirtd.nix
+++ b/modules/nixos/libvirtd.nix
@@ -10,6 +10,12 @@ in {
   options.nixfiles.modules.libvirtd.enable = mkEnableOption "libvirtd";
 
   config = mkIf cfg.enable {
+    hm.home.packages = with pkgs; [
+      qemu-utils
+      quickemu
+      virt-manager
+    ];
+
     virtualisation.libvirtd = {
       enable = true;
 
@@ -37,8 +43,6 @@ in {
       };
     };
 
-    environment.systemPackages = with pkgs; [virt-manager qemu-utils];
-
     my.extraGroups = ["libvirtd"];
   };
 }
diff --git a/modules/nixos/matrix/default.nix b/modules/nixos/matrix/default.nix
index bd221c4..879243e 100644
--- a/modules/nixos/matrix/default.nix
+++ b/modules/nixos/matrix/default.nix
@@ -1 +1,7 @@
-_: {imports = [./dendrite.nix ./element.nix ./synapse.nix];}
+_: {
+  imports = [
+    ./dendrite.nix
+    ./element.nix
+    ./synapse.nix
+  ];
+}
diff --git a/modules/nixos/profiles/dev/default.nix b/modules/nixos/profiles/dev/default.nix
index 83d41c0..8cb2356 100644
--- a/modules/nixos/profiles/dev/default.nix
+++ b/modules/nixos/profiles/dev/default.nix
@@ -8,6 +8,10 @@
 with lib; let
   cfg = config.nixfiles.modules.profiles.dev.default;
 in {
+  imports = [
+    ./containers.nix
+  ];
+
   config = mkIf cfg.enable {
     hm.home.language = {
       collate = "C";
diff --git a/modules/nixos/profiles/headful.nix b/modules/nixos/profiles/headful.nix
index d15f004..2d37b47 100644
--- a/modules/nixos/profiles/headful.nix
+++ b/modules/nixos/profiles/headful.nix
@@ -77,10 +77,7 @@ in {
       psd.enable = true;
     };
 
-    environment.systemPackages = with pkgs; [
-      ethtool
-      nethogs
-    ];
+    environment.systemPackages = with pkgs; [lm_sensors];
 
     my.extraGroups = ["audio" "video" "input"];
   };

Consider giving Nix/NixOS a try! <3