From 2232ad3f31f3c32bafca6deabe5eace544ca7c37 Mon Sep 17 00:00:00 2001 From: "Reid \"reidlab" Date: Sun, 8 Dec 2024 18:39:26 -0800 Subject: [PATCH] lint --- .editorconfig | 4 +++- README.md | 1 + default.nix | 10 +++++----- flake.nix | 12 ++++++------ hosts/nixos-server-reid/hardware.nix | 12 ++++++------ hosts/nixos-server-reid/webapps/default.nix | 2 +- lib/default.nix | 2 +- modules/security.nix | 8 ++++---- modules/services/mysql.nix | 2 +- modules/services/nginx-conf.nix | 2 +- modules/services/promtail.yml | 2 +- modules/users.nix | 2 +- 12 files changed, 31 insertions(+), 28 deletions(-) diff --git a/.editorconfig b/.editorconfig index 94e6600..f3245e7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,4 +3,6 @@ root = true [*] end_of_line = lf indent_style = space -indent_size = 2 \ No newline at end of file +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/README.md b/README.md index 6efd476..f0227a8 100755 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ nix flake config! this is just used on my personal server at the moment this flake is built for a multi-user experience per host, enforced by [`modules/users.nix`](./modules/users.nix), and found in the `default.nix` file for each host. ## todo + - find a better way to do cloudflare ips - per-host architecture selection, atm it is hardcoded to `aarch64` - move common config such as bootloader and networking settings to [`default.nix`](./default.nix) diff --git a/default.nix b/default.nix index b783f69..066f435 100755 --- a/default.nix +++ b/default.nix @@ -6,7 +6,7 @@ let inherit (lib.my) mapModulesRec'; in { imports = - [ + [ inputs.home-manager.nixosModules.home-manager inputs.vscode-server.nixosModules.default ] @@ -19,14 +19,14 @@ in { # might not be needed? see: https://github.com/NixOS/nixpkgs/commit/e456032addae76701eb17e6c03fc515fd78ad74f nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; registry.nixpkgs.flake = inputs.nixpkgs; - + settings = { experimental-features = [ "nix-command" "flakes" ]; auto-optimise-store = true; keep-outputs = true; keep-derivations = true; - substituters = [ - "https://nix-community.cachix.org" + substituters = [ + "https://nix-community.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" @@ -38,7 +38,7 @@ in { system.configurationRevision = with inputs; mkIf (self ? rev) self.rev; time.timeZone = mkDefault "America/Los_Angeles"; - + i18n.defaultLocale = mkDefault "en_US.UTF-8"; hardware.enableRedistributableFirmware = true; diff --git a/flake.nix b/flake.nix index fc85dec..a0b28de 100755 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ inherit (lib.my) mapModules mapModulesRec mapHosts; system = "aarch64-linux"; - mkPkgs = pkgs: extraOverlays: + mkPkgs = pkgs: extraOverlays: import pkgs { inherit system; config.allowUnfree = true; @@ -32,19 +32,19 @@ }); in { lib = lib.my; - - overlays = + + overlays = (mapModules ./overlays import) // { default = final: prev: { my = self.packages.${system}; }; }; - + packages."${system}" = mapModules ./packages (p: pkgs.callPackage p {}); - + nixosModules = mapModulesRec ./modules import; - + nixosConfigurations = mapHosts ./hosts {}; }; } diff --git a/hosts/nixos-server-reid/hardware.nix b/hosts/nixos-server-reid/hardware.nix index 4363bbc..25b9143 100755 --- a/hosts/nixos-server-reid/hardware.nix +++ b/hosts/nixos-server-reid/hardware.nix @@ -2,16 +2,16 @@ { imports = - [ + [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot = { initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; - initrd.kernelModules = [ ]; - kernelModules = [ ]; - extraModulePackages = [ ]; - # TODO: move bootloader, networking, boot speed to another file? + initrd.kernelModules = [ ]; + kernelModules = [ ]; + extraModulePackages = [ ]; + # TODO: move bootloader, networking, boot speed to another file? kernelPackages = pkgs.linuxPackages_latest; loader = { # use u-boot over grub @@ -25,7 +25,7 @@ fsType = "ext4"; }; - swapDevices = + swapDevices = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking diff --git a/hosts/nixos-server-reid/webapps/default.nix b/hosts/nixos-server-reid/webapps/default.nix index f9c9434..0db3c55 100755 --- a/hosts/nixos-server-reid/webapps/default.nix +++ b/hosts/nixos-server-reid/webapps/default.nix @@ -19,7 +19,7 @@ in { nginx-config.enable = true; staticSites = { - "reidlab.pink".dataDir = "/var/www/reidlab.pink"; + "reidlab.pink".dataDir = "/var/www/reidlab.pink"; }; matomo = { diff --git a/lib/default.nix b/lib/default.nix index dfd2478..faaa4c0 100755 --- a/lib/default.nix +++ b/lib/default.nix @@ -16,5 +16,5 @@ mylib = makeExtensible (self: mapModules ./. (file: import file {inherit self lib pkgs inputs;})); - in + in mylib.extend (self: super: foldr (a: b: a // b) {} (attrValues super)) diff --git a/modules/security.nix b/modules/security.nix index 408d171..8cd180b 100755 --- a/modules/security.nix +++ b/modules/security.nix @@ -9,10 +9,10 @@ in { }; config = mkIf cfg.enable { - boot = { - tmp.useTmpfs = lib.mkDefault true; - tmp.cleanOnBoot = lib.mkDefault (!config.boot.tmp.useTmpfs); - + boot = { + tmp.useTmpfs = lib.mkDefault true; + tmp.cleanOnBoot = lib.mkDefault (!config.boot.tmp.useTmpfs); + kernel.sysctl = { # magic sysrq key, allows low-level commands through keyboard input "kernel.sysrq" = 0; diff --git a/modules/services/mysql.nix b/modules/services/mysql.nix index 5f33b2a..aa0f5fd 100644 --- a/modules/services/mysql.nix +++ b/modules/services/mysql.nix @@ -26,4 +26,4 @@ in { }; }; }; -} \ No newline at end of file +} diff --git a/modules/services/nginx-conf.nix b/modules/services/nginx-conf.nix index 152297a..4653da2 100755 --- a/modules/services/nginx-conf.nix +++ b/modules/services/nginx-conf.nix @@ -18,7 +18,7 @@ in { services.nginx = { enable = true; - + recommendedTlsSettings = true; recommendedOptimisation = true; recommendedGzipSettings = true; diff --git a/modules/services/promtail.yml b/modules/services/promtail.yml index 1085e65..00eb943 100644 --- a/modules/services/promtail.yml +++ b/modules/services/promtail.yml @@ -17,4 +17,4 @@ scrape_configs: host: nixos-server-reid relabel_configs: - source_labels: ["__journal__systemd_unit"] - target_label: "unit" \ No newline at end of file + target_label: "unit" diff --git a/modules/users.nix b/modules/users.nix index 119ec40..f3116f0 100755 --- a/modules/users.nix +++ b/modules/users.nix @@ -67,7 +67,7 @@ in { }; users.groups = mapAttrs (_: _: {}) config.normalUsers; - + users.users = mapAttrs (username: user: (mkMerge [ (mkAliasDefinitions options.user) user.conf