From 37c82f9dcfb40f867bb3b5badb8fb46287aed242 Mon Sep 17 00:00:00 2001 From: yunfachi Date: Sun, 24 Dec 2023 16:11:51 +0000 Subject: [PATCH] style: remove unnecessary parentheses around primitive expressions and add inherits --- home/hyprland/default.nix | 14 ++++++++------ hosts/default.nix | 6 +++--- hosts/dekomori/hardware.nix | 12 ++++++++---- hosts/mitama/hardware.nix | 13 ++++++++----- nixos/wireguard.nix | 4 +--- options/services.nix | 2 +- 6 files changed, 29 insertions(+), 22 deletions(-) diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index 11f20b0..964785b 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -25,12 +25,14 @@ in { settings = lib.mkMerge [ { - monitor = map ( - m: let - resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}"; - position = "${toString m.x}x${toString m.y}"; - in "${m.name},${resolution},${position},${toString m.scale}" - ) (config.yunfachi.monitors); + monitor = + map ( + m: let + resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}"; + position = "${toString m.x}x${toString m.y}"; + in "${m.name},${resolution},${position},${toString m.scale}" + ) + config.yunfachi.monitors; input = { kb_layout = "${ diff --git a/hosts/default.nix b/hosts/default.nix index dd04878..1629f5a 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -12,7 +12,7 @@ hosts = builtins.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir ./.)); mkHost = host: let - config = specialArgs.self.nixosConfigurations."${host}".config; + inherit (specialArgs.self.nixosConfigurations."${host}") config; nixosModules = [ ./${host}/hardware.nix @@ -25,12 +25,12 @@ ../options ../home ] - ++ builtins.map (host: (import ./${host}/shared.nix {host = host;})) hosts; + ++ builtins.map (host: (import ./${host}/shared.nix {inherit host;})) hosts; extraSpecialArgs = { inherit host isNixOS; - type = config.yunfachi.type; + inherit (config.yunfachi) type; } // specialArgs; in diff --git a/hosts/dekomori/hardware.nix b/hosts/dekomori/hardware.nix index 1b50646..e7e9c52 100644 --- a/hosts/dekomori/hardware.nix +++ b/hosts/dekomori/hardware.nix @@ -7,10 +7,14 @@ }: { imports = []; - boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; + kernelModules = []; + }; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; + }; fileSystems."/" = { device = "/dev/disk/by-label/nixos"; diff --git a/hosts/mitama/hardware.nix b/hosts/mitama/hardware.nix index 73a6083..f303f65 100644 --- a/hosts/mitama/hardware.nix +++ b/hosts/mitama/hardware.nix @@ -9,10 +9,14 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot = { + initrd = { + availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; + kernelModules = []; + }; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; + }; fileSystems."/" = { device = "/dev/disk/by-uuid/66b29ea1-e3d5-4e5f-b0e9-298b3ea7c10f"; @@ -29,7 +33,6 @@ ]; networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "${system}"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/nixos/wireguard.nix b/nixos/wireguard.nix index 226a772..a3c2bc9 100644 --- a/nixos/wireguard.nix +++ b/nixos/wireguard.nix @@ -20,9 +20,7 @@ in { }; wg-quick.interfaces = { wg0 = - { - privateKey = cfg.privateKey; - } + {inherit (cfg) privateKey;} // ( if cfg.type == "server" then { diff --git a/options/services.nix b/options/services.nix index 8a9e494..16172ae 100644 --- a/options/services.nix +++ b/options/services.nix @@ -29,7 +29,7 @@ in { description = "The private key of the current host."; }; routedIPs = mkOption { - type = types.listOf (types.str); + type = types.listOf types.str; default = ["0.0.0.0/0" "::/0"]; example = []; description = "A list of IP addresses or CIDR blocks that will be routed through the VPN. Only needed for the client.";