From ea48c418da95fe4600fd7f72a2980f87235b2cbd Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Thu, 22 Feb 2018 20:13:42 +0100 Subject: [PATCH 1/5] nixos: disable sound by default, if stateVersion > 18.03 --- nixos/doc/manual/release-notes/rl-1803.xml | 3 +++ nixos/modules/installer/tools/nixos-generate-config.pl | 4 ++++ nixos/modules/services/audio/alsa.nix | 5 +++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-1803.xml b/nixos/doc/manual/release-notes/rl-1803.xml index ce58c4dc95b08..469c6a9f338c1 100644 --- a/nixos/doc/manual/release-notes/rl-1803.xml +++ b/nixos/doc/manual/release-notes/rl-1803.xml @@ -209,6 +209,9 @@ following incompatible changes: For stateVersion = "17.09" or lower the old behavior is preserved. + + sound.enable now defaults to false. + matrix-synapse uses postgresql by default instead of sqlite. diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index a82ee63fd0cda..0e0744a52e42f 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -603,6 +603,10 @@ sub multiLineList { # Enable CUPS to print documents. # services.printing.enable = true; + # Enable sound. + # sound.enable = true; + # hardware.pulseaudio.enable = true; + # Enable the X11 windowing system. # services.xserver.enable = true; # services.xserver.layout = "us"; diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index acf48d3c3d032..c02a8ed4dda2b 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -21,7 +21,6 @@ in enable = mkOption { type = types.bool; - default = true; description = '' Whether to enable ALSA sound. ''; @@ -78,7 +77,9 @@ in ###### implementation - config = mkIf config.sound.enable { + config = { + sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03") + } // mkIf config.sound.enable { environment.systemPackages = [ alsaUtils ]; From 58b07ac10abae668dafd579fabbd29f0affbe2cd Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Thu, 22 Feb 2018 20:33:20 +0100 Subject: [PATCH 2/5] nixos: fix syntax error in alsa module --- nixos/modules/services/audio/alsa.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index c02a8ed4dda2b..6088aa45372eb 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -78,7 +78,7 @@ in ###### implementation config = { - sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03") + sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03"); } // mkIf config.sound.enable { environment.systemPackages = [ alsaUtils ]; From 3af0ff2b549a0a98f8a1bd0331fd690aa0874839 Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Thu, 22 Feb 2018 20:40:26 +0100 Subject: [PATCH 3/5] nixos: fix another syntax error (local instantiation succeeds now) --- nixos/modules/services/audio/alsa.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index 6088aa45372eb..64c1d7b19c969 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -78,7 +78,7 @@ in ###### implementation config = { - sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03"); + sound.enable = mkDefault (!versionAtLeast config.system.stateVersion "18.03"); } // mkIf config.sound.enable { environment.systemPackages = [ alsaUtils ]; From 473cfed43d031ddb9520d0ff692448c4156f474c Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Thu, 22 Feb 2018 21:12:19 +0100 Subject: [PATCH 4/5] nixos/alsa: fix wrong use of mkIf --- nixos/modules/services/audio/alsa.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index 64c1d7b19c969..ea1bdc622d2a9 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -77,9 +77,11 @@ in ###### implementation - config = { + config = mkMerge [ + ({ sound.enable = mkDefault (!versionAtLeast config.system.stateVersion "18.03"); - } // mkIf config.sound.enable { + }) + (mkIf config.sound.enable { environment.systemPackages = [ alsaUtils ]; @@ -125,6 +127,6 @@ in ]; }; - }; + })]; } From f3728987d6c3bce2e1fdaf1fb5a44e8abbeb9c4e Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Thu, 22 Feb 2018 21:17:36 +0100 Subject: [PATCH 5/5] nixos/alsa: fix missing defaultText --- nixos/modules/services/audio/alsa.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index ea1bdc622d2a9..161d873686a87 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -21,6 +21,7 @@ in enable = mkOption { type = types.bool; + defaultText = "!versionAtLeast system.stateVersion \"18.03\""; description = '' Whether to enable ALSA sound. '';