From ee519f94c95aee266c548ee237fabc316280ee95 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 6 May 2024 14:32:00 -0500 Subject: [PATCH] nixfmt-rfc-style now --- hosts/algiz/default.nix | 15 ++-- hosts/algiz/hardware-configuration.nix | 28 +++--- hosts/algiz/system.nix | 22 +++-- hosts/mannaz/default.nix | 11 +-- hosts/mannaz/hardware-configuration.nix | 29 ++++--- hosts/mannaz/system.nix | 33 +++----- hosts/othalan/default.nix | 10 +-- hosts/othalan/hardware-configuration.nix | 25 +++--- hosts/othalan/services.nix | 8 +- hosts/othalan/system.nix | 31 ++++--- lib/default.nix | 89 ++++++++++++-------- lib/extended.nix | 53 ++++++++---- lib/find-modules.nix | 60 ++++++++----- modules/desktop/fonts.nix | 8 +- modules/desktop/gui.nix | 8 +- modules/desktop/lock/default.nix | 16 ++-- modules/desktop/window-managers/hyprland.nix | 12 ++- modules/desktop/window-managers/qtile.nix | 6 +- modules/development/dev.nix | 9 +- modules/development/git.nix | 3 +- modules/editors/nvim.nix | 3 +- modules/editors/vscode.nix | 6 +- modules/languages/default.nix | 24 ++++-- modules/languages/misc.nix | 6 +- modules/languages/nim.nix | 6 +- modules/languages/node.nix | 6 +- modules/languages/python.nix | 18 ++-- modules/languages/tex.nix | 10 +-- modules/languages/zig.nix | 11 ++- modules/networking/vpn.nix | 5 +- modules/nix-ld.nix | 6 +- modules/nix.nix | 9 +- modules/oizys.nix | 10 +-- modules/programs/chrome/default.nix | 12 +-- modules/runes/algiz.nix | 3 +- modules/runes/mannaz.nix | 3 +- modules/security/gpg.nix | 3 +- modules/storage/restic.nix | 2 +- modules/users/default.nix | 6 +- modules/virtualization/docker.nix | 4 +- modules/virtualization/virtualbox.nix | 8 +- overlays/default.nix | 36 ++++---- overlays/nim-atlas/default.nix | 3 +- overlays/nimble/default.nix | 5 +- overlays/nimlsp/default.nix | 3 +- pkgs/oizys/oizys-go/default.nix | 2 +- pkgs/oizys/oizys-nim/default.nix | 2 +- pkgs/oizys/oizys-rs/default.nix | 4 +- pkgs/oizys/oizys-zig/default.nix | 10 +-- 49 files changed, 393 insertions(+), 309 deletions(-) diff --git a/hosts/algiz/default.nix b/hosts/algiz/default.nix index ca589ba..3335d3a 100644 --- a/hosts/algiz/default.nix +++ b/hosts/algiz/default.nix @@ -3,10 +3,9 @@ pkgs, enabled, ... -}: { - imports = with self.nixosModules; [ - restic - ]; +}: +{ + imports = with self.nixosModules; [ restic ]; oizys = { languages = [ @@ -31,14 +30,18 @@ rcloneConfigFile = "/home/daylin/.config/rclone/rclone.conf"; repository = "rclone:g:archives/algiz"; passwordFile = "/home/daylin/.config/restic/algiz-pass"; - paths = ["/home/daylin/services/git/" "/home/daylin/services/gotosocial/" "home/daylin/services/caddy"]; + paths = [ + "/home/daylin/services/git/" + "/home/daylin/services/gotosocial/" + "home/daylin/services/caddy" + ]; }; security.sudo.wheelNeedsPassword = false; users.users = { daylin = { - extraGroups = ["docker"]; + extraGroups = [ "docker" ]; }; git = { diff --git a/hosts/algiz/hardware-configuration.nix b/hosts/algiz/hardware-configuration.nix index 1aaae03..2e3aca2 100644 --- a/hosts/algiz/hardware-configuration.nix +++ b/hosts/algiz/hardware-configuration.nix @@ -1,28 +1,28 @@ # 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. +{ lib, modulesPath, ... }: { - lib, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/70d6dad3-1778-43bf-8f87-76dd7f54c545"; fsType = "ext4"; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/a4e4cad9-1844-45dd-9bea-eb77bd71c37b";} - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/a4e4cad9-1844-45dd-9bea-eb77bd71c37b"; } ]; # 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/hosts/algiz/system.nix b/hosts/algiz/system.nix index db84bb4..bea7601 100644 --- a/hosts/algiz/system.nix +++ b/hosts/algiz/system.nix @@ -1,8 +1,5 @@ +{ lib, enabled, ... }: { - lib, - enabled, - ... -}: { users.motd = lib.mkRune { number = "6"; rune = "algiz"; @@ -23,15 +20,16 @@ # networking.nameservers = [ "8.8.8.8"]; # allow tcp connections for revsere proxy - networking.firewall = - enabled - // { - allowedTCPPorts = [80 443]; - }; + networking.firewall = enabled // { + allowedTCPPorts = [ + 80 + 443 + ]; + }; - services.openssh = - enabled - // {settings.PasswordAuthentication = false;}; + services.openssh = enabled // { + settings.PasswordAuthentication = false; + }; # users.mutableUsers = false; diff --git a/hosts/mannaz/default.nix b/hosts/mannaz/default.nix index 78bdc51..8b48ed1 100644 --- a/hosts/mannaz/default.nix +++ b/hosts/mannaz/default.nix @@ -1,11 +1,6 @@ +{ self, enabled, ... }: { - self, - enabled, - ... -}: { - imports = with self.nixosModules; [ - nix-ld - ]; + imports = with self.nixosModules; [ nix-ld ]; oizys = { desktop = enabled; @@ -19,5 +14,5 @@ windowManager.qtile.enable = true; }; - users.users.daylin.extraGroups = ["docker"]; + users.users.daylin.extraGroups = [ "docker" ]; } diff --git a/hosts/mannaz/hardware-configuration.nix b/hosts/mannaz/hardware-configuration.nix index b2c2519..0a4aef2 100644 --- a/hosts/mannaz/hardware-configuration.nix +++ b/hosts/mannaz/hardware-configuration.nix @@ -6,15 +6,24 @@ lib, 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.kernelModules = []; - boot.kernelModules = ["kvm-amd" "wl"]; - boot.extraModulePackages = [config.boot.kernelPackages.broadcom_sta]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ + "kvm-amd" + "wl" + ]; + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; fileSystems."/" = { device = "/dev/disk/by-uuid/47108030-bad4-431a-8fe3-0063accca466"; @@ -26,9 +35,7 @@ fsType = "vfat"; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/115bc13a-9b09-4790-986c-ab3b434cde69";} - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/115bc13a-9b09-4790-986c-ab3b434cde69"; } ]; # 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/hosts/mannaz/system.nix b/hosts/mannaz/system.nix index 5020df3..3c219fa 100644 --- a/hosts/mannaz/system.nix +++ b/hosts/mannaz/system.nix @@ -4,7 +4,8 @@ enabled, mkRune, ... -}: { +}: +{ users.motd = mkRune { number = "2"; rune = "mannaz"; @@ -27,31 +28,25 @@ } ]; - hardware.opengl = - enabled - // { - driSupport = true; - driSupport32Bit = true; - extraPackages = with pkgs; [ - libGL - ]; - setLdLibraryPath = true; - }; + hardware.opengl = enabled // { + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ libGL ]; + setLdLibraryPath = true; + }; # Load nvidia driver for Xorg and Wayland - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { # Modesetting is required. modesetting = enabled; # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement = - enabled - // { - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - finegrained = false; - }; + powerManagement = enabled // { + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + finegrained = false; + }; # Use the NVidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver). diff --git a/hosts/othalan/default.nix b/hosts/othalan/default.nix index d40712f..64ced9f 100644 --- a/hosts/othalan/default.nix +++ b/hosts/othalan/default.nix @@ -1,8 +1,5 @@ +{ pkgs, enabled, ... }: { - pkgs, - enabled, - ... -}: { oizys = { desktop = enabled; hyprland = enabled; @@ -31,7 +28,10 @@ user = "daylin"; repository = "rclone:g:archives/othalan"; passwordFile = "/home/daylin/.config/restic/othalan-pass"; - paths = ["/home/daylin/stuff/" "/home/daylin/dev/"]; + paths = [ + "/home/daylin/stuff/" + "/home/daylin/dev/" + ]; }; users.users.daylin.extraGroups = [ diff --git a/hosts/othalan/hardware-configuration.nix b/hosts/othalan/hardware-configuration.nix index c5fc2e0..322e096 100644 --- a/hosts/othalan/hardware-configuration.nix +++ b/hosts/othalan/hardware-configuration.nix @@ -6,15 +6,20 @@ lib, modulesPath, ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; +}: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/00587bf0-9f7f-4d96-9b8b-cf5024157e2c"; @@ -26,9 +31,7 @@ fsType = "vfat"; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/bd64a1ba-f259-4b64-88cd-5585b9345f5a";} - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/bd64a1ba-f259-4b64-88cd-5585b9345f5a"; } ]; # 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/hosts/othalan/services.nix b/hosts/othalan/services.nix index 6b5e031..a6392fc 100644 --- a/hosts/othalan/services.nix +++ b/hosts/othalan/services.nix @@ -1,6 +1,8 @@ -{pkgs, ...}: let +{ pkgs, ... }: +let notes-git = ''${pkgs.git}/bin/git -C /home/daylin/stuff/notes''; -in { +in +{ systemd.services.notes-bot = { description = "auto commit changes to notes"; serviceConfig = { @@ -13,7 +15,7 @@ in { }; systemd.timers.notes-bot-timer = { description = "run notes commit service"; - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "daily"; Persistent = true; diff --git a/hosts/othalan/system.nix b/hosts/othalan/system.nix index e63f7c9..81232bc 100644 --- a/hosts/othalan/system.nix +++ b/hosts/othalan/system.nix @@ -3,11 +3,14 @@ enabled, mkRune, ... -}: { +}: +{ networking.networkmanager = enabled; services.printing = enabled; services.fwupd = enabled; - hardware.bluetooth = enabled // {powerOnBoot = true;}; + hardware.bluetooth = enabled // { + powerOnBoot = true; + }; # https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/lenovo/thinkpad/x1/9th-gen/default.nix # https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/common/pc/ssd/default.nix @@ -15,17 +18,15 @@ # rtkit is optional but recommended security.rtkit = enabled; - services.pipewire = - enabled - // { - audio = enabled; - pulse = enabled; - alsa = enabled // {support32Bit = true;}; + services.pipewire = enabled // { + audio = enabled; + pulse = enabled; + alsa = enabled // { + support32Bit = true; }; + }; - environment.systemPackages = with pkgs; [ - pamixer - ]; + environment.systemPackages = with pkgs; [ pamixer ]; services.getty = { greetingLine = mkRune { @@ -48,11 +49,9 @@ boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest; boot.loader = { - systemd-boot = - enabled - // { - consoleMode = "max"; - }; + systemd-boot = enabled // { + consoleMode = "max"; + }; efi.canTouchEfiVariables = true; }; diff --git a/lib/default.nix b/lib/default.nix index 2dc57be..3cdf74a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,57 +1,78 @@ -inputs: let +inputs: +let inherit (inputs) nixpkgs self; lib = nixpkgs.lib.extend (import ./extended.nix); - inherit (builtins) mapAttrs readDir filter listToAttrs; - inherit (lib) nixosSystem genAttrs isNixFile mkDefaultOizysModule mkOizysModule enabled mkRune; + inherit (builtins) + mapAttrs + readDir + filter + listToAttrs + ; + inherit (lib) + nixosSystem + genAttrs + isNixFile + mkDefaultOizysModule + mkOizysModule + enabled + mkRune + ; inherit (lib.filesystem) listFilesRecursive; - inherit (import ./find-modules.nix {inherit lib;}) findModulesList; + inherit (import ./find-modules.nix { inherit lib; }) findModulesList; #supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; - supportedSystems = ["x86_64-linux"]; -in rec { - forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs {inherit system;})); + supportedSystems = [ "x86_64-linux" ]; +in +rec { + forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs { inherit system; })); nixosModules = listToAttrs (findModulesList ../modules); - mkSystem = hostname: + mkSystem = + hostname: nixosSystem { system = "x86_64-linux"; - modules = - [ - ../modules/oizys.nix - ../overlays - ] - ++ filter - isNixFile - (listFilesRecursive (../. + "/hosts/${hostname}")); + modules = [ + ../modules/oizys.nix + ../overlays + ] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostname}")); - specialArgs = {inherit inputs lib self mkDefaultOizysModule mkOizysModule enabled mkRune;}; + specialArgs = { + inherit + inputs + lib + self + mkDefaultOizysModule + mkOizysModule + enabled + mkRune + ; + }; }; oizysHosts = mapAttrs (name: _: mkSystem name) (readDir ../hosts); - oizysPkg = forAllSystems ( - pkgs: rec { - oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig {zig2nix = inputs.zig2nix;}; - oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim {}; - oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs {}; - oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go {}; - default = oizys-go; - } - ); - devShells = forAllSystems ( - pkgs: { - default = pkgs.mkShell { - packages = with pkgs; [git deadnix]; - }; - } - ); + oizysPkg = forAllSystems (pkgs: rec { + oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { zig2nix = inputs.zig2nix; }; + oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { }; + oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { }; + oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { }; + default = oizys-go; + }); + devShells = forAllSystems (pkgs: { + default = pkgs.mkShell { + packages = with pkgs; [ + git + deadnix + ]; + }; + }); oizysFlake = { nixosModules = nixosModules; nixosConfigurations = oizysHosts; packages = oizysPkg; devShells = devShells; - formatter = forAllSystems (pkgs: pkgs.alejandra); + formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); }; } diff --git a/lib/extended.nix b/lib/extended.nix index 1a61136..e53e045 100644 --- a/lib/extended.nix +++ b/lib/extended.nix @@ -1,32 +1,49 @@ -final: prev: let - inherit (final) hasSuffix mkEnableOption mkIf mkOption types; +final: prev: +let + inherit (final) + hasSuffix + mkEnableOption + mkIf + mkOption + types + ; runes = import ../modules/runes; -in rec { - enabled = {enable = true;}; - disabled = {enable = false;}; +in +rec { + enabled = { + enable = true; + }; + disabled = { + enable = false; + }; # ["a" "b"] -> {a.enable = true; b.enable = true;} - enableAttrs = attrs: - builtins.listToAttrs (map (attr: { + enableAttrs = + attrs: + builtins.listToAttrs ( + map (attr: { name = attr; value = enabled; - }) - attrs); + }) attrs + ); # ["a" "b"] -> {a.enable = false; b.enable = false;} - disableAttrs = attrs: - builtins.listToAttrs (map (attr: { + disableAttrs = + attrs: + builtins.listToAttrs ( + map (attr: { name = attr; value = disabled; - }) - attrs); + }) attrs + ); isNixFile = path: hasSuffix ".nix" path; mkIfIn = name: list: prev.mkIf (builtins.elem name list); - mkRune = { - rune, - number ? "6", - runeKind ? "braille", - }: + mkRune = + { + rune, + number ? "6", + runeKind ? "braille", + }: "[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n"; mkOizysModule = config: attr: content: { diff --git a/lib/find-modules.nix b/lib/find-modules.nix index f6dbe89..dd5066e 100644 --- a/lib/find-modules.nix +++ b/lib/find-modules.nix @@ -1,25 +1,39 @@ -{...}: let - inherit (builtins) concatLists attrValues mapAttrs elemAt match readDir; -in rec { +{ ... }: +let + inherit (builtins) + concatLists + attrValues + mapAttrs + elemAt + match + readDir + ; +in +rec { # https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120 - findModulesList = dir: - concatLists (attrValues (mapAttrs - (name: type: - if type == "regular" - then [ - { - name = elemAt (match "(.*)\\.nix" name) 0; - value = dir + "/${name}"; - } - ] - else if - (readDir (dir + "/${name}")) - ? "default.nix" - then [ - { - inherit name; - value = dir + "/${name}"; - } - ] - else findModulesList (dir + "/${name}")) (readDir dir))); + findModulesList = + dir: + concatLists ( + attrValues ( + mapAttrs ( + name: type: + if type == "regular" then + [ + { + name = elemAt (match "(.*)\\.nix" name) 0; + value = dir + "/${name}"; + } + ] + else if (readDir (dir + "/${name}")) ? "default.nix" then + [ + { + inherit name; + value = dir + "/${name}"; + } + ] + else + findModulesList (dir + "/${name}") + ) (readDir dir) + ) + ); } diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix index 6846633..8874d57 100644 --- a/modules/desktop/fonts.nix +++ b/modules/desktop/fonts.nix @@ -3,13 +3,15 @@ config, lib, ... -}: let +}: +let inherit (lib) mkIf; -in { +in +{ config = mkIf config.oizys.desktop.enable { fonts.fontconfig.enable = true; fonts.packages = with pkgs; [ - (nerdfonts.override {fonts = ["FiraCode"];}) + (nerdfonts.override { fonts = [ "FiraCode" ]; }) recursive ]; }; diff --git a/modules/desktop/gui.nix b/modules/desktop/gui.nix index 022cb23..9c463c8 100644 --- a/modules/desktop/gui.nix +++ b/modules/desktop/gui.nix @@ -4,9 +4,11 @@ config, lib, ... -}: let +}: +let inherit (lib) mkIf; -in { +in +{ config = mkIf config.oizys.desktop.enable { environment.systemPackages = with pkgs; [ wezterm @@ -23,7 +25,7 @@ in { hunspell # spell check for libreoffice (catppuccin-gtk.override { - accents = ["rosewater"]; + accents = [ "rosewater" ]; variant = "mocha"; }) diff --git a/modules/desktop/lock/default.nix b/modules/desktop/lock/default.nix index 6f7af4c..663e469 100644 --- a/modules/desktop/lock/default.nix +++ b/modules/desktop/lock/default.nix @@ -3,15 +3,21 @@ config, lib, ... -}: let +}: +let inherit (lib) mkIf; cfg = config.services.xserver.windowManager.qtile; lock = pkgs.writeShellApplication { name = "lock"; - runtimeInputs = with pkgs; [i3lock-color figlet procps]; + runtimeInputs = with pkgs; [ + i3lock-color + figlet + procps + ]; text = builtins.readFile ./lock.sh; }; -in { +in +{ config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ xss-lock @@ -19,9 +25,9 @@ in { ]; systemd.services.i3lock = { - wantedBy = ["sleep.target"]; + wantedBy = [ "sleep.target" ]; description = "Lock the screen using a custom lock script"; - before = ["suspend.target"]; + before = [ "suspend.target" ]; serviceConfig = { User = "daylin"; Type = "forking"; diff --git a/modules/desktop/window-managers/hyprland.nix b/modules/desktop/window-managers/hyprland.nix index b760a4e..3875fbd 100644 --- a/modules/desktop/window-managers/hyprland.nix +++ b/modules/desktop/window-managers/hyprland.nix @@ -15,12 +15,10 @@ # ''; # }; mkOizysModule config "hyprland" { - programs.hyprland = - enabled - // { - package = inputs.hyprland.packages.${pkgs.system}.default; - }; - security.pam.services.swaylock = {}; + programs.hyprland = enabled // { + package = inputs.hyprland.packages.${pkgs.system}.default; + }; + security.pam.services.swaylock = { }; # Optional, hint electron apps to use wayland: environment.sessionVariables.NIXOS_OZONE_WL = "1"; @@ -56,7 +54,7 @@ mkOizysModule config "hyprland" { inputs.hyprland-contrib.overlays.default # some issue with dunst? # inputs.nixpkgs-wayland.overlay - + # when this was active I was forced to recompile VirtualBox myself, which would just fail to compile... # Must have been one of the other non-hyprland packages modified in the overlay # inputs.hyprland.overlays.default diff --git a/modules/desktop/window-managers/qtile.nix b/modules/desktop/window-managers/qtile.nix index 8ec8398..d8c6d1e 100644 --- a/modules/desktop/window-managers/qtile.nix +++ b/modules/desktop/window-managers/qtile.nix @@ -3,10 +3,12 @@ config, lib, ... -}: let +}: +let inherit (lib) mkIf; cfg = config.services.xserver.windowManager.qtile; -in { +in +{ config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ brightnessctl diff --git a/modules/development/dev.nix b/modules/development/dev.nix index 982ac8e..14339a6 100644 --- a/modules/development/dev.nix +++ b/modules/development/dev.nix @@ -1,11 +1,6 @@ +{ pkgs, self, ... }: { - pkgs, - self, - ... -}: { - imports = with self.nixosModules; [ - git - ]; + imports = with self.nixosModules; [ git ]; programs.zsh.enable = true; environment.systemPackages = with pkgs; [ tmux diff --git a/modules/development/git.nix b/modules/development/git.nix index 6258a17..9e818ca 100644 --- a/modules/development/git.nix +++ b/modules/development/git.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ git git-lfs diff --git a/modules/editors/nvim.nix b/modules/editors/nvim.nix index 5b8a201..3db2bfa 100644 --- a/modules/editors/nvim.nix +++ b/modules/editors/nvim.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ vim neovim diff --git a/modules/editors/vscode.nix b/modules/editors/vscode.nix index 37f9f4e..9359c13 100644 --- a/modules/editors/vscode.nix +++ b/modules/editors/vscode.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let inherit (lib) mkIf; -in { +in +{ config = mkIf config.oizys.desktop.enable { environment.systemPackages = with pkgs; [ # vscode diff --git a/modules/languages/default.nix b/modules/languages/default.nix index a21d7f3..d662565 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -1,13 +1,27 @@ -{lib, ...}: let - inherit (lib) mkOption types literalExpression mdDoc; -in { - imports = [./nim.nix ./tex.nix ./misc.nix ./node.nix ./python.nix ./zig.nix]; +{ lib, ... }: +let + inherit (lib) + mkOption + types + literalExpression + mdDoc + ; +in +{ + imports = [ + ./nim.nix + ./tex.nix + ./misc.nix + ./node.nix + ./python.nix + ./zig.nix + ]; options.oizys.languages = mkOption { type = with types; (listOf str); description = mdDoc '' List of programming languages to enable. ''; - default = []; + default = [ ]; example = literalExpression '' [ "python" diff --git a/modules/languages/misc.nix b/modules/languages/misc.nix index e2cf5d4..d565c4a 100644 --- a/modules/languages/misc.nix +++ b/modules/languages/misc.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIfIn; cfg = config.oizys.languages; -in { +in +{ config = mkIfIn "misc" cfg { environment.systemPackages = with pkgs; [ go diff --git a/modules/languages/nim.nix b/modules/languages/nim.nix index 2aaebd1..a1c1332 100644 --- a/modules/languages/nim.nix +++ b/modules/languages/nim.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIfIn; cfg = config.oizys.languages; -in { +in +{ config = mkIfIn "nim" cfg { environment.systemPackages = with pkgs; [ nim diff --git a/modules/languages/node.nix b/modules/languages/node.nix index ac7ea30..ae6c68c 100644 --- a/modules/languages/node.nix +++ b/modules/languages/node.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIfIn; cfg = config.oizys.languages; -in { +in +{ config = mkIfIn "node" cfg { environment.systemPackages = with pkgs; [ nodejs diff --git a/modules/languages/python.nix b/modules/languages/python.nix index 416dc98..7f0ab9b 100644 --- a/modules/languages/python.nix +++ b/modules/languages/python.nix @@ -3,15 +3,19 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIfIn; cfg = config.oizys.languages; -in { +in +{ config = mkIfIn "python" cfg { - environment.systemPackages = let - python = pkgs.python3.withPackages (ps: with ps; [pip]); - in - with pkgs; [ + environment.systemPackages = + let + python = pkgs.python3.withPackages (ps: with ps; [ pip ]); + in + with pkgs; + [ # https://github.com/Mic92/nix-ld?tab=readme-ov-file#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld (pkgs.writeShellScriptBin "python" '' export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH @@ -23,7 +27,7 @@ in { exec ${python}/bin/python "$@" '') - (python3.withPackages (ps: with ps; [pip])) + (python3.withPackages (ps: with ps; [ pip ])) micromamba pixi ]; diff --git a/modules/languages/tex.nix b/modules/languages/tex.nix index 2c6bebc..ee3bb92 100644 --- a/modules/languages/tex.nix +++ b/modules/languages/tex.nix @@ -3,13 +3,13 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIfIn; cfg = config.oizys.languages; -in { +in +{ config = mkIfIn "tex" cfg { - environment.systemPackages = with pkgs; [ - texlive.combined.scheme-full - ]; + environment.systemPackages = with pkgs; [ texlive.combined.scheme-full ]; }; } diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix index 15677ef..1ef7467 100644 --- a/modules/languages/zig.nix +++ b/modules/languages/zig.nix @@ -4,13 +4,18 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIfIn; cfg = config.oizys.languages; zig = inputs.zig2nix.outputs.packages.${pkgs.system}.zig.master.bin; zls = inputs.zls.outputs.packages.${pkgs.system}.default; -in { +in +{ config = mkIfIn "zig" cfg { - environment.systemPackages = [zig zls]; + environment.systemPackages = [ + zig + zls + ]; }; } diff --git a/modules/networking/vpn.nix b/modules/networking/vpn.nix index b2e2bb3..117e931 100644 --- a/modules/networking/vpn.nix +++ b/modules/networking/vpn.nix @@ -5,7 +5,10 @@ ... }: mkOizysModule config "vpn" { - environment.systemPackages = with pkgs; [openconnect openvpn]; + environment.systemPackages = with pkgs; [ + openconnect + openvpn + ]; services.openvpn.servers = { express-ny = { diff --git a/modules/nix-ld.nix b/modules/nix-ld.nix index e642fdb..28f2a27 100644 --- a/modules/nix-ld.nix +++ b/modules/nix-ld.nix @@ -3,10 +3,12 @@ lib, config, ... -}: let +}: +let inherit (lib) mkEnableOption mkIf; cfg = config.oizys.nix-ld; -in { +in +{ options.oizys.nix-ld.enable = mkEnableOption "enable nix-ld support"; config = mkIf cfg.enable { programs.nix-ld.enable = true; diff --git a/modules/nix.nix b/modules/nix.nix index 47e1cd1..c91718a 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -3,10 +3,9 @@ self, pkgs, ... -}: { - imports = [ - inputs.nix-index-database.nixosModules.nix-index - ]; +}: +{ + imports = [ inputs.nix-index-database.nixosModules.nix-index ]; nixpkgs.config.allowUnfree = true; nix.package = pkgs.nixVersions.latest; @@ -34,7 +33,7 @@ programs.command-not-found.enable = false; nix.settings = { - trusted-users = ["@wheel"]; + trusted-users = [ "@wheel" ]; accept-flake-config = true; # substituters = [ diff --git a/modules/oizys.nix b/modules/oizys.nix index 0b62d43..9b773cb 100644 --- a/modules/oizys.nix +++ b/modules/oizys.nix @@ -1,10 +1,8 @@ -{ - lib, - self, - ... -}: let +{ lib, self, ... }: +let inherit (lib) mkEnableOption; -in { +in +{ imports = with self.nixosModules; [ users nix diff --git a/modules/programs/chrome/default.nix b/modules/programs/chrome/default.nix index b0325fc..ac869ef 100644 --- a/modules/programs/chrome/default.nix +++ b/modules/programs/chrome/default.nix @@ -22,16 +22,8 @@ mkOizysModule config "chrome" { }; environment.systemPackages = with pkgs; [ - (chromium.override { - commandLineArgs = [ - "--force-dark-mode" - ]; - }) + (chromium.override { commandLineArgs = [ "--force-dark-mode" ]; }) - (google-chrome.override { - commandLineArgs = [ - "--force-dark-mode" - ]; - }) + (google-chrome.override { commandLineArgs = [ "--force-dark-mode" ]; }) ]; } diff --git a/modules/runes/algiz.nix b/modules/runes/algiz.nix index bb6fa85..f0601e9 100644 --- a/modules/runes/algiz.nix +++ b/modules/runes/algiz.nix @@ -1,5 +1,6 @@ { - braille = '' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + braille = '' + ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⢠⣾⣦⡀⠀⠀⠀⣶⣶⠀⠀⠀⢀⣴⣷⡄⠀⠀⠀ ⠀⠀⠀⠀⠙⢿⣷⣄⠀⠀⣿⣿⠀⠀⣠⣾⡿⠋⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠙⢿⣷⣄⣿⣿⣠⣾⡿⠋⠀⠀⠀⠀⠀⠀ diff --git a/modules/runes/mannaz.nix b/modules/runes/mannaz.nix index cee3707..b94d225 100644 --- a/modules/runes/mannaz.nix +++ b/modules/runes/mannaz.nix @@ -1,5 +1,6 @@ { - braille = '' ⠀ + braille = '' + ⠀ ⢰⣶⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣶⡆⠀⠀ ⠀⠀⢸⣿⡿⢿⣷⣦⣄⠀⠀⠀⠀⣀⣴⣾⡿⠿⣿⡇⠀⠀ ⠀⠀⢸⣿⡇⠀⠈⠛⠿⣿⣶⣴⣿⠿⠛⠁⠀⢸⣿⡇⠀⠀ diff --git a/modules/security/gpg.nix b/modules/security/gpg.nix index 836218d..e18f08f 100644 --- a/modules/security/gpg.nix +++ b/modules/security/gpg.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.gnupg.agent = { enable = true; enableSSHSupport = true; diff --git a/modules/storage/restic.nix b/modules/storage/restic.nix index 2165a7e..8d306c6 100644 --- a/modules/storage/restic.nix +++ b/modules/storage/restic.nix @@ -5,7 +5,7 @@ ... }: mkOizysModule config "backups" { - environment.systemPackages = with pkgs; [rclone]; + environment.systemPackages = with pkgs; [ rclone ]; services.restic.backups.gdrive = { # BUG: if .conda/environments.txt doesn't exist then this won't work diff --git a/modules/users/default.nix b/modules/users/default.nix index 1674e07..ae22fae 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -3,10 +3,12 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkOption mkIf types; cfg = config.users.defaultUser; -in { +in +{ options.users.defaultUser = mkOption { default = true; type = types.bool; diff --git a/modules/virtualization/docker.nix b/modules/virtualization/docker.nix index 49a6198..95c13b3 100644 --- a/modules/virtualization/docker.nix +++ b/modules/virtualization/docker.nix @@ -6,7 +6,5 @@ }: mkOizysModule config "docker" { virtualisation.docker.enable = true; - environment.systemPackages = with pkgs; [ - lazydocker - ]; + environment.systemPackages = with pkgs; [ lazydocker ]; } diff --git a/modules/virtualization/virtualbox.nix b/modules/virtualization/virtualbox.nix index bac5a29..6adf324 100644 --- a/modules/virtualization/virtualbox.nix +++ b/modules/virtualization/virtualbox.nix @@ -1,11 +1,7 @@ -{ - config, - mkOizysModule, - ... -}: +{ config, mkOizysModule, ... }: mkOizysModule config "vbox" { virtualisation.virtualbox = { host.enable = true; }; - users.extraGroups.vboxusers.members = ["daylin"]; + users.extraGroups.vboxusers.members = [ "daylin" ]; } diff --git a/overlays/default.nix b/overlays/default.nix index 3c2e90d..f3ee3a4 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,25 +1,21 @@ -{inputs, ...}: let +{ inputs, ... }: +let defaultOverlays = # execute and import all overlay files in the current # directory with the given args builtins.map - # execute and import the overlay file - (f: (import (./. + "/${f}") {inherit inputs;})) - # find all overlay files in the current directory - (builtins.filter - (f: f != "default.nix") - (builtins.attrNames (builtins.readDir ./.))); -in { - nixpkgs.overlays = - defaultOverlays - ++ [ - ( - final: _prev: { - stable = import inputs.stable { - system = final.system; - config.allowUnfree = true; - }; - } - ) - ]; + # execute and import the overlay file + (f: (import (./. + "/${f}") { inherit inputs; })) + # find all overlay files in the current directory + (builtins.filter (f: f != "default.nix") (builtins.attrNames (builtins.readDir ./.))); +in +{ + nixpkgs.overlays = defaultOverlays ++ [ + (final: _prev: { + stable = import inputs.stable { + system = final.system; + config.allowUnfree = true; + }; + }) + ]; } diff --git a/overlays/nim-atlas/default.nix b/overlays/nim-atlas/default.nix index 76a256f..262ae1d 100644 --- a/overlays/nim-atlas/default.nix +++ b/overlays/nim-atlas/default.nix @@ -1,4 +1,5 @@ -{...}: (final: prev: { +{ ... }: +(final: prev: { nim-atlas = prev.nim-atlas.overrideNimAttrs { version = "unstable"; src = final.fetchFromGitHub { diff --git a/overlays/nimble/default.nix b/overlays/nimble/default.nix index fb59cca..9695452 100644 --- a/overlays/nimble/default.nix +++ b/overlays/nimble/default.nix @@ -1,8 +1,9 @@ -{...}: (final: prev: { +{ ... }: +(final: prev: { nimble = prev.nimble.overrideNimAttrs { version = "0.14.2-5e7901760e89108476a4e21976a0ef783403e8fe"; requiredNimVersion = 2; - buildInputs = [prev.pkgs.openssl]; + buildInputs = [ prev.pkgs.openssl ]; src = final.fetchFromGitHub { owner = "nim-lang"; diff --git a/overlays/nimlsp/default.nix b/overlays/nimlsp/default.nix index 6f761fc..ec3be3f 100644 --- a/overlays/nimlsp/default.nix +++ b/overlays/nimlsp/default.nix @@ -1,4 +1,5 @@ -{...}: (final: prev: { +{ ... }: +(final: prev: { nimlsp = prev.nimlsp.overrideNimAttrs { requiredNimVersion = 2; nimFlags = [ diff --git a/pkgs/oizys/oizys-go/default.nix b/pkgs/oizys/oizys-go/default.nix index 886acf8..08b4280 100644 --- a/pkgs/oizys/oizys-go/default.nix +++ b/pkgs/oizys/oizys-go/default.nix @@ -12,7 +12,7 @@ buildGoModule { src = lib.cleanSource ./.; vendorHash = "sha256-Fcq8p/YItF5lx82PRg1/tksV7iCIS0xZZVWdpE3e7F0="; - nativeBuildInputs = [installShellFiles]; + nativeBuildInputs = [ installShellFiles ]; postInstall = '' installShellCompletion --cmd oizys \ diff --git a/pkgs/oizys/oizys-nim/default.nix b/pkgs/oizys/oizys-nim/default.nix index 2380249..b9010f5 100644 --- a/pkgs/oizys/oizys-nim/default.nix +++ b/pkgs/oizys/oizys-nim/default.nix @@ -1,4 +1,4 @@ -{buildNimPackage}: +{ buildNimPackage }: buildNimPackage { pname = "oizys"; version = "unstable"; diff --git a/pkgs/oizys/oizys-rs/default.nix b/pkgs/oizys/oizys-rs/default.nix index d9e9580..4d581b2 100644 --- a/pkgs/oizys/oizys-rs/default.nix +++ b/pkgs/oizys/oizys-rs/default.nix @@ -11,8 +11,8 @@ rustPlatform.buildRustPackage { lockFile = ./Cargo.lock; }; - nativeBuildInputs = [installShellFiles]; - buildInputs = [nix-output-monitor]; + nativeBuildInputs = [ installShellFiles ]; + buildInputs = [ nix-output-monitor ]; postInstall = '' installShellCompletion --cmd oizys \ diff --git a/pkgs/oizys/oizys-zig/default.nix b/pkgs/oizys/oizys-zig/default.nix index c6f4ca9..dc2210b 100644 --- a/pkgs/oizys/oizys-zig/default.nix +++ b/pkgs/oizys/oizys-zig/default.nix @@ -6,8 +6,8 @@ }: (zig2nix.outputs.zig-env.${pkgs.system} { zig = zig2nix.outputs.packages.${pkgs.system}.zig.master.bin; -}) -.package { - name = "oizys"; - src = lib.cleanSource ./.; -} +}).package + { + name = "oizys"; + src = lib.cleanSource ./.; + }