Skip to content

Commit

Permalink
Merge pull request #590 from nix-community/misc
Browse files Browse the repository at this point in the history
Various fixes (macOS, mdns)
  • Loading branch information
zimbatm authored Dec 28, 2024
2 parents 2a30339 + a48f731 commit e3b4048
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
3 changes: 0 additions & 3 deletions darwin/mixins/nix-experimental.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@
++ lib.optional (lib.versionAtLeast (lib.versions.majorMinor config.nix.package.version) "2.19")
# Allow the use of the impure-env setting.
"configurable-impure-env";

# for container in builds support
nix.settings.system-features = lib.mkDefault [ "uid-range" ];
}
18 changes: 7 additions & 11 deletions nixos/mixins/mdns.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{ config, lib, ... }:
let
# The default value of useDHCP for individual interfaces is null!
mapInterfaceEnabled = i: lib.nameValuePair "40-${i.name}" (i.useDHCP == true);
mapMDNSConfig = enableMDNS: {
networkConfig.MulticastDNS = lib.mkDefault enableMDNS;
};

configs = {
"99-ethernet-default-dhcp" = config.networking.useDHCP;
"99-wireless-client-dhcp" = config.networking.useDHCP;
} // (lib.mapAttrs' (_: mapInterfaceEnabled) config.networking.interfaces);
dhcpInterfaces = lib.filterAttrs (i: i.useDHCP == true) config.networking.interfaces;
in
{
# Avahi is an alternative implementation. If it's enabled, than we don't need the code below.
config = lib.mkIf (!config.services.avahi.enable) {
networking.firewall.allowedUDPPorts = [ 5353 ]; # Multicast DNS

# Allows to find machines on the local network by name, i.e. useful for printer discovery
systemd.network.networks = builtins.mapAttrs (_: mapMDNSConfig) configs;
systemd.network.networks =
lib.optionalAttrs (config.networking.useDHCP) {
"99-ethernet-default-dhcp".networkConfig.MulticastDNS = lib.mkDefault true;
"99-wireless-client-dhcp".networkConfig.MulticastDNS = lib.mkDefault true;
}
// builtins.mapAttrs (_: { networkConfig.MulticastDNS = lib.mkDefault true; }) dhcpInterfaces;
};
}
5 changes: 0 additions & 5 deletions shared/common/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ in

};
config = lib.mkIf (cfg.flake != null) {

nixpkgs.flake = {
source = lib.mkDefault (cfg.flake.inputs.nixpkgs or null);
};

nix.registry = lib.optionalAttrs cfg.registerSelf {
self.to = lib.mkDefault {
type = "path";
Expand Down

0 comments on commit e3b4048

Please sign in to comment.