From b504dfde3affe31b2a6a8f095bfcfa8d3f4c62c0 Mon Sep 17 00:00:00 2001 From: Olivia Crain Date: Sat, 17 Feb 2024 10:57:30 -0600 Subject: [PATCH] chore: switch formatter to RFC166 style --- flake.nix | 106 +++++++++++--------- home-manager/home.nix | 7 +- nixos/apteryx/configuration.nix | 42 +++++--- nixos/apteryx/hardware-configuration.nix | 43 ++++---- nixos/cardinalis/configuration.nix | 25 +++-- nixos/cardinalis/hardware-configuration.nix | 27 +++-- overlays/default.nix | 5 +- pkgs/caddy-with-plugins.nix | 65 ++++++++---- pkgs/default.nix | 11 +- pkgs/witchhazel-helix.nix | 9 +- 10 files changed, 205 insertions(+), 135 deletions(-) diff --git a/flake.nix b/flake.nix index cdea419..813f982 100644 --- a/flake.nix +++ b/flake.nix @@ -12,60 +12,70 @@ vscode-server.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { - self, - nixpkgs, - home-manager, - vscode-server, - ... - } @ inputs: let - inherit (self) outputs; + outputs = + { + self, + nixpkgs, + nixpkgs-unstable, + home-manager, + vscode-server, + ... + }@inputs: + let + inherit (self) outputs; - systems = [ - "aarch64-linux" - "x86_64-linux" - ]; + systems = [ + "aarch64-linux" + "x86_64-linux" + ]; - forAllSystems = nixpkgs.lib.genAttrs systems; - in { - packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); - formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + formatter = forAllSystems (system: nixpkgs-unstable.legacyPackages.${system}.nixfmt-rfc-style); - overlays = import ./overlays {inherit inputs;}; + overlays = import ./overlays { inherit inputs; }; - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - "olivia@corvus" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home-manager/home.nix - ]; + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + "olivia@corvus" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.aarch64-linux; + extraSpecialArgs = { + inherit inputs outputs; + }; + modules = [ ./home-manager/home.nix ]; + }; }; - }; - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - apteryx = nixpkgs.lib.nixosSystem{ - specialArgs = {inherit inputs outputs;}; - modules = [ - ./nixos/apteryx/configuration.nix - vscode-server.nixosModules.default - ]; - }; - cardinalis = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./nixos/cardinalis/configuration.nix - vscode-server.nixosModules.default - home-manager.nixosModules.home-manager - { - home-manager.useUserPackages = true; - home-manager.users.olivia = import ./home-manager/home.nix; - home-manager.extraSpecialArgs = {inherit inputs outputs;}; - } - ]; + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + apteryx = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + }; + modules = [ + ./nixos/apteryx/configuration.nix + vscode-server.nixosModules.default + ]; + }; + cardinalis = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + }; + modules = [ + ./nixos/cardinalis/configuration.nix + vscode-server.nixosModules.default + home-manager.nixosModules.home-manager + { + home-manager.useUserPackages = true; + home-manager.users.olivia = import ./home-manager/home.nix; + home-manager.extraSpecialArgs = { + inherit inputs outputs; + }; + } + ]; + }; }; }; - }; } diff --git a/home-manager/home.nix b/home-manager/home.nix index 269d582..2983df7 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -5,7 +5,8 @@ config, pkgs, ... -}: { +}: +{ nixpkgs = { overlays = [ outputs.overlays.additions @@ -19,9 +20,7 @@ }; }; - imports = [ - ./git.nix - ]; + imports = [ ./git.nix ]; home = { username = "olivia"; diff --git a/nixos/apteryx/configuration.nix b/nixos/apteryx/configuration.nix index 949d7a5..f2be507 100644 --- a/nixos/apteryx/configuration.nix +++ b/nixos/apteryx/configuration.nix @@ -6,10 +6,9 @@ pkgs, user, ... -}: { - imports = [ - ./hardware-configuration.nix - ]; +}: +{ + imports = [ ./hardware-configuration.nix ]; environment.systemPackages = with pkgs; [ vim @@ -29,7 +28,10 @@ config.allowUnfree = true; }; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -58,12 +60,12 @@ services.xserver.enable = true; services.xserver.displayManager.sddm.enable = true; services.xserver.desktopManager.plasma5.enable = true; - services.xserver = { + services.xserver = { layout = "us"; xkbVariant = ""; }; services.printing.enable = true; - sound.enable = true; + sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -81,7 +83,10 @@ users.users.olivia = { isNormalUser = true; - extraGroups = ["wheel" "networkmanager"]; + extraGroups = [ + "wheel" + "networkmanager" + ]; home = "/home/olivia"; packages = with pkgs; [ firefox @@ -93,7 +98,6 @@ ]; }; - users.users.slug = { isNormalUser = true; home = "/home/slug"; @@ -110,19 +114,25 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEbSgwkKC4XJWX1OgB9uyeeMookTrOuhe3cJuExtgUjx eddsa-key-20240214" ]; }; - - users.users.jellyfin.extraGroups = ["render" "video"]; + + users.users.jellyfin.extraGroups = [ + "render" + "video" + ]; services.openssh = { enable = true; settings = { PermitRootLogin = "no"; PasswordAuthentication = false; - AllowUsers = [ "olivia" "margie" ]; + AllowUsers = [ + "olivia" + "margie" + ]; }; openFirewall = true; }; - + services.vscode-server.enable = true; services.tailscale = { enable = true; @@ -131,9 +141,9 @@ }; networking.firewall = { enable = true; - trustedInterfaces = ["tailscale0"]; - allowedUDPPorts = [config.services.tailscale.port]; - allowedTCPPorts = [22]; + trustedInterfaces = [ "tailscale0" ]; + allowedUDPPorts = [ config.services.tailscale.port ]; + allowedTCPPorts = [ 22 ]; }; services.jellyfin = { diff --git a/nixos/apteryx/hardware-configuration.nix b/nixos/apteryx/hardware-configuration.nix index b4976ed..2d8d962 100644 --- a/nixos/apteryx/hardware-configuration.nix +++ b/nixos/apteryx/hardware-configuration.nix @@ -1,32 +1,41 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/ae63cf29-6ccd-4e00-98db-c72acea0bd06"; - fsType = "btrfs"; - options = [ "subvol=@" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/ae63cf29-6ccd-4e00-98db-c72acea0bd06"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/B450-BBD7"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/B450-BBD7"; + fsType = "vfat"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/80935296-ece7-47b8-bbf3-36cfe90c93f2"; } - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/80935296-ece7-47b8-bbf3-36cfe90c93f2"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nixos/cardinalis/configuration.nix b/nixos/cardinalis/configuration.nix index 5877708..912bb7c 100644 --- a/nixos/cardinalis/configuration.nix +++ b/nixos/cardinalis/configuration.nix @@ -6,10 +6,9 @@ pkgs, user, ... -}: { - imports = [ - ./hardware-configuration.nix - ]; +}: +{ + imports = [ ./hardware-configuration.nix ]; nixpkgs = { overlays = [ @@ -20,7 +19,10 @@ config.allowUnfree = true; }; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; environment.systemPackages = with pkgs; [ kitty @@ -44,7 +46,10 @@ users.users.olivia = { isNormalUser = true; - extraGroups = ["wheel" "networkmanager"]; + extraGroups = [ + "wheel" + "networkmanager" + ]; home = "/home/olivia"; openssh.authorizedKeys.keys = [ "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIAcHy4OLWLYz3mrLJRPtJjSbuB0ovD2rKDrKzxjQmgSwAAAABHNzaDo= olivia@olivia.dev" @@ -67,9 +72,9 @@ }; networking.firewall = { enable = true; - trustedInterfaces = ["tailscale0"]; - allowedUDPPorts = [config.services.tailscale.port]; - allowedTCPPorts = [22]; + trustedInterfaces = [ "tailscale0" ]; + allowedUDPPorts = [ config.services.tailscale.port ]; + allowedTCPPorts = [ 22 ]; }; security.rtkit.enable = true; @@ -79,7 +84,7 @@ alsa.enable = true; pulse.enable = true; }; - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { modesetting.enable = true; powerManagement.enable = false; diff --git a/nixos/cardinalis/hardware-configuration.nix b/nixos/cardinalis/hardware-configuration.nix index 51128c3..662c771 100644 --- a/nixos/cardinalis/hardware-configuration.nix +++ b/nixos/cardinalis/hardware-configuration.nix @@ -7,15 +7,22 @@ pkgs, modulesPath, ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; +}: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "ahci" "usbhid" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = ["dm-snapshot"]; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/2ae9fd56-719e-41c9-9866-3743b649eba1"; @@ -27,9 +34,7 @@ fsType = "vfat"; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/431a528d-2d55-4edf-8c2d-ca7ef200ac96";} - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/431a528d-2d55-4edf-8c2d-ca7ef200ac96"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/overlays/default.nix b/overlays/default.nix index a13ea3c..9a03471 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,7 +1,8 @@ # This file defines overlays -{inputs, ...}: { +{ inputs, ... }: +{ # This one brings our custom packages from the 'pkgs' directory - additions = final: _prev: import ../pkgs {pkgs = final;}; + additions = final: _prev: import ../pkgs { pkgs = final; }; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. diff --git a/pkgs/caddy-with-plugins.nix b/pkgs/caddy-with-plugins.nix index 946ad1d..7a8144b 100644 --- a/pkgs/caddy-with-plugins.nix +++ b/pkgs/caddy-with-plugins.nix @@ -1,22 +1,43 @@ # https://github.com/NixOS/nixpkgs/blob/a33b02fa9d664f31dadc8a874eb1a5dbaa9f4ecf/pkgs/servers/caddy/default.nix -{ lib -, buildGoModule -, fetchFromGitHub -, gnused -, nixosTests -, caddy -, testers -, installShellFiles -, externalPlugins ? [] -, vendorHash ? "sha256-ebnSehuhbCY58ctM8IRVMfNxxbJBp6ht9cbuLdGFNek=" +{ + lib, + buildGoModule, + fetchFromGitHub, + gnused, + nixosTests, + caddy, + testers, + installShellFiles, + externalPlugins ? [ ], + vendorHash ? "sha256-ebnSehuhbCY58ctM8IRVMfNxxbJBp6ht9cbuLdGFNek=", }: - let - attrsToModules = attrs: - builtins.map ({name, repo, version}: "${repo}") attrs; - attrsToSources = attrs: - builtins.map ({name, repo, version}: "${repo}@${version}") attrs; -in buildGoModule rec { + attrsToModules = + attrs: + builtins.map + ( + { + name, + repo, + version, + }: + "${repo}" + ) + attrs; + attrsToSources = + attrs: + builtins.map + ( + { + name, + repo, + version, + }: + "${repo}@${version}" + ) + attrs; +in +buildGoModule rec { pname = "caddy"; version = "2.7.6"; @@ -39,11 +60,15 @@ in buildGoModule rec { subPackages = [ "cmd/caddy" ]; ldflags = [ - "-s" "-w" + "-s" + "-w" "-X github.com/caddyserver/caddy/v2.CustomVersion=${version}" ]; - nativeBuildInputs = [ gnused installShellFiles ]; + nativeBuildInputs = [ + gnused + installShellFiles + ]; modBuildPhase = '' for module in ${builtins.toString (attrsToModules externalPlugins)}; do @@ -100,6 +125,6 @@ in buildGoModule rec { description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"; license = licenses.asl20; mainProgram = "caddy"; - maintainers = []; + maintainers = [ ]; }; -} \ No newline at end of file +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 6127c7a..55fffb4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,12 +1,17 @@ # Custom packages, that can be defined similarly to ones from nixpkgs # You can build them using 'nix build .#example' -{pkgs, ...}: { +{ pkgs, ... }: +{ caddy-with-porkbun = pkgs.callPackage ./caddy-with-plugins.nix { vendorHash = "sha256-tR9DQYmI7dGvj0W0Dsze0/BaLjG84hecm0TPiCVSY2Y="; externalPlugins = [ - { name = "porkbun"; repo = "github.com/caddy-dns/porkbun"; version = "v0.1.4"; } + { + name = "porkbun"; + repo = "github.com/caddy-dns/porkbun"; + version = "v0.1.4"; + } ]; }; - witchhazel-helix = pkgs.callPackage ./witchhazel-helix.nix {}; + witchhazel-helix = pkgs.callPackage ./witchhazel-helix.nix { }; } diff --git a/pkgs/witchhazel-helix.nix b/pkgs/witchhazel-helix.nix index 8fc42a9..1baddc4 100644 --- a/pkgs/witchhazel-helix.nix +++ b/pkgs/witchhazel-helix.nix @@ -1,6 +1,7 @@ -{ lib -, fetchFromGitHub -, stdenvNoCC +{ + lib, + fetchFromGitHub, + stdenvNoCC, }: stdenvNoCC.mkDerivation rec { pname = "witchhazel-helix"; @@ -24,4 +25,4 @@ stdenvNoCC.mkDerivation rec { homepage = "https://witchhazel.thea.codes/"; license = licenses.asl20; }; -} \ No newline at end of file +} -- knotmirror 0.0.1