Commit 8b45999ef3f3

Vincent Demeester <vincent@sbr.pm>
2024-05-13 17:26:41
systems: make sure we can build 23.11 and 24.05 (unstable) at the same time
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent d86fd0c
Changed files (5)
systems
users
vincent
systems/modules/hardware/audio.nix
@@ -1,7 +1,8 @@
 { config, lib, pkgs, ... }:
 let
-  inherit (lib) mkEnableOption mkIf mkMerge mkOption types;
+  inherit (lib) mkEnableOption mkIf mkMerge mkOption types versionOlder;
   cfg = config.modules.hardware.audio;
+  stable = versionOlder config.system.nixos.release "24.05";
 in
 {
   options.modules.hardware.audio = {
@@ -38,6 +39,7 @@ in
         pulse.enable = true;
         wireplumber = {
           enable = true;
+        } // (if stable then { } else {
           configPackages = [
             (pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
               bluez_monitor.properties = {
@@ -48,7 +50,8 @@ in
               }
             '')
           ];
-        };
+        });
+      } // (if stable then { } else {
         extraConfig = {
           pipewire-pulse = {
             "50-network-party.conf" = {
@@ -66,7 +69,7 @@ in
             };
           };
         };
-      };
+      });
       networking.firewall = {
         allowedTCPPorts = [ 6001 6002 ];
       };
systems/modules/hardware/bluetooth.nix
@@ -1,8 +1,7 @@
 { config, lib, pkgs, ... }:
 let
-  inherit (lib) mkEnableOption mkIf mkMerge versionOlder;
+  inherit (lib) mkEnableOption mkIf mkMerge;
   cfg = config.modules.hardware.bluetooth;
-  stable = versionOlder config.system.nixos.release "21.05";
 in
 {
   options.modules.hardware.bluetooth = {
@@ -21,20 +20,11 @@ in
         # support, so it must be selected here.
         package = pkgs.pulseaudioFull;
       };
-    })
-    (mkIf (stable && config.modules.hardware.audio.enable) {
-      hardware.bluetooth.extraConfig = ''
-        [General]
-        Enable=Source,Sink,Media,Socket
-      '';
-    })
-    (mkIf ((!stable) && config.modules.hardware.audio.enable)
-      {
-        hardware.bluetooth.settings = {
-          General = {
-            Enable = "Source,Sink,Media,Socket";
-          };
+      hardware.bluetooth.settings = {
+        General = {
+          Enable = "Source,Sink,Media,Socket";
         };
-      })
+      };
+    })
   ]);
 }
systems/modules/services/avahi.nix
@@ -1,8 +1,9 @@
 { config, lib, pkgs, ... }:
 
-with lib;
 let
+  inherit (lib) mkEnableOption mkIf versionOlder;
   cfg = config.modules.services.avahi;
+  stable = versionOlder config.system.nixos.release "24.05";
 in
 {
   options = {
@@ -10,18 +11,24 @@ in
       enable = mkEnableOption "Enable avahi profile";
     };
   };
-  config = mkIf cfg.enable {
-    services = {
-      avahi = {
-        enable = true;
-        ipv4 = true;
-        ipv6 = true;
-        nssmdns4 = true;
-        publish = {
+
+  config = mkIf cfg.enable
+    {
+      services = {
+        avahi = {
           enable = true;
-          userServices = true;
-        };
+          ipv4 = true;
+          ipv6 = true;
+          publish = {
+            enable = true;
+            userServices = true;
+          };
+        } // (if stable
+        then {
+          nssmdns = true;
+        } else {
+          nssmdns4 = true;
+        });
       };
     };
-  };
 }
users/vincent/core/gpg.nix
@@ -1,7 +1,7 @@
 { pkgs, lib, nixosConfig, ... }:
 
 let
-  pinentry = if (nixosConfig.modules.desktop.enable) then pkgs.pinentry-gnome3 else pkgs.pinentry-tty;
+  stable = lib.versionOlder nixosConfig.system.nixos.release "24.05";
 in
 {
   home.packages = with pkgs; [ gnupg ];
@@ -11,8 +11,11 @@ in
       enableSshSupport = true;
       enableExtraSocket = true;
       defaultCacheTtlSsh = 7200;
-      pinentryPackage = pinentry;
-    };
+    } // (if stable then {
+      pinentryFlavor = if (nixosConfig.modules.desktop.enable) then "gnome3" else "tty";
+    } else {
+      pinentryPackage = if (nixosConfig.modules.desktop.enable) then pkgs.pinentry-gnome3 else pkgs.pinentry-tty;
+    });
   };
 }
 
users/vincent/core/zsh.nix
@@ -1,6 +1,7 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, nixosConfig, pkgs, ... }:
 let
   shellConfig = import ./shell.nix { inherit config lib pkgs; };
+  stable = lib.versionOlder nixosConfig.system.nixos.release "24.05";
 in
 {
   home.packages = with pkgs; [
@@ -18,7 +19,6 @@ in
 
   programs.zsh = {
     enable = true;
-    autosuggestion.enable = true;
     enableCompletion = true;
     autocd = true;
     dotDir = ".config/zsh";
@@ -163,5 +163,9 @@ in
       }
     ];
     shellAliases = shellConfig.aliases;
-  };
+  } // (if stable then {
+    enableAutosuggestions = true;
+  } else {
+    autosuggestion.enable = true;
+  });
 }