diff --git a/default.nix b/default.nix index 0f8f44e..7306079 100644 --- a/default.nix +++ b/default.nix @@ -3,34 +3,34 @@ let # https://github.com/andir/npins?tab=readme-ov-file#using-the-nixpkgs-fetchers src = import ./npins; - pkgs = import src.nixpkgs { }; - sources = mapAttrs (k: v: v { inherit pkgs; }) src; + pkgs = import src.nixpkgs {}; + sources = mapAttrs (k: v: v {inherit pkgs;}) src; inherit (pkgs) lib; inherit (lib.filesystem) listFilesRecursive; inherit (lib.strings) hasSuffix; - mkSystem = - system: hostname: + mkSystem = system: hostname: import (src.nixpkgs + "/nixos/lib/eval-config.nix") { specialArgs = { inherit sources; self = ./.; }; - modules = [ - # This is used to pre-emptively set the hostPlatform for nixpkgs. - # Also, we set the system hostname here. - { - networking.hostName = hostname; - nixpkgs.hostPlatform = system; - } - ./hosts/common.nix - ./hosts/${hostname} - ] - ++ ((listFilesRecursive ./modules) |> filter (hasSuffix ".mod.nix")); + modules = + [ + # This is used to pre-emptively set the hostPlatform for nixpkgs. + # Also, we set the system hostname here. + { + networking.hostName = hostname; + nixpkgs.hostPlatform = system; + } + ./hosts/common.nix + ./hosts/${hostname} + ] + ++ ((listFilesRecursive ./modules) + |> filter (hasSuffix ".mod.nix")); }; -in -{ +in { temperance = mkSystem "x86_64-linux" "temperance"; hermit = mkSystem "x86_64-linux" "hermit"; tower = mkSystem "aarch64-linux" "tower"; diff --git a/flake.nix b/flake.nix index 58f693a..5824ff6 100644 --- a/flake.nix +++ b/flake.nix @@ -3,38 +3,65 @@ # No inputs, take this flakers - outputs = - _: - let - sources = import ./npins; - nixpkgs = (import sources.flake-compat { src = sources.nixpkgs; }).outputs; - inherit (nixpkgs) lib; - pkgsFor = nixpkgs.legacyPackages; - inputs = sources; - in - { - nixosConfigurations = import ./default.nix; + outputs = _: let + sources = import ./npins; + nixpkgs = (import sources.flake-compat {src = sources.nixpkgs;}).outputs; - packages = lib.mapAttrs (_: pkgs: { - inherit - (import ./packages { - inherit inputs pkgs sources; - }) - fish - helix - kakoune - nushell - ; - }) pkgsFor; - devShells = lib.mapAttrs (_: pkgs: { - default = pkgs.mkShellNoCC { - packages = [ - (pkgs.callPackage (sources.npins + "/npins.nix") { }) - ]; - env.NPINS_OVERRIDE_nichts = "."; - }; - }) pkgsFor; + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import sources.systems); + pkgsFor = nixpkgs.legacyPackages; + inputs = sources; + in { + nixosConfigurations = import ./default.nix; - templates = import ./templates; - }; + formatter = eachSystem (system: pkgsFor.${system}.alejandra); + + packages = + lib.mapAttrs ( + _: pkgs: { + inherit + (import ./packages { + inherit inputs pkgs; + }) + fish + helix + kakoune + nushell + ; + } + ) + pkgsFor; + devShells = + lib.mapAttrs ( + _: pkgs: { + default = pkgs.mkShellNoCC { + packages = [ + (pkgs.callPackage (sources.npins + "/npins.nix") {}) + ]; + env.NPINS_OVERRIDE_nichts = "."; + }; + } + ) + pkgsFor; + + apps = eachSystem (system: let + inherit (inputs.self.packages.${system}) fish helix nushell; + in { + default = inputs.self.apps.${system}.nushell; + helix = { + type = "app"; + program = "${helix}/bin/hx"; + }; + nushell = { + type = "app"; + program = "${nushell}/bin/nu"; + }; + fish = { + type = "app"; + program = "${fish}/bin/fish"; + }; + }); + + templates = import ./templates; + }; } diff --git a/hosts/common.nix b/hosts/common.nix index 68f1c62..34a0269 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -6,19 +6,16 @@ lib, self, pkgs, - sources, ... -}: -let +}: let inherit (lib.meta) hiPrioSet; - helix = pkgs.callPackage (self + "/packages/helix") { inherit sources; }; - - fish = pkgs.callPackage (self + "/packages/fish") { inherit sources; }; -in -{ + helix = pkgs.callPackage (self + "/packages/helix") {}; + fish = pkgs.callPackage (self + "/packages/fish") {}; +in { environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) cachix calc delta diff --git a/hosts/default.nix b/hosts/default.nix index 12ee7fd..dfc5387 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -3,8 +3,7 @@ nixpkgs, self, ... -}: -let +}: let inherit (builtins) filter map toString; inherit (nixpkgs) lib; inherit (lib.attrsets) recursiveUpdate; @@ -15,18 +14,20 @@ let # NOTE: This was inspired by raf, and I find this # to be quite a sane way of managing all modules in my flake. - mkSystem = - { - system, - hostname, - ... - }@args: + mkSystem = { + system, + hostname, + ... + } @ args: nixosSystem { - specialArgs = recursiveUpdate { - inherit lib; - inputs = sources; - inherit self; - } args.specialArgs or { }; + specialArgs = + recursiveUpdate + { + inherit lib; + inputs = sources; + inherit self; + } + args.specialArgs or {}; modules = concatLists [ # This is used to pre-emptively set the hostPlatform for nixpkgs. # Also, we set the system hostname here. @@ -41,15 +42,20 @@ let # common configuration, which all hosts share. (singleton ./common.nix) # Import all files called module.nix from my modules directory. - (map toString (listFilesRecursive ../modules) |> filter (hasSuffix "module.nix")) - (map toString (listFilesRecursive ../modules) |> filter (hasSuffix ".mod.nix")) + ( + map toString (listFilesRecursive ../modules) + |> filter (hasSuffix "module.nix") + ) + ( + map toString (listFilesRecursive ../modules) + |> filter (hasSuffix ".mod.nix") + ) ] |> flatten ) ]; }; -in -{ +in { temperance = mkSystem { system = "x86_64-linux"; hostname = "temperance"; diff --git a/hosts/hermit/configuration.nix b/hosts/hermit/configuration.nix index 42a14c8..bb970bf 100644 --- a/hosts/hermit/configuration.nix +++ b/hosts/hermit/configuration.nix @@ -2,8 +2,7 @@ lib, pkgs, ... -}: -{ +}: { # Time Zone time.timeZone = "Europe/Zurich"; # Select internationalisation properties. diff --git a/hosts/hermit/filesystem/default.nix b/hosts/hermit/filesystem/default.nix index f751038..cef9c16 100644 --- a/hosts/hermit/filesystem/default.nix +++ b/hosts/hermit/filesystem/default.nix @@ -1,7 +1,6 @@ { config = { - boot.initrd.luks.devices."cryptroot".device = - "/dev/disk/by-uuid/10318654-ed20-43f6-885d-35366a427581"; + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/10318654-ed20-43f6-885d-35366a427581"; fileSystems = { "/boot" = { device = "/dev/disk/by-uuid/5D7D-FC52"; @@ -11,28 +10,17 @@ "/" = { device = "/dev/disk/by-uuid/e353013b-8ac7-40ed-80f2-ddbea21b8d5e"; fsType = "btrfs"; - options = [ - "compress=zstd" - "noatime" - ]; + options = ["compress=zstd" "noatime"]; }; "/nix" = { device = "/dev/disk/by-uuid/e353013b-8ac7-40ed-80f2-ddbea21b8d5e"; fsType = "btrfs"; - options = [ - "subvol=nix" - "compress=zstd" - "noatime" - ]; + options = ["subvol=nix" "compress=zstd" "noatime"]; }; "/home" = { device = "/dev/disk/by-uuid/e353013b-8ac7-40ed-80f2-ddbea21b8d5e"; fsType = "btrfs"; - options = [ - "subvol=home" - "compress=zstd" - "noatime" - ]; + options = ["subvol=home" "compress=zstd" "noatime"]; }; }; # swapDevices = [ diff --git a/hosts/hermit/hardware-configuration.nix b/hosts/hermit/hardware-configuration.nix index e9442b8..6f67a73 100644 --- a/hosts/hermit/hardware-configuration.nix +++ b/hosts/hermit/hardware-configuration.nix @@ -6,34 +6,21 @@ lib, modulesPath, ... -}: -{ +}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot = { initrd = { - availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usb_storage" - "sd_mod" - "rtsx_pci_sdmmc" - ]; - kernelModules = [ ]; + availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + kernelModules = []; }; - kernelModules = [ "kvm-intel" ]; - blacklistedKernelModules = [ - "nouveau" - "nvidia" - "nvidia_drm" - "nvidia_modeset" - ]; + kernelModules = ["kvm-intel"]; + blacklistedKernelModules = ["nouveau" "nvidia" "nvidia_drm" "nvidia_modeset"]; - kernelParams = [ "mem_sleep_default=deep" ]; - extraModulePackages = [ ]; + kernelParams = ["mem_sleep_default=deep"]; + extraModulePackages = []; extraModprobeConfig = '' blacklist nouveau options nouveau modeset=0 diff --git a/hosts/hermit/hardware/default.nix b/hosts/hermit/hardware/default.nix index c09935b..715273e 100644 --- a/hosts/hermit/hardware/default.nix +++ b/hosts/hermit/hardware/default.nix @@ -1 +1 @@ -_: { imports = [ ./monitors.nix ]; } +_: {imports = [./monitors.nix];} diff --git a/hosts/hermit/kernel/default.nix b/hosts/hermit/kernel/default.nix index ccd6622..5146fec 100644 --- a/hosts/hermit/kernel/default.nix +++ b/hosts/hermit/kernel/default.nix @@ -3,10 +3,8 @@ lib, pkgs, ... -}: -let +}: let xanmod_custom = callPackage ./xanmod.nix; -in -{ +in { boot.kernelPackages = xanmod_custom; } diff --git a/hosts/hermit/programs.nix b/hosts/hermit/programs.nix index eeac268..bc0b7ea 100644 --- a/hosts/hermit/programs.nix +++ b/hosts/hermit/programs.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let # a newer nil version, for pipes support. new-nil = pkgs.nil.overrideAttrs (_: { version = "unstable-18-07-2025"; @@ -18,12 +17,13 @@ let hash = "sha256-Sljr3ff8hl/qm/0wqc1GXsEr1wWn7NAXmdrd5wHzUX8="; }; }); -in -{ +in { environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) abook aerc + alejandra aichat alsa-utils anki diff --git a/hosts/temperance/configuration.nix b/hosts/temperance/configuration.nix index 6039b58..18d06af 100644 --- a/hosts/temperance/configuration.nix +++ b/hosts/temperance/configuration.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -{ +}: { # Time Zone time.timeZone = "Europe/Zurich"; # Select internationalisation properties. diff --git a/hosts/temperance/filesystem/default.nix b/hosts/temperance/filesystem/default.nix index 4731289..7b7311f 100644 --- a/hosts/temperance/filesystem/default.nix +++ b/hosts/temperance/filesystem/default.nix @@ -1,7 +1,6 @@ { config = { - boot.initrd.luks.devices."cryptroot".device = - "/dev/disk/by-uuid/96e8f3d6-8d2d-4e2d-abd9-3eb7f48fed02"; + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/96e8f3d6-8d2d-4e2d-abd9-3eb7f48fed02"; fileSystems = { "/boot" = { device = "/dev/disk/by-uuid/B3AC-9050"; @@ -11,49 +10,29 @@ "/" = { device = "none"; fsType = "tmpfs"; - options = [ - "defaults" - "size=40%" - "mode=755" - ]; + options = ["defaults" "size=40%" "mode=755"]; }; "/nix" = { device = "/dev/disk/by-uuid/f0569993-722e-4721-b0d9-8ac537a7a548"; fsType = "btrfs"; - options = [ - "subvol=nix" - "compress=zstd" - "noatime" - ]; + options = ["subvol=nix" "compress=zstd" "noatime"]; }; "/persist" = { device = "/dev/disk/by-uuid/f0569993-722e-4721-b0d9-8ac537a7a548"; neededForBoot = true; fsType = "btrfs"; - options = [ - "subvol=persist" - "compress=zstd" - "noatime" - ]; + options = ["subvol=persist" "compress=zstd" "noatime"]; }; "/home" = { device = "/dev/disk/by-uuid/f0569993-722e-4721-b0d9-8ac537a7a548"; fsType = "btrfs"; - options = [ - "subvol=home" - "compress=zstd" - "noatime" - ]; + options = ["subvol=home" "compress=zstd" "noatime"]; }; "/swap" = { device = "/dev/disk/by-uuid/f0569993-722e-4721-b0d9-8ac537a7a548"; fsType = "btrfs"; - options = [ - "subvol=swap" - "compress=lzo" - "noatime" - ]; + options = ["subvol=swap" "compress=lzo" "noatime"]; }; }; swapDevices = [ diff --git a/hosts/temperance/hardware-configuration.nix b/hosts/temperance/hardware-configuration.nix index e75c895..0720ed8 100644 --- a/hosts/temperance/hardware-configuration.nix +++ b/hosts/temperance/hardware-configuration.nix @@ -3,21 +3,14 @@ lib, modulesPath, ... -}: -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; boot = { - initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usbhid" - "sd_mod" - ]; - initrd.kernelModules = [ ]; - kernelModules = [ ]; - extraModulePackages = [ ]; + initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"]; + initrd.kernelModules = []; + kernelModules = []; + extraModulePackages = []; }; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking @@ -28,5 +21,6 @@ # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/temperance/hardware/default.nix b/hosts/temperance/hardware/default.nix index c09935b..715273e 100644 --- a/hosts/temperance/hardware/default.nix +++ b/hosts/temperance/hardware/default.nix @@ -1 +1 @@ -_: { imports = [ ./monitors.nix ]; } +_: {imports = [./monitors.nix];} diff --git a/hosts/temperance/kernel/default.nix b/hosts/temperance/kernel/default.nix index ccd6622..5146fec 100644 --- a/hosts/temperance/kernel/default.nix +++ b/hosts/temperance/kernel/default.nix @@ -3,10 +3,8 @@ lib, pkgs, ... -}: -let +}: let xanmod_custom = callPackage ./xanmod.nix; -in -{ +in { boot.kernelPackages = xanmod_custom; } diff --git a/hosts/temperance/kernel/unused.nix b/hosts/temperance/kernel/unused.nix index ce5a9ee..8f4cc06 100644 --- a/hosts/temperance/kernel/unused.nix +++ b/hosts/temperance/kernel/unused.nix @@ -1,10 +1,8 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib.kernel) no unset; inherit (lib.attrsets) mapAttrs; inherit (lib.modules) mkForce; -in -{ +in { boot.kernelPatches = [ { name = "disable-unused-features"; diff --git a/hosts/temperance/kernel/xanmod.nix b/hosts/temperance/kernel/xanmod.nix index f5dc2cf..68954d5 100644 --- a/hosts/temperance/kernel/xanmod.nix +++ b/hosts/temperance/kernel/xanmod.nix @@ -4,8 +4,7 @@ buildLinux, kernelPatches, ... -}: -let +}: let pname = "linux-xanmod"; version = "6.11.5"; vendorSuffix = "xanmod1"; @@ -59,17 +58,17 @@ let }; }) # 1:1 taken from raf's custom kernel, check out his config for this. - .overrideAttrs - (oa: { - prePatch = oa.prePatch or "" + '' + .overrideAttrs (oa: { + prePatch = + oa.prePatch or "" + + '' # bragging rights echo "Replacing localversion with custom suffix" substituteInPlace localversion \ --replace-fail "xanmod1" "blox" ''; - }); -in -{ + }); +in { inherit xanmod_blox ; diff --git a/hosts/temperance/programs.nix b/hosts/temperance/programs.nix index 98474f2..4d1f8bd 100644 --- a/hosts/temperance/programs.nix +++ b/hosts/temperance/programs.nix @@ -1,7 +1,7 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) alsa-utils anki asciinema diff --git a/hosts/tower/configuration.nix b/hosts/tower/configuration.nix index d652aca..ed19846 100644 --- a/hosts/tower/configuration.nix +++ b/hosts/tower/configuration.nix @@ -2,8 +2,7 @@ lib, pkgs, ... -}: -{ +}: { # Time Zone time.timeZone = "Europe/Vienna"; # Select internationalisation properties. diff --git a/hosts/tower/filesystem/default.nix b/hosts/tower/filesystem/default.nix index be5ccd8..331c4dd 100644 --- a/hosts/tower/filesystem/default.nix +++ b/hosts/tower/filesystem/default.nix @@ -8,7 +8,7 @@ "/" = { device = "/dev/disk/by-uuid/3a781f2e-290a-4609-9035-a93374459def"; fsType = "ext4"; - options = [ "noatime" ]; + options = ["noatime"]; }; }; } diff --git a/hosts/tower/hardware-configuration.nix b/hosts/tower/hardware-configuration.nix index 67abc5e..b9d7981 100644 --- a/hosts/tower/hardware-configuration.nix +++ b/hosts/tower/hardware-configuration.nix @@ -2,24 +2,19 @@ lib, modulesPath, ... -}: -{ +}: { imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; boot = { - initrd.availableKernelModules = [ - "xhci_pci" - "virtio_scsi" - "sr_mod" - ]; - initrd.kernelModules = [ ]; - kernelModules = [ ]; - extraModulePackages = [ ]; + initrd.availableKernelModules = ["xhci_pci" "virtio_scsi" "sr_mod"]; + initrd.kernelModules = []; + kernelModules = []; + extraModulePackages = []; }; - swapDevices = [ ]; + swapDevices = []; # 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/tower/programs.nix b/hosts/tower/programs.nix index 74465fe..505d7b8 100644 --- a/hosts/tower/programs.nix +++ b/hosts/tower/programs.nix @@ -1,7 +1,7 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) ; }; } diff --git a/hosts/world/configuration.nix b/hosts/world/configuration.nix index 0d6ae9d..2d02091 100644 --- a/hosts/world/configuration.nix +++ b/hosts/world/configuration.nix @@ -2,8 +2,7 @@ lib, pkgs, ... -}: -{ +}: { # Time Zone time.timeZone = "Europe/Zurich"; # Select internationalisation properties. diff --git a/hosts/world/filesystem/default.nix b/hosts/world/filesystem/default.nix index f751038..cef9c16 100644 --- a/hosts/world/filesystem/default.nix +++ b/hosts/world/filesystem/default.nix @@ -1,7 +1,6 @@ { config = { - boot.initrd.luks.devices."cryptroot".device = - "/dev/disk/by-uuid/10318654-ed20-43f6-885d-35366a427581"; + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/10318654-ed20-43f6-885d-35366a427581"; fileSystems = { "/boot" = { device = "/dev/disk/by-uuid/5D7D-FC52"; @@ -11,28 +10,17 @@ "/" = { device = "/dev/disk/by-uuid/e353013b-8ac7-40ed-80f2-ddbea21b8d5e"; fsType = "btrfs"; - options = [ - "compress=zstd" - "noatime" - ]; + options = ["compress=zstd" "noatime"]; }; "/nix" = { device = "/dev/disk/by-uuid/e353013b-8ac7-40ed-80f2-ddbea21b8d5e"; fsType = "btrfs"; - options = [ - "subvol=nix" - "compress=zstd" - "noatime" - ]; + options = ["subvol=nix" "compress=zstd" "noatime"]; }; "/home" = { device = "/dev/disk/by-uuid/e353013b-8ac7-40ed-80f2-ddbea21b8d5e"; fsType = "btrfs"; - options = [ - "subvol=home" - "compress=zstd" - "noatime" - ]; + options = ["subvol=home" "compress=zstd" "noatime"]; }; }; # swapDevices = [ diff --git a/hosts/world/hardware-configuration.nix b/hosts/world/hardware-configuration.nix index ee5c934..904ed89 100644 --- a/hosts/world/hardware-configuration.nix +++ b/hosts/world/hardware-configuration.nix @@ -3,8 +3,7 @@ lib, modulesPath, ... -}: -{ +}: { imports = [ # (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") (modulesPath + "/installer/scan/not-detected.nix") @@ -12,26 +11,14 @@ boot = { initrd = { - availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usb_storage" - "sd_mod" - "rtsx_pci_sdmmc" - ]; - kernelModules = [ ]; + availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + kernelModules = []; }; - kernelModules = [ "kvm-intel" ]; - blacklistedKernelModules = [ - "nouveau" - "nvidia" - "nvidia_drm" - "nvidia_modeset" - ]; + kernelModules = ["kvm-intel"]; + blacklistedKernelModules = ["nouveau" "nvidia" "nvidia_drm" "nvidia_modeset"]; - kernelParams = [ "mem_sleep_default=deep" ]; - extraModulePackages = [ ]; + kernelParams = ["mem_sleep_default=deep"]; + extraModulePackages = []; extraModprobeConfig = '' blacklist nouveau options nouveau modeset=0 diff --git a/hosts/world/hardware/default.nix b/hosts/world/hardware/default.nix index c09935b..715273e 100644 --- a/hosts/world/hardware/default.nix +++ b/hosts/world/hardware/default.nix @@ -1 +1 @@ -_: { imports = [ ./monitors.nix ]; } +_: {imports = [./monitors.nix];} diff --git a/hosts/world/programs.nix b/hosts/world/programs.nix index dd35220..4f29a7b 100644 --- a/hosts/world/programs.nix +++ b/hosts/world/programs.nix @@ -2,10 +2,10 @@ self, pkgs, ... -}: -{ +}: { environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) calc comma difftastic diff --git a/modules/options/system/monitors.mod.nix b/modules/options/system/monitors.mod.nix index b42d25d..e65a481 100644 --- a/modules/options/system/monitors.mod.nix +++ b/modules/options/system/monitors.mod.nix @@ -1,18 +1,10 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib.options) mkOption; - inherit (lib.types) - submodule - int - ints - number - attrsOf - ; -in -{ + inherit (lib.types) submodule int ints number attrsOf; +in { options.modules.system.hardware.monitors = mkOption { description = "\n List of monitors to use\n "; - default = { }; + default = {}; type = attrsOf (submodule { options = { resolution = mkOption { diff --git a/modules/options/system/options.mod.nix b/modules/options/system/options.mod.nix index a211afe..4d308f4 100644 --- a/modules/options/system/options.mod.nix +++ b/modules/options/system/options.mod.nix @@ -2,26 +2,18 @@ config, lib, ... -}: -let +}: let inherit (builtins) elemAt; inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) - enum - listOf - str - nullOr - bool - ; + inherit (lib.types) enum listOf str nullOr bool; inherit (lib.lists) elem; inherit (config.modules.system) systemType; -in -{ +in { options.modules.system = { users = mkOption { type = listOf str; - default = [ "cr" ]; + default = ["cr"]; description = "A list of users on the system."; }; @@ -35,11 +27,7 @@ in }; systemType = mkOption { - type = nullOr (enum [ - "desktop" - "laptop" - "server" - ]); + type = nullOr (enum ["desktop" "laptop" "server"]); default = null; description = '' The type of the current system. This is used to determine whether things like graphical @@ -49,10 +37,7 @@ in isGraphical = mkOption { type = bool; - default = elem systemType [ - "desktop" - "laptop" - ]; + default = elem systemType ["desktop" "laptop"]; description = '' Whether the current system is a graphical system. ''; @@ -61,10 +46,7 @@ in yubikeySupport = { enable = mkEnableOption "yubikey support"; deviceType = mkOption { - type = nullOr (enum [ - "NFC5" - "nano" - ]); + type = nullOr (enum ["NFC5" "nano"]); default = null; description = "A list of device models to enable Yubikey support for"; }; @@ -94,7 +76,7 @@ in enable = mkEnableOption "printing"; extraDrivers = mkOption { type = listOf str; - default = [ ]; + default = []; description = "A list of extra drivers to enable for printing"; }; }; diff --git a/modules/options/system/programs.mod.nix b/modules/options/system/programs.mod.nix index 04f6b85..403de42 100644 --- a/modules/options/system/programs.mod.nix +++ b/modules/options/system/programs.mod.nix @@ -1,9 +1,7 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib.types) str enum; inherit (lib.options) mkEnableOption mkOption; -in -{ +in { options.modules.system.programs = { editors = { helix.enable = mkEnableOption "Helix text editor"; @@ -29,42 +27,23 @@ in }; default = { terminal = mkOption { - type = enum [ - "foot" - "kitty" - ]; + type = enum ["foot" "kitty"]; default = "foot"; }; fileManager = mkOption { - type = enum [ - "thunar" - "dolphin" - "nemo" - ]; + type = enum ["thunar" "dolphin" "nemo"]; default = "thunar"; }; browser = mkOption { - type = enum [ - "firefox" - "librewolf" - "chromium" - ]; + type = enum ["firefox" "librewolf" "chromium"]; default = "firefox"; }; editor = mkOption { - type = enum [ - "neovim" - "helix" - "emacs" - ]; + type = enum ["neovim" "helix" "emacs"]; default = "emacs"; }; launcher = mkOption { - type = enum [ - "anyrun" - "rofi" - "wofi" - ]; + type = enum ["anyrun" "rofi" "wofi"]; default = "anyrun"; }; }; diff --git a/modules/other/git.mod.nix b/modules/other/git.mod.nix index 6e56d9f..c5b31c3 100644 --- a/modules/other/git.mod.nix +++ b/modules/other/git.mod.nix @@ -1,8 +1,7 @@ -{ pkgs, ... }: -let - key = pkgs.writeText "signingkey" "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw=="; -in -{ +{pkgs, ...}: let + key = + pkgs.writeText "signingkey" "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw=="; +in { programs.git = { enable = true; lfs.enable = true; diff --git a/modules/other/system.mod.nix b/modules/other/system.mod.nix index dbec1ac..d533cf5 100644 --- a/modules/other/system.mod.nix +++ b/modules/other/system.mod.nix @@ -1,9 +1,7 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib.options) mkOption; inherit (lib.types) str; -in -{ +in { options.modules.other.system = { username = mkOption { description = "username for this system"; diff --git a/modules/other/users.mod.nix b/modules/other/users.mod.nix index 040ef2a..908ca9d 100644 --- a/modules/other/users.mod.nix +++ b/modules/other/users.mod.nix @@ -4,20 +4,18 @@ pkgs, self, ... -}: -let +}: let inherit (builtins) elemAt; inherit (lib.options) mkOption; inherit (lib.types) listOf str package; inherit (config.meta.mainUser) username; - nushell = pkgs.callPackage (self + "/packages/nushell") { }; -in -{ + nushell = pkgs.callPackage (self + "/packages/nushell") {}; +in { options.meta = { users = mkOption { type = listOf str; - default = [ "cr" ]; + default = ["cr"]; description = '' A list of users on a system. ''; diff --git a/modules/other/xdg.mod.nix b/modules/other/xdg.mod.nix index a08b632..c094693 100644 --- a/modules/other/xdg.mod.nix +++ b/modules/other/xdg.mod.nix @@ -2,8 +2,7 @@ config, pkgs, ... -}: -let +}: let inherit (config.meta.mainUser) username; primary_browser = "Librewolf.desktop"; @@ -14,10 +13,9 @@ let text_editor = "helix.desktop"; terminal = "foot.desktop"; pdf_viewer = "zathura.desktop"; -in -{ +in { environment = { - systemPackages = [ pkgs.xdg-utils ]; + systemPackages = [pkgs.xdg-utils]; variables = { TERMINAL = "${terminal}"; XDG_CACHE_HOME = "/home/${username}/.config"; @@ -31,43 +29,43 @@ in mime = { enable = true; defaultApplications = { - "text/html" = [ primary_browser ]; - "x-scheme-handler/http" = [ primary_browser ]; - "x-scheme-handler/https" = [ primary_browser ]; - "x-scheme-handler/about" = [ primary_browser ]; - "x-scheme-handler/unknown" = [ primary_browser ]; - "x-scheme-handler/mailto" = [ mail_client ]; - "message/rfc822" = [ mail_client ]; - "x-scheme-handler/mid" = [ mail_client ]; - "inode/directory" = [ file_manager ]; - "audio/mp3" = [ media_player ]; - "audio/ogg" = [ media_player ]; - "audio/mpeg" = [ media_player ]; - "audio/aac" = [ media_player ]; - "audio/opus" = [ media_player ]; - "audio/wav" = [ media_player ]; - "audio/webm" = [ media_player ]; - "audio/3gpp" = [ media_player ]; - "audio/3gpp2" = [ media_player ]; - "video/mp4" = [ media_player ]; - "video/x-msvideo" = [ media_player ]; - "video/mpeg" = [ media_player ]; - "video/ogg" = [ media_player ]; - "video/mp2t" = [ media_player ]; - "video/webm" = [ media_player ]; - "video/3gpp" = [ media_player ]; - "video/3gpp2" = [ media_player ]; - "image/png" = [ image_viewer ]; - "image/jpeg" = [ image_viewer ]; - "image/gif" = [ image_viewer ]; - "image/avif" = [ image_viewer ]; - "image/bmp" = [ image_viewer ]; - "image/vnd.microsoft.icon" = [ image_viewer ]; - "image/svg+xml" = [ image_viewer ]; - "image/tiff" = [ image_viewer ]; - "image/webp" = [ image_viewer ]; - "text/plain" = [ text_editor ]; - "application/pdf" = [ pdf_viewer ]; + "text/html" = [primary_browser]; + "x-scheme-handler/http" = [primary_browser]; + "x-scheme-handler/https" = [primary_browser]; + "x-scheme-handler/about" = [primary_browser]; + "x-scheme-handler/unknown" = [primary_browser]; + "x-scheme-handler/mailto" = [mail_client]; + "message/rfc822" = [mail_client]; + "x-scheme-handler/mid" = [mail_client]; + "inode/directory" = [file_manager]; + "audio/mp3" = [media_player]; + "audio/ogg" = [media_player]; + "audio/mpeg" = [media_player]; + "audio/aac" = [media_player]; + "audio/opus" = [media_player]; + "audio/wav" = [media_player]; + "audio/webm" = [media_player]; + "audio/3gpp" = [media_player]; + "audio/3gpp2" = [media_player]; + "video/mp4" = [media_player]; + "video/x-msvideo" = [media_player]; + "video/mpeg" = [media_player]; + "video/ogg" = [media_player]; + "video/mp2t" = [media_player]; + "video/webm" = [media_player]; + "video/3gpp" = [media_player]; + "video/3gpp2" = [media_player]; + "image/png" = [image_viewer]; + "image/jpeg" = [image_viewer]; + "image/gif" = [image_viewer]; + "image/avif" = [image_viewer]; + "image/bmp" = [image_viewer]; + "image/vnd.microsoft.icon" = [image_viewer]; + "image/svg+xml" = [image_viewer]; + "image/tiff" = [image_viewer]; + "image/webp" = [image_viewer]; + "text/plain" = [text_editor]; + "application/pdf" = [pdf_viewer]; }; }; }; diff --git a/modules/packages/packages.mod.nix b/modules/packages/packages.mod.nix deleted file mode 100644 index de5b16f..0000000 --- a/modules/packages/packages.mod.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - pkgs, - sources, - ... -}: -let - nixfmt = pkgs.callPackage "${sources.nixfmt}/default.nix" { }; -in -{ - environment.systemPackages = [ - nixfmt - ]; -} diff --git a/modules/programs/cli/jj.mod.nix b/modules/programs/cli/jj.mod.nix index 80b06e5..8d619a5 100644 --- a/modules/programs/cli/jj.mod.nix +++ b/modules/programs/cli/jj.mod.nix @@ -3,11 +3,10 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.meta) getExe; - toml = pkgs.formats.toml { }; + toml = pkgs.formats.toml {}; jj-config = toml.generate "config.toml" { user = { name = "Bloxx12"; @@ -15,20 +14,11 @@ let }; ui = { - pager = [ - "${getExe pkgs.bat}" - "--plain" - ]; + pager = ["${getExe pkgs.bat}" "--plain"]; default-command = "log"; movement.edit = true; - diff.tool = [ - "${getExe pkgs.difftastic}" - "--color" - "always" - "$left" - "$right" - ]; + diff.tool = ["${getExe pkgs.difftastic}" "--color" "always" "$left" "$right"]; }; # FIXME: do this with agenix # "--scope" = [ @@ -54,52 +44,26 @@ let signing = { behaviour = "own"; backend = "ssh"; - key = [ - "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw==" - ]; + key = ["ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw=="]; }; aliases = { - c = [ "commit" ]; - ci = [ - "commit" - "--interactive" - ]; + c = ["commit"]; + ci = ["commit" "--interactive"]; - e = [ "edit" ]; + e = ["edit"]; # "new bookmark" - nb = [ - "bookmark" - "create" - "-r @-" - ]; + nb = ["bookmark" "create" "-r @-"]; - pull = [ - "git" - "fetch" - ]; - push = [ - "git" - "push" - "--allow-new" - ]; + pull = ["git" "fetch"]; + push = ["git" "push" "--allow-new"]; - r = [ "rebase" ]; - s = [ "squash" ]; - si = [ - "squash" - "--interactive" - ]; + r = ["rebase"]; + s = ["squash"]; + si = ["squash" "--interactive"]; - tug = [ - "bookmark" - "move" - "--from" - "closest_bookmark(@-)" - "--to" - "@-" - ]; + tug = ["bookmark" "move" "--from" "closest_bookmark(@-)" "--to" "@-"]; }; revset-aliases = { "closest_bookmark(to)" = "heads(::to & bookmarks())"; @@ -125,15 +89,14 @@ let jj-wrapped = pkgs.symlinkJoin { name = "jj-wrapped"; - paths = [ pkgs.jj ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [pkgs.jj]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/mako --add-flags "\ --config ${jj-config} ''; }; -in -{ +in { # environment.systemPackages = [jj-wrapped]; } diff --git a/modules/programs/cli/nh.mod.nix b/modules/programs/cli/nh.mod.nix index a671006..a6fc253 100644 --- a/modules/programs/cli/nh.mod.nix +++ b/modules/programs/cli/nh.mod.nix @@ -4,17 +4,15 @@ pkgs, sources, ... -}: -let +}: let cfg = config.modules.programs.nh; inherit (config.modules.other.system) username; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; - nh = (pkgs.callPackage "${sources.nh}/package.nix" { }).overrideAttrs (_: { + nh = (pkgs.callPackage "${sources.nh}/package.nix" {}).overrideAttrs (_: { doInstallCheck = false; }); -in -{ +in { options.modules.programs.nh.enable = mkEnableOption "nh"; config = mkIf cfg.enable { diff --git a/modules/programs/gui/bitwarden.mod.nix b/modules/programs/gui/bitwarden.mod.nix index 79726ad..6286247 100644 --- a/modules/programs/gui/bitwarden.mod.nix +++ b/modules/programs/gui/bitwarden.mod.nix @@ -3,26 +3,25 @@ lib, pkgs, ... -}: -let +}: let inherit (config.modules.system) isGraphical; inherit (lib.modules) mkIf; bitwarden-desktop-wrapped = pkgs.symlinkJoin { name = "bitwarden-desktop-wrapped"; - paths = [ pkgs.bitwarden-desktop ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [pkgs.bitwarden-desktop]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/bitwarden --set \ BITWARDEN_SSH_AUTH_SOCK /run/user/1000/ssh-agent.sock ''; }; -in -{ +in { config = mkIf isGraphical { environment = { systemPackages = lib.attrValues { - inherit (pkgs) + inherit + (pkgs) bitwarden-cli ; inherit bitwarden-desktop-wrapped; diff --git a/modules/programs/gui/brave.mod.nix b/modules/programs/gui/brave.mod.nix index b55a250..8ded1dd 100644 --- a/modules/programs/gui/brave.mod.nix +++ b/modules/programs/gui/brave.mod.nix @@ -2,8 +2,7 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.lists) map; inherit (lib.strings) concatStringsSep; @@ -21,15 +20,16 @@ let brave-wrapped = pkgs.symlinkJoin { name = "brave"; paths = [ - (pkgs.brave.override { vulkanSupport = true; }) + ( + pkgs.brave.override {vulkanSupport = true;} + ) ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/brave --append-flags "${flags}" ''; }; -in -{ +in { environment.systemPackages = [ brave-wrapped ]; diff --git a/modules/programs/gui/dolphin.mod.nix b/modules/programs/gui/dolphin.mod.nix index 559f002..6f13d56 100644 --- a/modules/programs/gui/dolphin.mod.nix +++ b/modules/programs/gui/dolphin.mod.nix @@ -3,17 +3,15 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (config.modules.system) isGraphical; -in -{ +in { config = mkIf isGraphical { environment.systemPackages = with pkgs; [ kdePackages.dolphin - kdePackages.kio-fuse # to mount remote filesystems via FUSE - kdePackages.kio-extras # extra protocols support (sftp, fish and more) + kdePackages.kio-fuse #to mount remote filesystems via FUSE + kdePackages.kio-extras #extra protocols support (sftp, fish and more) ]; }; } diff --git a/modules/programs/gui/foot.mod.nix b/modules/programs/gui/foot.mod.nix index 390c648..9aa32da 100644 --- a/modules/programs/gui/foot.mod.nix +++ b/modules/programs/gui/foot.mod.nix @@ -3,141 +3,137 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (config.meta.mainUser) username; cfg = config.modules.system.programs.terminals.foot; theme-colors = config.modules.style.colorScheme.colors; - foot-config = pkgs.writeText "foot.ini" ( - lib.generators.toINI { } { - main = { - term = "xterm-256color"; - app-id = "foot"; - title = "foot"; - locked-title = "no"; + foot-config = pkgs.writeText "foot.ini" (lib.generators.toINI {} { + main = { + term = "xterm-256color"; + app-id = "foot"; + title = "foot"; + locked-title = "no"; - font = "JetBrainsMono Nerd Font Mono:size=14"; - font-bold = "JetBrainsMono Nerd Font Mono:size=14:style=Bold"; + font = "JetBrainsMono Nerd Font Mono:size=14"; + font-bold = "JetBrainsMono Nerd Font Mono:size=14:style=Bold"; - line-height = 20; - letter-spacing = 0; + line-height = 20; + letter-spacing = 0; - horizontal-letter-offset = 0; - vertical-letter-offset = 0; - box-drawings-uses-font-glyphs = "no"; - dpi-aware = "no"; + horizontal-letter-offset = 0; + vertical-letter-offset = 0; + box-drawings-uses-font-glyphs = "no"; + dpi-aware = "no"; - bold-text-in-bright = "no"; - word-delimiters = ",│`|:\"'()[]{}<>"; - selection-target = "primary"; + bold-text-in-bright = "no"; + word-delimiters = ",│`|:\"'()[]{}<>"; + selection-target = "primary"; - initial-window-size-chars = "104x36"; - initial-window-mode = "windowed"; - pad = "8x8 center"; - resize-delay-ms = 100; - }; + initial-window-size-chars = "104x36"; + initial-window-mode = "windowed"; + pad = "8x8 center"; + resize-delay-ms = 100; + }; - desktop-notifications.command = "${pkgs.libnotify}/bin/notify-send -a \${app-id} -i \${app-id} \${title} \${body}"; + desktop-notifications.command = "${pkgs.libnotify}/bin/notify-send -a \${app-id} -i \${app-id} \${title} \${body}"; - bell = { - urgent = "yes"; - notify = "yes"; - command = "${pkgs.libnotify}/bin/notify-send bell"; - command-focused = "no"; - }; + bell = { + urgent = "yes"; + notify = "yes"; + command = "${pkgs.libnotify}/bin/notify-send bell"; + command-focused = "no"; + }; - scrollback = { - lines = 10000; - multiplier = 10.0; - indicator-position = "relative"; - indicator-format = "line"; - }; + scrollback = { + lines = 10000; + multiplier = 10.0; + indicator-position = "relative"; + indicator-format = "line"; + }; - url = { - launch = "${pkgs.xdg-utils}/bin/xdg-open \${url}"; - label-letters = "sadfjklewcmpgh"; - osc8-underline = "always"; - }; + url = { + launch = "${pkgs.xdg-utils}/bin/xdg-open \${url}"; + label-letters = "sadfjklewcmpgh"; + osc8-underline = "always"; + }; - tweak = { - font-monospace-warn = "no"; - sixel = "yes"; - }; - cursor = { - style = "beam"; - blink = "no"; - }; + tweak = { + font-monospace-warn = "no"; + sixel = "yes"; + }; + cursor = { + style = "beam"; + blink = "no"; + }; - mouse = { - hide-when-typing = "yes"; # not really needed since we already enable this in Hyprland. - alternate-scroll-mode = "yes"; - }; - csd.preferred = "server"; - key-bindings = { - scrollback-up-half-page = "Control+k"; - scrollback-up-page = "Control+Shift+k"; - scrollback-down-half-page = "Control+j"; - scrollback-down-page = "Control+Shift+j"; - }; - mouse-bindings = { - selection-override-modifiers = "Shift"; - primary-paste = "BTN_MIDDLE"; - select-begin = "BTN_LEFT"; - select-begin-block = "Control+BTN_LEFT"; - select-extend = "BTN_RIGHT"; - select-extend-character-wise = "Control+BTN_RIGHT"; - select-word = "BTN_LEFT-2"; - select-word-whitespace = "Control+BTN_LEFT-2"; - }; + mouse = { + hide-when-typing = "yes"; # not really needed since we already enable this in Hyprland. + alternate-scroll-mode = "yes"; + }; + csd.preferred = "server"; + key-bindings = { + scrollback-up-half-page = "Control+k"; + scrollback-up-page = "Control+Shift+k"; + scrollback-down-half-page = "Control+j"; + scrollback-down-page = "Control+Shift+j"; + }; + mouse-bindings = { + selection-override-modifiers = "Shift"; + primary-paste = "BTN_MIDDLE"; + select-begin = "BTN_LEFT"; + select-begin-block = "Control+BTN_LEFT"; + select-extend = "BTN_RIGHT"; + select-extend-character-wise = "Control+BTN_RIGHT"; + select-word = "BTN_LEFT-2"; + select-word-whitespace = "Control+BTN_LEFT-2"; + }; - colors = { - foreground = theme-colors.base05; # Text - background = theme-colors.base00; # Base - regular0 = theme-colors.base03; # Surface 1 - regular1 = theme-colors.base08; # red - regular2 = theme-colors.base0B; # green - regular3 = theme-colors.base0A; # yellow - regular4 = theme-colors.base0D; # blue - regular5 = "f5c2e7"; # pink - regular6 = "94e2d5"; # teal - regular7 = "bac2de"; # Subtext 1 + colors = { + foreground = theme-colors.base05; # Text + background = theme-colors.base00; # Base + regular0 = theme-colors.base03; # Surface 1 + regular1 = theme-colors.base08; # red + regular2 = theme-colors.base0B; # green + regular3 = theme-colors.base0A; # yellow + regular4 = theme-colors.base0D; # blue + regular5 = "f5c2e7"; # pink + regular6 = "94e2d5"; # teal + regular7 = "bac2de"; # Subtext 1 - bright0 = theme-colors.base04; # Surface 2 - bright1 = theme-colors.base08; # red - bright2 = theme-colors.base0B; # green - bright3 = theme-colors.base0A; # yellow - bright4 = "89b4fa"; # blue - bright5 = "f5c2e7"; # pink - bright6 = "94e2d5"; # teal - bright7 = "a6adc8"; # Subtext 0 + bright0 = theme-colors.base04; # Surface 2 + bright1 = theme-colors.base08; # red + bright2 = theme-colors.base0B; # green + bright3 = theme-colors.base0A; # yellow + bright4 = "89b4fa"; # blue + bright5 = "f5c2e7"; # pink + bright6 = "94e2d5"; # teal + bright7 = "a6adc8"; # Subtext 0 - selection-foreground = "cdd6f4"; - selection-background = "414356"; + selection-foreground = "cdd6f4"; + selection-background = "414356"; - search-box-no-match = "11111b f38ba8"; - search-box-match = "cdd6f4 313244"; + search-box-no-match = "11111b f38ba8"; + search-box-match = "cdd6f4 313244"; - jump-labels = "11111b fab387"; - urls = "89b4fa"; + jump-labels = "11111b fab387"; + urls = "89b4fa"; - alpha = 0.9; - }; - } - ); + alpha = 0.9; + }; + }); foot-wrapped = pkgs.symlinkJoin { name = "foot-wrapped"; - paths = [ pkgs.foot ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [pkgs.foot]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/foot --add-flags "--config=${foot-config} --working-directory=/home/${username}" ''; }; -in -{ +in { config = mkIf cfg.enable { - environment.systemPackages = [ foot-wrapped ]; + environment.systemPackages = [foot-wrapped]; }; } diff --git a/modules/programs/gui/ghostty.mod.nix b/modules/programs/gui/ghostty.mod.nix index 121edee..f588902 100644 --- a/modules/programs/gui/ghostty.mod.nix +++ b/modules/programs/gui/ghostty.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.lists) elem; inherit (lib.meta) getExe; inherit (lib.attrsets) mapAttrsToList; @@ -16,16 +15,9 @@ let # Shell integration for ghostty only supports # bash, fish and zsh for now. shell-integration = - if - elem name [ - "bash" - "fish" - "zsh" - ] - then - name - else - "none"; + if elem name ["bash" "fish" "zsh"] + then name + else "none"; ghostty-settings = { font-size = 14; @@ -61,21 +53,17 @@ let command = getExe package; }; - settingsFile = - pkgs.writeText "config" - <| concatStringsSep "\n" - <| mapAttrsToList (name: value: "${name} = ${toString value}") ghostty-settings; + settingsFile = pkgs.writeText "config" <| concatStringsSep "\n" <| mapAttrsToList (name: value: "${name} = ${toString value}") ghostty-settings; ghostty-wrapped = pkgs.symlinkJoin { name = "ghostty-wrapped"; - paths = [ pkgs.ghostty ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [pkgs.ghostty]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/ghostty --add-flags "--config-file=${settingsFile}" ''; }; -in -{ +in { environment.systemPackages = builtins.attrValues { inherit ghostty-wrapped; }; diff --git a/modules/programs/gui/minecraft.nix b/modules/programs/gui/minecraft.nix index fd5632a..753faeb 100644 --- a/modules/programs/gui/minecraft.nix +++ b/modules/programs/gui/minecraft.nix @@ -3,20 +3,18 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.options) mkEnableOption; inherit (lib.modules) mkIf; cfg = config.modules.programs.minecraft; -in -{ +in { options.modules.programs.minecraft = { enable = mkEnableOption "minecraft"; wayland = mkEnableOption "wayland"; }; config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.prismlauncher ]; + environment.systemPackages = [pkgs.prismlauncher]; }; } diff --git a/modules/programs/gui/spotify.mod.nix b/modules/programs/gui/spotify.mod.nix index 9f0eeeb..589d93f 100644 --- a/modules/programs/gui/spotify.mod.nix +++ b/modules/programs/gui/spotify.mod.nix @@ -1,9 +1,9 @@ -{ pkgs, ... }: -{ - environment.systemPackages = [ - pkgs.spotify - ] - ++ (with pkgs; [ - sptlrx - ]); +{pkgs, ...}: { + environment.systemPackages = + [ + pkgs.spotify + ] + ++ (with pkgs; [ + sptlrx + ]); } diff --git a/modules/programs/gui/steam.mod.nix b/modules/programs/gui/steam.mod.nix index 7d22abe..2b19e16 100644 --- a/modules/programs/gui/steam.mod.nix +++ b/modules/programs/gui/steam.mod.nix @@ -3,14 +3,12 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.programs.steam; -in -{ +in { options.modules.system.programs.steam.enable = mkEnableOption "Steam games platform"; config = mkIf cfg.enable { programs.steam = { @@ -21,15 +19,14 @@ in SDL_VIDEODRIVER = "x11"; }; - extraLibraries = - p: + extraLibraries = p: builtins.attrValues { inherit (p) atk; }; }; gamescopeSession.enable = true; - extraCompatPackages = [ pkgs.proton-ge-bin.steamcompattool ]; + extraCompatPackages = [pkgs.proton-ge-bin.steamcompattool]; }; # See # https://wiki.nixos.org/wiki/GameMode diff --git a/modules/programs/gui/thunar.mod.nix b/modules/programs/gui/thunar.mod.nix index 30773f1..0937764 100644 --- a/modules/programs/gui/thunar.mod.nix +++ b/modules/programs/gui/thunar.mod.nix @@ -3,19 +3,18 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.programs.thunar; -in -{ +in { options.modules.programs.thunar.enable = mkEnableOption "Thunar file manager"; config = mkIf cfg.enable { programs.thunar = { enable = true; plugins = builtins.attrValues { - inherit (pkgs.xfce) + inherit + (pkgs.xfce) thunar-volman thunar-vcs-plugin thunar-archive-plugin diff --git a/modules/programs/other/direnv.mod.nix b/modules/programs/other/direnv.mod.nix index 1c5e612..90f6098 100644 --- a/modules/programs/other/direnv.mod.nix +++ b/modules/programs/other/direnv.mod.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { config = { programs.direnv = { enable = true; diff --git a/modules/programs/other/nix-index.mod.nix b/modules/programs/other/nix-index.mod.nix index febcd44..43fb005 100644 --- a/modules/programs/other/nix-index.mod.nix +++ b/modules/programs/other/nix-index.mod.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { programs = { # We have to disable this and use nix-index instead. (Rust >>> Pearl) command-not-found = { diff --git a/modules/programs/tui/btop.mod.nix b/modules/programs/tui/btop.mod.nix index 3bdbc4c..802080e 100644 --- a/modules/programs/tui/btop.mod.nix +++ b/modules/programs/tui/btop.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.options) mkEnableOption; inherit (lib.modules) mkIf; @@ -34,16 +33,15 @@ let btop-wrapped = pkgs.symlinkJoin { name = "btop-wrapped"; - paths = [ btop-no-desktop-entry ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [btop-no-desktop-entry]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/btop --set XDG_CONFIG_HOME "${btop-settings}" ''; }; -in -{ +in { options.modules.programs.btop.enable = mkEnableOption "btop"; config = mkIf cfg.enable { - environment.systemPackages = [ btop-wrapped ]; + environment.systemPackages = [btop-wrapped]; }; } diff --git a/modules/programs/tui/zellij/zellij.mod.nix b/modules/programs/tui/zellij/zellij.mod.nix index ba3ef39..e7ccd93 100644 --- a/modules/programs/tui/zellij/zellij.mod.nix +++ b/modules/programs/tui/zellij/zellij.mod.nix @@ -1,16 +1,14 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let zellij-wrapped = pkgs.symlinkJoin { name = "zellij-wrapped"; - paths = [ pkgs.zellij ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [pkgs.zellij]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/zellij --add-flags "\ --config ${./config.kdl}" ''; }; -in -{ +in { environment.systemPackages = builtins.attrValues { inherit zellij-wrapped; }; diff --git a/modules/services/acme.mod.nix b/modules/services/acme.mod.nix index 07e8221..078b405 100644 --- a/modules/services/acme.mod.nix +++ b/modules/services/acme.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let mkAcmeCert = domain: { # An acme system user is created. This user belongs to the acme group # and the home directory is /var/lib/acme. This user will try to make the directory @@ -16,8 +15,7 @@ let email = "charlie@charlieroot.dev"; group = "nginx"; }; -in -{ +in { security.acme = { acceptTerms = true; defaults = { diff --git a/modules/services/forgejo/forgejo.mod.nix b/modules/services/forgejo/forgejo.mod.nix index 5e0e399..146dc0a 100644 --- a/modules/services/forgejo/forgejo.mod.nix +++ b/modules/services/forgejo/forgejo.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (pkgs) fetchurl; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; @@ -17,8 +16,7 @@ let img = ./img; dataDir = "/srv/data/forgejo"; dumpDir = "/srv/data/forgejo-dump"; -in -{ +in { options.modules.system.services.forgejo.enable = mkEnableOption "forgejo"; config = mkIf cfg.enable { @@ -52,7 +50,7 @@ in group = "git"; isSystemUser = true; }; - users.groups.git = { }; + users.groups.git = {}; services.forgejo = { enable = true; @@ -115,55 +113,53 @@ in }; }; - systemd.tmpfiles.rules = - let - # no crawlers, thank you. - robots = pkgs.writeText "robots-txt" '' - User-agent: * - Disallow: / - ''; - base-brand = fetchurl { - url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/codeberg/base-brand.css"; - hash = "sha256-QJ775HpINf8klO3d/8h+tEw0vk34p19dWUCWWuVwcho="; - }; - dark-variables = fetchurl { - url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/codeberg/dark-variables.css"; - hash = "sha256-nCSJUOU9/R1fldoKXTTZmP7vmRjYUk/OKkbgrJ/NrXQ="; - }; - theme-codeberg-dark = fetchurl { - url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/theme-codeberg-dark.css"; - hash = "sha256-KyXznH49koRGlzIDDqagN4PvFGD/zCX//wrctmtfgBs="; - }; - in - [ - "d '${customDir}/public' 0750 ${user} ${group} - -" - "d '${customDir}/public/assets' 0750 ${user} ${group} - -" - "d '${customDir}/public/assets/img' 0750 ${user} ${group} - -" - # Copeberg logo, thanks Raf <3 - "L+ '${customDir}/public/assets/img/logo.svg' - - - - ${img}/logo.svg" - "L+ '${customDir}/public/assets/img/logo.png' - - - - ${img}/logo.png" - "L+ '${customDir}/public/assets/img/apple-touch-icon' - - - - ${img}/logo.png" - "L+ '${customDir}/public/assets/img/favicon.svg' - - - - ${img}/logo.svg" - "L+ '${customDir}/public/assets/img/favicon.png' - - - - ${img}/logo.png" + systemd.tmpfiles.rules = let + # no crawlers, thank you. + robots = pkgs.writeText "robots-txt" '' + User-agent: * + Disallow: / + ''; + base-brand = fetchurl { + url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/codeberg/base-brand.css"; + hash = "sha256-QJ775HpINf8klO3d/8h+tEw0vk34p19dWUCWWuVwcho="; + }; + dark-variables = fetchurl { + url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/codeberg/dark-variables.css"; + hash = "sha256-nCSJUOU9/R1fldoKXTTZmP7vmRjYUk/OKkbgrJ/NrXQ="; + }; + theme-codeberg-dark = fetchurl { + url = "https://codeberg.org/Codeberg-Infrastructure/forgejo/raw/branch/codeberg-10/web_src/css/themes/theme-codeberg-dark.css"; + hash = "sha256-KyXznH49koRGlzIDDqagN4PvFGD/zCX//wrctmtfgBs="; + }; + in [ + "d '${customDir}/public' 0750 ${user} ${group} - -" + "d '${customDir}/public/assets' 0750 ${user} ${group} - -" + "d '${customDir}/public/assets/img' 0750 ${user} ${group} - -" + # Copeberg logo, thanks Raf <3 + "L+ '${customDir}/public/assets/img/logo.svg' - - - - ${img}/logo.svg" + "L+ '${customDir}/public/assets/img/logo.png' - - - - ${img}/logo.png" + "L+ '${customDir}/public/assets/img/apple-touch-icon' - - - - ${img}/logo.png" + "L+ '${customDir}/public/assets/img/favicon.svg' - - - - ${img}/logo.svg" + "L+ '${customDir}/public/assets/img/favicon.png' - - - - ${img}/logo.png" - # Theming shenanigans - "d '${customDir}/public/assets' 0750 ${user} ${group} - -" - "d '${customDir}/public/assets/css' 0750 ${user} ${group} - -" - "d '${customDir}/public/assets/css/codeberg' 0750 ${user} ${group} - -" + # Theming shenanigans + "d '${customDir}/public/assets' 0750 ${user} ${group} - -" + "d '${customDir}/public/assets/css' 0750 ${user} ${group} - -" + "d '${customDir}/public/assets/css/codeberg' 0750 ${user} ${group} - -" - "L+ '${customDir}/public/assets/css/theme-codeberg-dark.css' - - - - ${theme-codeberg-dark}" - "L+ '${customDir}/public/assets/css/codeberg/base-brand.css' - - - - ${base-brand}" - "L+ '${customDir}/public/assets/css/codeberg/dark-variables.css' - - - - ${dark-variables}" + "L+ '${customDir}/public/assets/css/theme-codeberg-dark.css' - - - - ${theme-codeberg-dark}" + "L+ '${customDir}/public/assets/css/codeberg/base-brand.css' - - - - ${base-brand}" + "L+ '${customDir}/public/assets/css/codeberg/dark-variables.css' - - - - ${dark-variables}" - # Templates - "d '${customDir}/templates' 0750 ${user} ${group} - -" - "d '${customDir}/templates/repo' 0750 ${user} ${group} - -" - # Home page - "L+ '${customDir}/templates/home.tmpl' - - - - ${./templates}/home.tmpl" - "L+ '${customDir}/templates/repo/header.tmpl' - - - - ${./templates/repo}/header.tmpl" + # Templates + "d '${customDir}/templates' 0750 ${user} ${group} - -" + "d '${customDir}/templates/repo' 0750 ${user} ${group} - -" + # Home page + "L+ '${customDir}/templates/home.tmpl' - - - - ${./templates}/home.tmpl" + "L+ '${customDir}/templates/repo/header.tmpl' - - - - ${./templates/repo}/header.tmpl" - # Fuck off scrapers - "L+ ${customDir}/public/robots.txt - - - - ${robots.outPath}" - ]; + # Fuck off scrapers + "L+ ${customDir}/public/robots.txt - - - - ${robots.outPath}" + ]; }; } diff --git a/modules/services/forgejo/templates/home.tmpl b/modules/services/forgejo/templates/home.tmpl index 168bfbe..03242f3 100644 --- a/modules/services/forgejo/templates/home.tmpl +++ b/modules/services/forgejo/templates/home.tmpl @@ -7,10 +7,49 @@

{{AppDisplayName}}

-

{{ctx.Locale.Tr "startpage.app_desc"}}

+

A very painful Git service

- {{template "home_forgejo" .}} +
+
+

+ +

Made with copious amounts of caffeeine

+

+

+ TODO: Write some funny text here +

+
+
+

+ +

I hate it here

+

+

+ Bottom text +

+
+
+
+
+

+ +

Is this the real life?

+

+

+ Something something fuck poettering +

+
+
+

+ +

Open source or something

+

+

+ I forgor +

+
+
{{template "base/footer" .}} diff --git a/modules/services/forgejo/templates/home_forgejo.tmpl b/modules/services/forgejo/templates/home_forgejo.tmpl deleted file mode 100644 index d5d18c7..0000000 --- a/modules/services/forgejo/templates/home_forgejo.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -
-
-

- {{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}} -

-

- {{ctx.Locale.Tr "startpage.install_desc" "https://forgejo.org/download/#installation-from-binary" "https://forgejo.org/download/#container-image" "https://forgejo.org/download"}} -

-
-
-

- {{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}} -

-

- {{ctx.Locale.Tr "startpage.platform_desc"}} -

-
-
-
-
-

- {{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}} -

-

- {{ctx.Locale.Tr "startpage.lightweight_desc"}} -

-
-
-

- {{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}} -

-

- {{ctx.Locale.Tr "startpage.license_desc" "https://forgejo.org/download" "https://codeberg.org/forgejo/forgejo"}} -

-
-
diff --git a/modules/services/grafana/grafana.mod.nix b/modules/services/grafana/grafana.mod.nix index 5652656..e52e7e1 100644 --- a/modules/services/grafana/grafana.mod.nix +++ b/modules/services/grafana/grafana.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (builtins) fetchurl; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; @@ -12,12 +11,11 @@ let cfg = config.modules.system.services.grafana; domain = "info.copeberg.org"; port = 4021; -in -{ +in { options.modules.system.services.grafana.enable = mkEnableOption "Grafana, a graphing service"; config = mkIf cfg.enable { - networking.firewall.allowedTCPPorts = [ config.services.grafana.settings.server.http_port ]; + networking.firewall.allowedTCPPorts = [config.services.grafana.settings.server.http_port]; modules.system.services.database.postgresql.enable = true; diff --git a/modules/services/greetd.mod.nix b/modules/services/greetd.mod.nix index 468c302..a772bee 100644 --- a/modules/services/greetd.mod.nix +++ b/modules/services/greetd.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.meta) getExe getExe'; inherit (lib.modules) mkIf; inherit (lib.options) mkOption mkEnableOption; @@ -13,8 +12,7 @@ let inherit (config.meta.mainUser) username; cfg = config.modules.services.greetd; uwsmEnabled = config.modules.services.uwsm.enable; -in -{ +in { options.modules.services.greetd = { enable = mkEnableOption "greetd"; greeter = mkOption { @@ -29,33 +27,33 @@ in description = "Which login session to start"; type = str; default = - if uwsmEnabled then "${getExe config.programs.uwsm.package} start Hyprland" else "Hyprland"; + if uwsmEnabled + then "${getExe config.programs.uwsm.package} start Hyprland" + else "Hyprland"; }; }; config = mkIf cfg.enable { - services.greetd = - let - session = { - # command = '' - # ${pkgs.greetd.tuigreet}/bin/tuigreet \ - # -c \"${cfg.session}\" \ - # -r - # -t --time-format "DD.MM.YYYY" - # --asteriks''; + services.greetd = let + session = { + # command = '' + # ${pkgs.greetd.tuigreet}/bin/tuigreet \ + # -c \"${cfg.session}\" \ + # -r + # -t --time-format "DD.MM.YYYY" + # --asteriks''; - command = "${getExe config.programs.uwsm.package} start hyprland-uwsm.desktop"; - user = username; - }; - in - { - enable = true; - package = pkgs.greetd; - vt = 7; - settings = { - default_session = session; - initial_session = session; - }; + command = "${getExe config.programs.uwsm.package} start hyprland-uwsm.desktop"; + user = username; }; + in { + enable = true; + package = pkgs.greetd; + vt = 7; + settings = { + default_session = session; + initial_session = session; + }; + }; }; } diff --git a/modules/services/kanata/kanata.mod.nix b/modules/services/kanata/kanata.mod.nix index d9a21a4..c39dd6d 100644 --- a/modules/services/kanata/kanata.mod.nix +++ b/modules/services/kanata/kanata.mod.nix @@ -2,14 +2,12 @@ config, lib, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.services.kanata; -in -{ +in { options.modules.services.kanata.enable = mkEnableOption "kanata"; config = mkIf cfg.enable { services.kanata = { diff --git a/modules/services/locate.mod.nix b/modules/services/locate.mod.nix index 61bf0f4..d945e6b 100644 --- a/modules/services/locate.mod.nix +++ b/modules/services/locate.mod.nix @@ -3,16 +3,14 @@ lib, pkgs, ... -}: -let +}: let cfg = config.modules.services.locate; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; -in -{ +in { options.modules.services.locate.enable = mkEnableOption "Locate service"; config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.plocate ]; + environment.systemPackages = [pkgs.plocate]; services.locate = { enable = true; interval = "hourly"; diff --git a/modules/services/mako.mod.nix b/modules/services/mako.mod.nix index 2df18f9..52eba30 100644 --- a/modules/services/mako.mod.nix +++ b/modules/services/mako.mod.nix @@ -1,9 +1,8 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let mako-wrapped = pkgs.symlinkJoin { name = "mako-wrapped"; - paths = [ pkgs.mako ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; + paths = [pkgs.mako]; + nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/mako --add-flags "\ --font 'Lexend 11' \ @@ -13,7 +12,6 @@ let --default-timeout 4000" ''; }; -in -{ - environment.systemPackages = [ mako-wrapped ]; +in { + environment.systemPackages = [mako-wrapped]; } diff --git a/modules/services/monitoring/loki/loki.mod.nix b/modules/services/monitoring/loki/loki.mod.nix index 4bdd589..eda11a2 100644 --- a/modules/services/monitoring/loki/loki.mod.nix +++ b/modules/services/monitoring/loki/loki.mod.nix @@ -3,16 +3,14 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.services.loki; port = 4026; dataDir = "/srv/data/loki"; -in -{ +in { options.modules.system.services.loki.enable = mkEnableOption "Grafana, a graphing service"; config = mkIf cfg.enable { diff --git a/modules/services/mpd.mod.nix b/modules/services/mpd.mod.nix index edf67bf..195af90 100644 --- a/modules/services/mpd.mod.nix +++ b/modules/services/mpd.mod.nix @@ -3,15 +3,13 @@ lib, pkgs, ... -}: -let +}: let cfg = config.modules.services.media.mpd; inherit (config.meta.mainUser) username; inherit (lib.modules) mkIf; inherit (lib.types) str; inherit (lib.options) mkOption mkEnableOption; -in -{ +in { options.modules.services = { media = { mpd = { @@ -26,7 +24,7 @@ in }; config = mkIf cfg.enable { # command line interface to mpd - environment.systemPackages = [ pkgs.mpc ]; + environment.systemPackages = [pkgs.mpc]; systemd.services.mpd.environment = { # https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609 diff --git a/modules/services/nginx.mod.nix b/modules/services/nginx.mod.nix index e407478..1c0b7cc 100644 --- a/modules/services/nginx.mod.nix +++ b/modules/services/nginx.mod.nix @@ -3,13 +3,11 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf mkDefault; inherit (lib.options) mkEnableOption; cfg = config.modules.system.services.nginx; -in -{ +in { options.modules.system.services.nginx.enable = mkEnableOption "nginx"; config = mkIf cfg.enable { security = { diff --git a/modules/services/owncloud.mod.nix b/modules/services/owncloud.mod.nix index 2be69c1..7e1ec97 100644 --- a/modules/services/owncloud.mod.nix +++ b/modules/services/owncloud.mod.nix @@ -3,14 +3,12 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.meta) getExe'; inherit (lib.modules) mkIf; cfg = config.modules.system.services.owncloud; -in -{ +in { options.modules.system.services.owncloud.enable = lib.mkEnableOption "owncloud"; config = { @@ -18,11 +16,11 @@ in description = "Owncloud client service"; # makes the graphical session start this service when it starts - wantedBy = [ "graphical-session.target" ]; + wantedBy = ["graphical-session.target"]; # when graphical session restarts or gets stopped, this also gets restarted/stopped. - partOf = [ "graphical-session.target" ]; + partOf = ["graphical-session.target"]; # gets started only after graphical session - after = [ "graphical-session.target" ]; + after = ["graphical-session.target"]; serviceConfig = { ExecStart = "${getExe' pkgs.owncloud-client "owncloud"}"; diff --git a/modules/services/pipewire.mod.nix b/modules/services/pipewire.mod.nix index 0f5e74f..bb375c3 100644 --- a/modules/services/pipewire.mod.nix +++ b/modules/services/pipewire.mod.nix @@ -2,12 +2,10 @@ config, lib, ... -}: -let +}: let cfg = config.modules.system.sound; inherit (lib.modules) mkIf; -in -{ +in { config = mkIf cfg.enable { services.pulseaudio.enable = false; services.pipewire = { diff --git a/modules/services/postgresql.mod.nix b/modules/services/postgresql.mod.nix index 363128d..e8ee68f 100644 --- a/modules/services/postgresql.mod.nix +++ b/modules/services/postgresql.mod.nix @@ -3,14 +3,12 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.services.database.postgresql; -in -{ +in { options.modules.system.services.database.postgresql.enable = mkEnableOption "postgresql"; config = mkIf cfg.enable { diff --git a/modules/services/printing.mod.nix b/modules/services/printing.mod.nix index ea20bf8..732fc17 100644 --- a/modules/services/printing.mod.nix +++ b/modules/services/printing.mod.nix @@ -2,11 +2,9 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.options) mkEnableOption; -in -{ +in { options.modules.services.cups.enable = mkEnableOption "CUPS, the Common UNIX printing system"; config = { diff --git a/modules/services/prometheus/prometheus.mod.nix b/modules/services/prometheus/prometheus.mod.nix index e5933d2..f978d0f 100644 --- a/modules/services/prometheus/prometheus.mod.nix +++ b/modules/services/prometheus/prometheus.mod.nix @@ -3,15 +3,13 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.services.prometheus; port = 4022; -in -{ +in { options.modules.system.services.prometheus.enable = mkEnableOption "Grafana, a graphing service"; config = mkIf cfg.enable { @@ -24,10 +22,7 @@ in node = { enable = true; port = 4023; - enabledCollectors = [ - "systemd" - "processes" - ]; + enabledCollectors = ["systemd" "processes"]; }; postgres = { @@ -44,28 +39,22 @@ in { job_name = "prometheus"; scrape_interval = "30s"; - static_configs = [ { targets = [ "localhost:${toString port}" ]; } ]; + static_configs = [{targets = ["localhost:${toString port}"];}]; } { job_name = "node"; scrape_interval = "30s"; - static_configs = [ - { targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; } - ]; + static_configs = [{targets = ["localhost:${toString config.services.prometheus.exporters.node.port}"];}]; } { job_name = "postgres"; scrape_interval = "30s"; - static_configs = [ - { targets = [ "localhost:${toString config.services.prometheus.exporters.postgres.port}" ]; } - ]; + static_configs = [{targets = ["localhost:${toString config.services.prometheus.exporters.postgres.port}"];}]; } { job_name = "nginx"; scrape_interval = "30s"; - static_configs = [ - { targets = [ "localhost:${toString config.services.prometheus.exporters.nginx.port}" ]; } - ]; + static_configs = [{targets = ["localhost:${toString config.services.prometheus.exporters.nginx.port}"];}]; } ]; }; diff --git a/modules/services/spotifyd.mod.nix b/modules/services/spotifyd.mod.nix index 6ffecc9..65a1906 100644 --- a/modules/services/spotifyd.mod.nix +++ b/modules/services/spotifyd.mod.nix @@ -2,17 +2,15 @@ config, lib, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (config.modules.system) isGraphical; -in -{ +in { # TODO: setup services.spotifyd = mkIf isGraphical { enable = true; settings = { - # backend = "pipe"; + backend = "pipe"; }; }; } diff --git a/modules/services/ssh.mod.nix b/modules/services/ssh.mod.nix index b8f5315..6fc4a76 100644 --- a/modules/services/ssh.mod.nix +++ b/modules/services/ssh.mod.nix @@ -1,13 +1,11 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib.options) mkEnableOption; -in -{ +in { options.modules.programs.ssh.enable = mkEnableOption "ssh"; config = { services.openssh = { enable = true; - ports = [ 22 ]; + ports = [22]; settings = { PasswordAuthentication = false; PermitRootLogin = "no"; diff --git a/modules/services/stalwart.mod.nix b/modules/services/stalwart.mod.nix index 93f8273..67e3d96 100644 --- a/modules/services/stalwart.mod.nix +++ b/modules/services/stalwart.mod.nix @@ -3,16 +3,14 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; domain = "charlieroot.dev"; cfg = config.modules.system.services.stalwart; -in -{ +in { options.modules.system.services.stalwart.enable = mkEnableOption "stalwart"; config = mkIf cfg.enable { # create the stallwart user @@ -22,7 +20,7 @@ in group = "stalwart"; isSystemUser = true; }; - users.groups.stalwart = { }; + users.groups.stalwart = {}; services.stalwart-mail = { enable = true; @@ -57,7 +55,7 @@ in # This is the standard port for SMTP, and is used by mail servers to send email to each other. smtp = { protocol = "smtp"; - bind = [ "[::]:25" ]; + bind = ["[::]:25"]; tls.implicit = true; }; # SMTP submissions with implicit TLS are received on port 465 by default. @@ -65,17 +63,17 @@ in # and is used by mail clients to send email to mail servers. submissions = { - bind = [ "[::]:465" ]; + bind = ["[::]:465"]; protocol = "smtp"; tls.implicit = true; }; imaps = { - bind = [ "[::]:993" ]; + bind = ["[::]:993"]; protocol = "imap"; tls.implicit = true; }; management = { - bind = [ "127.0.0.1:8080" ]; + bind = ["127.0.0.1:8080"]; protocol = "http"; tls.implicit = true; }; diff --git a/modules/services/usbguard.mod.nix b/modules/services/usbguard.mod.nix index 40e8353..9bdaa71 100644 --- a/modules/services/usbguard.mod.nix +++ b/modules/services/usbguard.mod.nix @@ -3,23 +3,18 @@ lib, pkgs, ... -}: -let +}: let inherit (config.meta.mainUser) username; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.services.usbguard; -in -{ +in { options.modules.services.usbguard.enable = mkEnableOption "usbguard"; config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.usbguard ]; + environment.systemPackages = [pkgs.usbguard]; services.usbguard = { enable = true; - IPCAllowedUsers = [ - "root" - "${username}" - ]; + IPCAllowedUsers = ["root" "${username}"]; presentDevicePolicy = "allow"; rules = '' allow with-interface equals { 08:*:* } diff --git a/modules/services/uwsm.mod.nix b/modules/services/uwsm.mod.nix index bc4bc7e..8a16d98 100644 --- a/modules/services/uwsm.mod.nix +++ b/modules/services/uwsm.mod.nix @@ -3,13 +3,11 @@ lib, pkgs, ... -}: -let +}: let cfg = config.modules.services.uwsm; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; -in -{ +in { options.modules.services.uwsm.enable = mkEnableOption "uwsm"; config = mkIf cfg.enable { programs.uwsm = { diff --git a/modules/services/wayneko.mod.nix b/modules/services/wayneko.mod.nix index 2eaf564..b028bf8 100644 --- a/modules/services/wayneko.mod.nix +++ b/modules/services/wayneko.mod.nix @@ -2,8 +2,7 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.meta) getExe; custom-wayneko = pkgs.wayneko.overrideAttrs { @@ -17,17 +16,16 @@ let hash = ""; }; -in -{ +in { systemd.user.services.wayneko = { description = "Wayneko, as a systemd service"; # makes the graphical session start this service when it starts - wantedBy = [ "graphical-session.target" ]; + wantedBy = ["graphical-session.target"]; # when graphical session restarts or gets stopped, this also gets restarted/stopped. - partOf = [ "graphical-session.target" ]; + partOf = ["graphical-session.target"]; # gets started only after graphical session - after = [ "graphical-session.target" ]; + after = ["graphical-session.target"]; serviceConfig = { ExecStart = '' @@ -41,7 +39,7 @@ in RestartSec = 1; TimeoutStopSec = 10; - CapabilityBoundingSet = [ "" ]; + CapabilityBoundingSet = [""]; DevicePolicy = "closed"; LockPersonality = true; MemoryDenyWriteExecute = true; @@ -67,7 +65,7 @@ in RestrictRealTime = true; RestrictSUIDSGID = true; - SystemCallArchitectures = [ "native" ]; + SystemCallArchitectures = ["native"]; SystemCallFilter = "~@clock @cpu-emulation @debug @obsolete @module @mount @raw-io @reboot @swap @privileged"; }; diff --git a/modules/style/colors.mod.nix b/modules/style/colors.mod.nix index 344788d..8b6dcd9 100644 --- a/modules/style/colors.mod.nix +++ b/modules/style/colors.mod.nix @@ -9,24 +9,10 @@ config, lib, ... -}: -let +}: let inherit (lib.options) mkOption literalExpression; - inherit (lib.strings) - toLower - replaceStrings - removePrefix - hasPrefix - isString - ; - inherit (lib.types) - str - nullOr - enum - mkOptionType - attrsOf - coercedTo - ; + inherit (lib.strings) toLower replaceStrings removePrefix hasPrefix isString; + inherit (lib.types) str nullOr enum mkOptionType attrsOf coercedTo; cfg = config.modules.style; @@ -38,24 +24,16 @@ let }; colorType = attrsOf (coercedTo str (removePrefix "#") hexColorType); - nameToSlug = name: toLower (replaceStrings [ " " ] [ "-" ] name); - getPaletteFromScheme = - slug: - if builtins.pathExists ./palettes/${slug}.nix then - (import ./palettes/${slug}.nix).colorscheme.palette - else - throw "The following colorscheme was imported but not found: ${slug}"; -in -{ + nameToSlug = name: toLower (replaceStrings [" "] ["-"] name); + getPaletteFromScheme = slug: + if builtins.pathExists ./palettes/${slug}.nix + then (import ./palettes/${slug}.nix).colorscheme.palette + else throw "The following colorscheme was imported but not found: ${slug}"; +in { options.modules.style = { colorScheme = { name = mkOption { - type = nullOr (enum [ - "Catppuccin Mocha" - "Zenburn" - "Black Metal Venom" - "Gruvbox" - ]); + type = nullOr (enum ["Catppuccin Mocha" "Zenburn" "Black Metal Venom" "Gruvbox"]); description = "The colorscheme that should be used globally to theme your system."; default = "Catppuccin Mocha"; }; @@ -105,11 +83,11 @@ in }; variant = mkOption { - type = enum [ - "dark" - "light" - ]; - default = if builtins.substring 0 1 cfg.colorScheme.colors.base00 < "5" then "dark" else "light"; + type = enum ["dark" "light"]; + default = + if builtins.substring 0 1 cfg.colorScheme.colors.base00 < "5" + then "dark" + else "light"; description = '' Whether the scheme is dark or light ''; diff --git a/modules/style/fonts.mod.nix b/modules/style/fonts.mod.nix index dcde8b2..1e9ba57 100644 --- a/modules/style/fonts.mod.nix +++ b/modules/style/fonts.mod.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let inherit (builtins) mapAttrs; fancy-iosevka = pkgs.iosevka.override { @@ -41,8 +40,7 @@ let }; set = "Fancy"; }; -in -{ +in { # A (somewhat) sane list of fonts to be installed. fonts = { fontconfig = { @@ -60,26 +58,26 @@ in # Set the defalt fonts. This was taken from raf, # many thanks. - defaultFonts = - let - common = [ - "Iosevka Nerd Font" - "Roboto Mono Nerd Font" - "Fira Code Nerd Font" - "Symbols Nerd Font" - "Noto Color Emoji" - "JetbrainsMono Nerd Font" - ]; - in + defaultFonts = let + common = [ + "Iosevka Nerd Font" + "Roboto Mono Nerd Font" + "Fira Code Nerd Font" + "Symbols Nerd Font" + "Noto Color Emoji" + "JetbrainsMono Nerd Font" + ]; + in mapAttrs (_: fonts: fonts ++ common) { - serif = [ "Noto Serif" ]; - sansSerif = [ "Lexend" ]; - emoji = [ "Noto Color Emoji" ]; - monospace = [ "Iosevka Nerd Font" ]; + serif = ["Noto Serif"]; + sansSerif = ["Lexend"]; + emoji = ["Noto Color Emoji"]; + monospace = ["Iosevka Nerd Font"]; }; }; packages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) material-icons material-design-icons lexend @@ -90,7 +88,8 @@ in corefonts font-awesome ; - inherit (pkgs.nerd-fonts) + inherit + (pkgs.nerd-fonts) iosevka jetbrains-mono comic-shanns-mono diff --git a/modules/style/gtk-colors.nix b/modules/style/gtk-colors.nix index eed6ff9..b714eed 100644 --- a/modules/style/gtk-colors.nix +++ b/modules/style/gtk-colors.nix @@ -1,7 +1,6 @@ # blatantly stolen from sioodmy, thanks :3 -{ colors }: -with colors; -'' +{colors}: +with colors; '' @define-color accent_color #${base0D}; @define-color accent_bg_color #${base0D}; @define-color accent_fg_color #${base00}; diff --git a/modules/style/gtk.mod.nix b/modules/style/gtk.mod.nix index 8be837b..82a0aab 100644 --- a/modules/style/gtk.mod.nix +++ b/modules/style/gtk.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (builtins) toString isBool; inherit (lib.generators) toINI; inherit (lib.modules) mkIf; @@ -16,12 +15,12 @@ let cfg = config.modules.theming.gtk; toGtk3Ini = toINI { - mkKeyValue = - key: value: - let - value' = if isBool value then boolToString value else toString value; - in - "${escape [ "=" ] key}=${value'}"; + mkKeyValue = key: value: let + value' = + if isBool value + then boolToString value + else toString value; + in "${escape ["="] key}=${value'}"; }; gtkIni = { @@ -35,8 +34,7 @@ let gtk-cursor-theme-name = "BreezeX-RosePine-Linux"; gtk-theme-name = "Gruvbox-Dark"; }; -in -{ +in { options.modules.theming.gtk = { enable = mkEnableOption "Wether to enable GTK theming"; theme = { @@ -65,15 +63,15 @@ in }; }; }; - config = - let - cursorSize = 32; - in + config = let + cursorSize = 32; + in mkIf cfg.enable { programs.dconf.enable = true; environment = { systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) rose-pine-cursor gruvbox-gtk-theme papirus-icon-theme @@ -85,33 +83,31 @@ in XCURSOR_THEME = "BreezeX-RosePine-Linux"; XCURSOR_SIZE = cursorSize; }; - etc = - let - css = import ./gtk-colors.nix { inherit (config.modules.style.colorScheme) colors; }; - in - { - "xdg/gtk-4.0/settings.ini".text = toGtk3Ini { - Settings = gtkIni; - }; - "xdg/gtk-3.0/settings.ini".text = toGtk3Ini { - Settings = gtkIni; - }; - "xdg/gtk-4.0/gtk.css".text = css; - "xdg/gtk-3.0/gtk.css".text = css; - - "xdg/gtk-2.0/gtkrc".text = '' - gtk-cursor-theme-name = BreezeX-RosePine-Linux - gtk-cursor-theme-size = ${toString cursorSize} - gtk-theme-name = ${cfg.theme.name} - gtk-icon-theme-name = ${cfg.iconTheme.name} - gtk-font-name = Lexend 11 - ''; - - "xdg/Xresources".text = '' - Xcursor.size: ${toString cursorSize} - Xcursor.theme: BreezeX-RosePine-Linux - ''; + etc = let + css = import ./gtk-colors.nix {inherit (config.modules.style.colorScheme) colors;}; + in { + "xdg/gtk-4.0/settings.ini".text = toGtk3Ini { + Settings = gtkIni; }; + "xdg/gtk-3.0/settings.ini".text = toGtk3Ini { + Settings = gtkIni; + }; + "xdg/gtk-4.0/gtk.css".text = css; + "xdg/gtk-3.0/gtk.css".text = css; + + "xdg/gtk-2.0/gtkrc".text = '' + gtk-cursor-theme-name = BreezeX-RosePine-Linux + gtk-cursor-theme-size = ${toString cursorSize} + gtk-theme-name = ${cfg.theme.name} + gtk-icon-theme-name = ${cfg.iconTheme.name} + gtk-font-name = Lexend 11 + ''; + + "xdg/Xresources".text = '' + Xcursor.size: ${toString cursorSize} + Xcursor.theme: BreezeX-RosePine-Linux + ''; + }; }; }; } diff --git a/modules/style/qt.mod.nix b/modules/style/qt.mod.nix index 76769ed..316c8cf 100644 --- a/modules/style/qt.mod.nix +++ b/modules/style/qt.mod.nix @@ -3,15 +3,13 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption mkOption; inherit (lib.types) str package; cfg = config.modules.theming.qt; -in -{ +in { options.modules.theming.qt = { enable = mkEnableOption "qt theming"; name = mkOption { diff --git a/modules/style/quickshell/quickshell.mod.nix b/modules/style/quickshell/quickshell.mod.nix index 5ab2e37..cff3df9 100644 --- a/modules/style/quickshell/quickshell.mod.nix +++ b/modules/style/quickshell/quickshell.mod.nix @@ -4,19 +4,17 @@ pkgs, sources, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.theming.quickshell; -in -{ +in { options.modules.theming.quickshell.enable = mkEnableOption "quickshell"; config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ - (pkgs.callPackage (sources.quickshell + "/default.nix") { }) + (pkgs.callPackage (sources.quickshell + "/default.nix") {}) qt6.qtimageformats qt6.qt5compat qt6.qtmultimedia diff --git a/modules/style/quickshell/shell/.qmlls.ini b/modules/style/quickshell/shell/.qmlls.ini index a780449..dbd3d39 100644 --- a/modules/style/quickshell/shell/.qmlls.ini +++ b/modules/style/quickshell/shell/.qmlls.ini @@ -1 +1 @@ -/run/user/1000/quickshell/vfs/4f7a8066a49ba487f5b2754750896151/.qmlls.ini \ No newline at end of file +/run/user/1000/quickshell/vfs/97b86fe3cbb42714790f5e96b44b706b/.qmlls.ini \ No newline at end of file diff --git a/modules/system/boot/boot.mod.nix b/modules/system/boot/boot.mod.nix index 5c05cb8..2aeeb1a 100644 --- a/modules/system/boot/boot.mod.nix +++ b/modules/system/boot/boot.mod.nix @@ -3,15 +3,13 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkForce mkDefault; inherit (lib.options) mkOption mkEnableOption; inherit (lib.types) int; cfg = config.modules.system.boot; -in -{ +in { options.modules.system.boot = { grub.enable = mkEnableOption "Grub, a bloated boot loader"; systemd-boot.enable = mkEnableOption "Poetteringboot"; @@ -31,8 +29,7 @@ in message = "No bootloader is enabled."; } { - assertion = - cfg.systemd-boot.enable -> !cfg.grub.enable && cfg.grub.enable -> !cfg.systemd-boot.enable; + assertion = cfg.systemd-boot.enable -> !cfg.grub.enable && cfg.grub.enable -> !cfg.systemd-boot.enable; message = "Please enable only ONE of systemd-boot or grub."; } ]; @@ -76,11 +73,12 @@ in plymouth = { enable = true; themePackages = [ - (pkgs.adi1090x-plymouth-themes.override { - selected_themes = [ - "hud_3" - ]; - }) + (pkgs.adi1090x-plymouth-themes.override + { + selected_themes = [ + "hud_3" + ]; + }) ]; theme = "hud_3"; }; diff --git a/modules/system/boot/lanzaboote.mod.nix b/modules/system/boot/lanzaboote.mod.nix index 574d89f..38797f0 100644 --- a/modules/system/boot/lanzaboote.mod.nix +++ b/modules/system/boot/lanzaboote.mod.nix @@ -4,14 +4,12 @@ pkgs, sources, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.boot.lanzaboote; -in -{ +in { options.modules.system.boot.lanzaboote.enable = mkEnableOption "Lanzaboote"; imports = [ (sources.lanzaboote + "/nix/modules/lanzaboote.nix") @@ -31,6 +29,6 @@ in loader.systemd-boot.enable = lib.mkForce false; }; - environment.systemPackages = [ pkgs.sbctl ]; + environment.systemPackages = [pkgs.sbctl]; }; } diff --git a/modules/system/hardware/bluetooth.mod.nix b/modules/system/hardware/bluetooth.mod.nix index ff68b93..81a3255 100644 --- a/modules/system/hardware/bluetooth.mod.nix +++ b/modules/system/hardware/bluetooth.mod.nix @@ -3,20 +3,19 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; cfg = config.modules.system.hardware.bluetooth; -in -{ +in { config = mkIf cfg.enable { hardware.bluetooth = { enable = true; inherit (cfg) powerOnBoot; }; environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) bluetuith bluez blueman diff --git a/modules/system/hardware/graphics.mod.nix b/modules/system/hardware/graphics.mod.nix index ffd09ea..25e255e 100644 --- a/modules/system/hardware/graphics.mod.nix +++ b/modules/system/hardware/graphics.mod.nix @@ -2,14 +2,12 @@ config, lib, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.hardware; -in -{ +in { options.modules.system.hardware = { nvidia = { enable = mkEnableOption "Nvidia graphics drivers"; @@ -34,6 +32,6 @@ in package = config.boot.kernelPackages.nvidiaPackages.beta; }; }; - services.xserver.videoDrivers = mkIf cfg.nvidia.enable [ "nvidia" ]; + services.xserver.videoDrivers = mkIf cfg.nvidia.enable ["nvidia"]; }; } diff --git a/modules/system/hardware/intel.mod.nix b/modules/system/hardware/intel.mod.nix index 863d9a3..ba82da7 100644 --- a/modules/system/hardware/intel.mod.nix +++ b/modules/system/hardware/intel.mod.nix @@ -3,20 +3,19 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkDefault mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.system.hardware.intel; -in -{ +in { options.modules.system.hardware.intel.enable = mkEnableOption "Intel Hardware"; config = mkIf cfg.enable { hardware = { cpu.intel.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware; graphics.extraPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) intel-vaapi-driver intel-media-driver ; diff --git a/modules/system/hardware/pipewire.mod.nix b/modules/system/hardware/pipewire.mod.nix index 9a61f76..a18d3de 100644 --- a/modules/system/hardware/pipewire.mod.nix +++ b/modules/system/hardware/pipewire.mod.nix @@ -2,13 +2,11 @@ config, lib, ... -}: -let +}: let inherit (lib.modules) mkIf; cfg = config.modules.system.sound; -in -{ +in { config = mkIf cfg.enable { services.pipewire = { enable = true; diff --git a/modules/system/hardware/power.mod.nix b/modules/system/hardware/power.mod.nix index 9d9c53d..b73dd91 100644 --- a/modules/system/hardware/power.mod.nix +++ b/modules/system/hardware/power.mod.nix @@ -4,24 +4,23 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkDefault; -in -{ +in { imports = [ # (sources.watt + "/nix/module.nix") ]; config = { environment.systemPackages = builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) acpi powertop ; }; boot = { - kernelModules = [ "acpi_call" ]; + kernelModules = ["acpi_call"]; extraModulePackages = with config.boot.kernelPackages; [ acpi_call cpupower diff --git a/modules/system/nix/determinate.mod.nix b/modules/system/nix/determinate.mod.nix index 74b7c72..cab9547 100644 --- a/modules/system/nix/determinate.mod.nix +++ b/modules/system/nix/determinate.mod.nix @@ -4,12 +4,9 @@ pkgs, sources, ... -}: -let - determinate = (import sources.flake-compat { src = sources.determinate; }).outputs; - dix = - (import sources.flake-compat { src = determinate.inputs.nix; }) - .outputs.packages.${pkgs.stdenv.system}.nix; +}: let + determinate = (import sources.flake-compat {src = sources.determinate;}).outputs; + dix = (import sources.flake-compat {src = determinate.inputs.nix;}).outputs.packages.${pkgs.stdenv.system}.nix; # Stronger than mkDefault (1000), weaker than mkForce (50) and the "default override priority" # (100). @@ -17,8 +14,7 @@ let # Stronger than the "default override priority", as the upstream module uses that, and weaker than mkForce (50). mkMorePreferable = lib.mkOverride 75; -in -{ +in { config = { nix = { package = dix; @@ -34,9 +30,7 @@ in services.nix-daemon.serviceConfig = { ExecStart = [ "" - "@${ - determinate.packages.${pkgs.stdenv.system}.default - }/bin/determinate-nixd determinate-nixd --nix-bin ${config.nix.package}/bin daemon" + "@${determinate.packages.${pkgs.stdenv.system}.default}/bin/determinate-nixd determinate-nixd --nix-bin ${config.nix.package}/bin daemon" ]; KillMode = mkPreferable "process"; LimitNOFILE = mkMorePreferable 1048576; @@ -47,14 +41,11 @@ in nix-daemon.socketConfig.FileDescriptorName = "nix-daemon.socket"; determinate-nixd = { description = "Determinate Nixd Daemon Socket"; - wantedBy = [ "sockets.target" ]; - before = [ "multi-user.target" ]; + wantedBy = ["sockets.target"]; + before = ["multi-user.target"]; unitConfig = { - RequiresMountsFor = [ - "/nix/store" - "/nix/var/determinate" - ]; + RequiresMountsFor = ["/nix/store" "/nix/var/determinate"]; }; socketConfig = { diff --git a/modules/system/nix/nix.mod.nix b/modules/system/nix/nix.mod.nix index 4ae7264..8cc3282 100644 --- a/modules/system/nix/nix.mod.nix +++ b/modules/system/nix/nix.mod.nix @@ -5,12 +5,10 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.attrsets) mapAttrsToList; inherit (lib.modules) mkForce; -in -{ +in { nix = { # Check that Nix can parse the generated nix.conf. checkConfig = true; @@ -48,7 +46,7 @@ in # Automatically optimize nix store by removing hard links optimise = { automatic = true; - dates = [ "21:00" ]; + dates = ["21:00"]; }; # NOTE: @@ -64,18 +62,10 @@ in auto-optimise-store = true; # Users that are allowed to connect to the Nix daemon. - allowed-users = [ - "root" - "@wheel" - "nix-builder" - ]; + allowed-users = ["root" "@wheel" "nix-builder"]; # Users that are allowed to connect to the Nix daemon. - trusted-users = [ - "root" - "@wheel" - "nix-builder" - ]; + trusted-users = ["root" "@wheel" "nix-builder"]; # Let the system decide the number of max jobs # based on available system specs. Usually this is diff --git a/modules/system/nix/nixpkgs.mod.nix b/modules/system/nix/nixpkgs.mod.nix index 0f98f70..afff4f5 100644 --- a/modules/system/nix/nixpkgs.mod.nix +++ b/modules/system/nix/nixpkgs.mod.nix @@ -1,6 +1,5 @@ # taken from raf -{ sources, ... }: -{ +{sources, ...}: { # Global nixpkgs configuration. # This is ignored if nixpkgs.pkgs is set, which should be avoided. nixpkgs = { @@ -41,7 +40,7 @@ # List of derivation warnings to display while rebuilding. # See: - showDerivationWarnings = [ ]; + showDerivationWarnings = []; }; }; } diff --git a/modules/system/os/impermanence.mod.nix b/modules/system/os/impermanence.mod.nix index 4125d44..bc778e7 100644 --- a/modules/system/os/impermanence.mod.nix +++ b/modules/system/os/impermanence.mod.nix @@ -4,14 +4,12 @@ lib, sources, ... -}: -let +}: let inherit (lib.modules) mkIf mkForce; inherit (builtins) map; cfg = config.modules.system.impermanence; -in -{ +in { imports = [ (sources.impermanence + "/nixos.nix") ]; @@ -43,36 +41,20 @@ in ]; users.cr = { - directories = [ - "cloud" - "repos" - ] - ++ map (dir: ".config/${dir}") [ - "nicotine" - "Signal" - "Nextcloud" - "emacs" - "doom" - ] - ++ map (dir: ".cache/${dir}") [ - "tealdeer" - "keepassxc" - "nix" - "starship" - "nix-index" - "mozilla" - "zsh" - "nvim" - ] - ++ map (dir: ".local/share/${dir}") [ - "direnv" - "Steam" - "TelegramDesktop" - "PrismLauncher" - "nicotine" - "zoxide" - ".keepass" - ]; + directories = + [ + "cloud" + "repos" + ] + ++ map ( + dir: ".config/${dir}" + ) ["nicotine" "Signal" "Nextcloud" "emacs" "doom"] + ++ map ( + dir: ".cache/${dir}" + ) ["tealdeer" "keepassxc" "nix" "starship" "nix-index" "mozilla" "zsh" "nvim"] + ++ map ( + dir: ".local/share/${dir}" + ) ["direnv" "Steam" "TelegramDesktop" "PrismLauncher" "nicotine" "zoxide" ".keepass"]; }; }; diff --git a/modules/system/os/networking/dns.mod.nix b/modules/system/os/networking/dns.mod.nix index ee19661..c42be83 100644 --- a/modules/system/os/networking/dns.mod.nix +++ b/modules/system/os/networking/dns.mod.nix @@ -3,12 +3,10 @@ lib, pkgs, ... -}: -let +}: let StateDirectory = "dnscrypt-proxy"; inherit (lib.modules) mkForce; -in -{ +in { networking = { networkmanager.dns = mkForce "none"; nameservers = [ diff --git a/modules/system/os/networking/firewall.mod.nix b/modules/system/os/networking/firewall.mod.nix index f016940..a3e1182 100644 --- a/modules/system/os/networking/firewall.mod.nix +++ b/modules/system/os/networking/firewall.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -{ +}: { networking = { # use nftables over iptables nftables.enable = true; diff --git a/modules/system/os/networking/networking.mod.nix b/modules/system/os/networking/networking.mod.nix index 627919c..ee58659 100644 --- a/modules/system/os/networking/networking.mod.nix +++ b/modules/system/os/networking/networking.mod.nix @@ -1,8 +1,6 @@ -{ config, ... }: -let +{config, ...}: let inherit (config.modules.other.system) username; -in -{ +in { networking = { enableIPv6 = true; @@ -42,7 +40,7 @@ in openFirewall = true; }; - users.users.${username}.extraGroups = [ "networkmanager" ]; + users.users.${username}.extraGroups = ["networkmanager"]; # faster boot systemd = { diff --git a/modules/system/os/security/security.mod.nix b/modules/system/os/security/security.mod.nix index 0525506..06e0a7a 100644 --- a/modules/system/os/security/security.mod.nix +++ b/modules/system/os/security/security.mod.nix @@ -1,12 +1,11 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { security = { # Enable Soteria, a GTK-based Polkit authentication agent. soteria.enable = true; apparmor = { enable = true; killUnconfinedConfinables = true; - packages = [ pkgs.apparmor-profiles ]; + packages = [pkgs.apparmor-profiles]; }; pam.services = { diff --git a/modules/system/os/security/sudo.mod.nix b/modules/system/os/security/sudo.mod.nix index 8e4ce07..30b3b2b 100644 --- a/modules/system/os/security/sudo.mod.nix +++ b/modules/system/os/security/sudo.mod.nix @@ -2,18 +2,16 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkForce mkDefault; -in -{ +in { security = { sudo-rs.enable = mkForce false; sudo = { enable = true; # We use the default sudo package, but with insults if we # fail to provide the correct password - package = pkgs.sudo.override { withInsults = true; }; + package = pkgs.sudo.override {withInsults = true;}; # Wheel user should need the password to execute sudo commands wheelNeedsPassword = mkDefault true; diff --git a/modules/system/os/systemd.mod.nix b/modules/system/os/systemd.mod.nix index 2e407a6..d1c15d5 100644 --- a/modules/system/os/systemd.mod.nix +++ b/modules/system/os/systemd.mod.nix @@ -1,13 +1,11 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib.modules) mkForce; -in -{ +in { config.systemd = { # faster startup - targets.network-online.wantedBy = mkForce [ ]; # Normally ["multi-user.target"] + targets.network-online.wantedBy = mkForce []; # Normally ["multi-user.target"] services = { - NetworkManager-wait-online.wantedBy = mkForce [ ]; # Normally ["network-online.target"] + NetworkManager-wait-online.wantedBy = mkForce []; # Normally ["network-online.target"] systemd-udev-settle.enable = false; }; }; diff --git a/modules/system/system.mod.nix b/modules/system/system.mod.nix index 1f4b7cf..3a8451e 100644 --- a/modules/system/system.mod.nix +++ b/modules/system/system.mod.nix @@ -1,8 +1,6 @@ -{ config, ... }: -let +{config, ...}: let machine-id = builtins.substring 0 32 (builtins.hashString "sha256" config.networking.hostName); -in -{ +in { system = { # My state version. stateVersion = "23.11"; diff --git a/modules/wms/niri/niri.mod.nix b/modules/wms/niri/niri.mod.nix index e9a714c..320f273 100644 --- a/modules/wms/niri/niri.mod.nix +++ b/modules/wms/niri/niri.mod.nix @@ -3,8 +3,7 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkForce mkIf; inherit (lib.options) mkEnableOption; inherit (config.modules.system) isGraphical; @@ -28,28 +27,31 @@ let }) ]; }); -in -{ +in { options.modules.desktops.niri.enable = mkEnableOption "Niri, a scolling tiling wayland compositor"; - config = mkIf (cfg.enable || isGraphical) { - programs.niri = { - enable = true; - package = patched-niri; - }; - # The niri module auto enables the gnome keyring, - # which is something I direly want to avoid. - services.gnome.gnome-keyring.enable = mkForce false; + config = + mkIf (cfg.enable + || isGraphical) + { + programs.niri = { + enable = true; + package = patched-niri; + }; + # The niri module auto enables the gnome keyring, + # which is something I direly want to avoid. + services.gnome.gnome-keyring.enable = mkForce false; - environment.etc."niri/config.kdl".source = ./config.kdl; + environment.etc."niri/config.kdl".source = ./config.kdl; - environment.systemPackages = builtins.attrValues { - inherit (pkgs) - xwayland-satellite - avizo - playerctl - wl-clipboard - ; + environment.systemPackages = builtins.attrValues { + inherit + (pkgs) + xwayland-satellite + avizo + playerctl + wl-clipboard + ; + }; }; - }; } diff --git a/modules/wms/portal.mod.nix b/modules/wms/portal.mod.nix index a7c47d9..e37949e 100644 --- a/modules/wms/portal.mod.nix +++ b/modules/wms/portal.mod.nix @@ -3,12 +3,10 @@ lib, pkgs, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.lists) optional; -in -{ +in { xdg.portal = { enable = true; # Sets environment variable NIXOS_XDG_OPEN_USE_PORTAL to 1. @@ -28,7 +26,7 @@ in "org.freedesktop.impl.portal.Secret" = [ "kwallet" ]; - "org.freedesktop.secrets" = [ "kwalletd6" ]; + "org.freedesktop.secrets" = ["kwalletd6"]; }; niri = { default = [ @@ -40,7 +38,7 @@ in # https://docs.flatpak.org/en/latest/portal-api-reference.html # "org.freedesktop.impl.portal.Access" = ["kde"]; # "org.freedesktop.impl.portal.Notification" = ["kde"]; - "org.freedesktop.impl.portal.FileChooser" = [ "kde" ]; + "org.freedesktop.impl.portal.FileChooser" = ["kde"]; }; }; }; diff --git a/modules/wms/variables.mod.nix b/modules/wms/variables.mod.nix index e7aabfc..efcb13a 100644 --- a/modules/wms/variables.mod.nix +++ b/modules/wms/variables.mod.nix @@ -2,14 +2,12 @@ config, lib, ... -}: -let +}: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; cfg = config.modules.wms.wayland; -in -{ +in { options.modules.wms.wayland.enable = mkEnableOption "wayland"; config = mkIf true { environment.variables = { diff --git a/npins/sources.json b/npins/sources.json index 006c756..c8cebe0 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -84,22 +84,6 @@ "url": "https://github.com/nix-community/nh/archive/a90e3124111d9c3eb64e97a5334db09a8e2a4bae.tar.gz", "hash": "sha256-KKaUEg1/ntHVsG61CkKFr2mfdsoK9Nj5FM/W1PBhe5o=" }, - "nixfmt": { - "type": "GitRelease", - "repository": { - "type": "GitHub", - "owner": "nixos", - "repo": "nixfmt" - }, - "pre_releases": false, - "version_upper_bound": null, - "release_prefix": null, - "submodules": false, - "version": "v1.0.0", - "revision": "1f2589cb7198529c6c1eec9699eccd4d507d3600", - "url": "https://api.github.com/repos/nixos/nixfmt/tarball/refs/tags/v1.0.0", - "hash": "sha256-d8SYpFoCpi1GrqlKwxxq9qhyjDANeLgr8WWJNRK6wkc=" - }, "nixpkgs": { "type": "Channel", "name": "nixpkgs-unstable", diff --git a/packages/default.nix b/packages/default.nix index c1ab3bb..5b24cff 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,20 +1,12 @@ { inputs, pkgs, - sources, -}: -let +}: let inherit (pkgs) lib; - helix = pkgs.callPackage ./helix { }; - kakoune = pkgs.callPackage ./kakoune.nix { }; - fish = pkgs.callPackage ./fish { inherit lib; }; - nushell = pkgs.callPackage ./nushell { }; -in -{ - inherit - kakoune - fish - helix - nushell - ; + helix = pkgs.callPackage ./helix {}; + kakoune = pkgs.callPackage ./kakoune.nix {}; + fish = pkgs.callPackage ./fish {inherit lib;}; + nushell = pkgs.callPackage ./nushell {}; +in { + inherit kakoune fish helix nushell; } diff --git a/packages/fish/aliases.nix b/packages/fish/aliases.nix index e200f6c..13bedee 100644 --- a/packages/fish/aliases.nix +++ b/packages/fish/aliases.nix @@ -1,8 +1,6 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let inherit (pkgs.lib) getExe; -in -{ +in { ls = "${getExe pkgs.eza} --icons=never"; la = "${getExe pkgs.eza} --icons=never -lha --git"; diff --git a/packages/fish/default.nix b/packages/fish/default.nix index 8b09cfb..6d0faa6 100644 --- a/packages/fish/default.nix +++ b/packages/fish/default.nix @@ -1,15 +1,14 @@ # This shell setup was originally inspired by sioodmy. # Some further cool tricks, like using vendor_conf.d to avoid having # to build fish myself, are taken from viperml's setup. -{ pkgs, ... }: -let +{pkgs, ...}: let inherit (pkgs) lib; inherit (lib.strings) concatStringsSep; inherit (lib.attrsets) mapAttrsToList; - toml = pkgs.formats.toml { }; + toml = pkgs.formats.toml {}; starship-config = import ./starship.nix; - aliases = import ./aliases.nix { inherit pkgs; }; + aliases = import ./aliases.nix {inherit pkgs;}; vendorConf = "share/fish/vendor_conf.d"; fishinit = import ./fishinit.nix { @@ -20,25 +19,27 @@ let ; }; - aliasesStr = mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases |> concatStringsSep "\n"; + aliasesStr = + mapAttrsToList (k: v: "alias ${k}=\"${v}\"") aliases + |> concatStringsSep "\n"; packages = import ./packages.nix pkgs; in -(pkgs.symlinkJoin { - name = "fish"; - paths = [ pkgs.fish ] ++ packages; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/fish \ - --set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \ - --prefix XDG_DATA_DIRS : "${ - lib.makeSearchPathOutput "out" "share" [ - fishinit - ] - }" - ''; -}).overrideAttrs - (_: { + (pkgs.symlinkJoin { + name = "fish"; + paths = [pkgs.fish] ++ packages; + nativeBuildInputs = [pkgs.makeWrapper]; + postBuild = '' + wrapProgram $out/bin/fish \ + --set STARSHIP_CONFIG "${toml.generate "starship.toml" starship-config}" \ + --prefix XDG_DATA_DIRS : "${ + lib.makeSearchPathOutput "out" "share" [ + fishinit + ] + }" + ''; + }) + .overrideAttrs (_: { passthru = { shellPath = "/bin/fish"; }; diff --git a/packages/fish/fishinit.nix b/packages/fish/fishinit.nix index b818cce..760a08a 100644 --- a/packages/fish/fishinit.nix +++ b/packages/fish/fishinit.nix @@ -4,31 +4,31 @@ vendorConf, }: pkgs.writeTextDir "${vendorConf}/blox_config.fish" - # fish - '' - # source ${pkgs.fishPlugins.sponge}/share/zsh-defer/zsh-defer.plugin.zsh - ${pkgs.atuin}/bin/atuin init fish | source - bind up _atuin_bind_up +# fish +'' + # source ${pkgs.fishPlugins.sponge}/share/zsh-defer/zsh-defer.plugin.zsh + ${pkgs.atuin}/bin/atuin init fish | source + bind up _atuin_bind_up - ${pkgs.zoxide}/bin/zoxide init fish | source - # abbr --erase cd &>/dev/null - # alias cd=__zoxide_z + ${pkgs.zoxide}/bin/zoxide init fish | source + # abbr --erase cd &>/dev/null + # alias cd=__zoxide_z - # abbr --erase ci &>/dev/null - # alias ci=__zoxide_zi + # abbr --erase ci &>/dev/null + # alias ci=__zoxide_zi - ${pkgs.starship}/bin/starship init fish | source - ${pkgs.direnv}/bin/direnv hook fish | source - ${pkgs.pay-respects}/bin/pay-respects fish --alias f --nocnf | source + ${pkgs.starship}/bin/starship init fish | source + ${pkgs.direnv}/bin/direnv hook fish | source + ${pkgs.pay-respects}/bin/pay-respects fish --alias f --nocnf | source - # I need to source /etc/profile using foreign-env, to get stuff set by nixos, e.g. environment.systemVariables. - # set -p fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d + # I need to source /etc/profile using foreign-env, to get stuff set by nixos, e.g. environment.systemVariables. + # set -p fish_function_path ${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d - # fenv source /etc/profile + # fenv source /etc/profile - source ${./config.fish} + source ${./config.fish} - ${aliasesStr} - '' + ${aliasesStr} +'' diff --git a/packages/fish/packages.nix b/packages/fish/packages.nix index 3a3aacb..f4be9ad 100644 --- a/packages/fish/packages.nix +++ b/packages/fish/packages.nix @@ -1,6 +1,7 @@ pkgs: builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) # better cd zoxide # pipe viewer diff --git a/packages/fish/starship.nix b/packages/fish/starship.nix index dec32be..915a0d4 100644 --- a/packages/fish/starship.nix +++ b/packages/fish/starship.nix @@ -14,110 +14,44 @@ docker_context.symbol = " "; elixir.symbol = " "; elm.symbol = " "; - fennel = { - symbol = " "; - }; - fossil_branch = { - symbol = " "; - }; - gcloud = { - symbol = " "; - }; - git_branch = { - symbol = " "; - }; - git_commit = { - tag_symbol = "  "; - }; + fennel = {symbol = " ";}; + fossil_branch = {symbol = " ";}; + gcloud = {symbol = " ";}; + git_branch = {symbol = " ";}; + git_commit = {tag_symbol = "  ";}; golang.symbol = " "; - gradle = { - symbol = " "; - }; - guix_shell = { - symbol = " "; - }; - haskell = { - symbol = " "; - }; - haxe = { - symbol = " "; - }; - hg_branch = { - symbol = " "; - }; - hostname = { - ssh_symbol = " "; - }; - java = { - symbol = " "; - }; - julia = { - symbol = " "; - }; - kotlin = { - symbol = " "; - }; - lua = { - symbol = " "; - }; - memory_usage = { - symbol = "󰍛 "; - }; - meson = { - symbol = "󰔷 "; - }; - nim = { - symbol = "󰆥 "; - }; - nix_shell = { - symbol = " "; - }; - nodejs = { - symbol = " "; - }; - ocaml = { - symbol = " "; - }; + gradle = {symbol = " ";}; + guix_shell = {symbol = " ";}; + haskell = {symbol = " ";}; + haxe = {symbol = " ";}; + hg_branch = {symbol = " ";}; + hostname = {ssh_symbol = " ";}; + java = {symbol = " ";}; + julia = {symbol = " ";}; + kotlin = {symbol = " ";}; + lua = {symbol = " ";}; + memory_usage = {symbol = "󰍛 ";}; + meson = {symbol = "󰔷 ";}; + nim = {symbol = "󰆥 ";}; + nix_shell = {symbol = " ";}; + nodejs = {symbol = " ";}; + ocaml = {symbol = " ";}; os = { symbols = { Linux = " "; NixOS = " "; }; }; - package = { - symbol = "󰏗 "; - }; - perl = { - symbol = " "; - }; - php = { - symbol = " "; - }; - pijul_channel = { - symbol = " "; - }; - pixi = { - symbol = "󰏗 "; - }; - python = { - symbol = " "; - }; - rlang = { - symbol = "󰟔 "; - }; - ruby = { - symbol = " "; - }; - rust = { - symbol = "󱘗 "; - }; - scala = { - symbol = " "; - }; - swift = { - symbol = " "; - }; - zig = { - symbol = " "; - }; + package = {symbol = "󰏗 ";}; + perl = {symbol = " ";}; + php = {symbol = " ";}; + pijul_channel = {symbol = " ";}; + pixi = {symbol = "󰏗 ";}; + python = {symbol = " ";}; + rlang = {symbol = "󰟔 ";}; + ruby = {symbol = " ";}; + rust = {symbol = "󱘗 ";}; + scala = {symbol = " ";}; + swift = {symbol = " ";}; + zig = {symbol = " ";}; } diff --git a/packages/helix/colorscheme.nix b/packages/helix/colorscheme.nix index 4aa1f86..b90f7c4 100644 --- a/packages/helix/colorscheme.nix +++ b/packages/helix/colorscheme.nix @@ -1,4 +1,4 @@ { inherits = "gruvbox_dark_hard"; - "ui.background" = { }; + "ui.background" = {}; } diff --git a/packages/helix/default.nix b/packages/helix/default.nix index 2409a1c..4be0954 100644 --- a/packages/helix/default.nix +++ b/packages/helix/default.nix @@ -1,5 +1,5 @@ { - sources, + alejandra, basedpyright, bash-language-server, callPackage, @@ -38,12 +38,12 @@ vscode-langservers-extracted, zls, ... -}: -let +}: let inherit (lib.meta) getExe; - custom-helix = helix.overrideAttrs ( - finalAttrs: previousAttrs: { + custom-helix = + helix.overrideAttrs + (finalAttrs: previousAttrs: { version = "25.07.2"; src = fetchzip { url = "https://github.com/bloxx12/helix/releases/download/${finalAttrs.version}/helix-${finalAttrs.version}-source.tar.xz"; @@ -57,12 +57,11 @@ let inherit (custom-helix) src; hash = "sha256-3poZSvIrkx8lguxxDeNfngW6+4hH8TV/LHcZx5W5aXg="; }; - } - ); + }); - toml = formats.toml { }; + toml = formats.toml {}; - helix-languages = callPackage ./languages.nix { inherit lib sources; }; + helix-languages = callPackage ./languages.nix {inherit lib;}; colorscheme = toml.generate "colorscheme.toml" (import ./colorscheme.nix); helix-config = { @@ -98,25 +97,10 @@ let select = "underline"; }; statusline = { - left = [ - "spinner" - "version-control" - "diagnostics" - "file-name" - ]; - right = [ - "file-base-name" - "file-type" - "position" - "file-encoding" - ]; + left = ["spinner" "version-control" "diagnostics" "file-name"]; + right = ["file-base-name" "file-type" "position" "file-encoding"]; }; - gutters.layout = [ - "diff" - "diagnostics" - "line-numbers" - "spacer" - ]; + gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"]; inline-diagnostics = { cursor-line = "hint"; other-lines = "error"; @@ -125,29 +109,17 @@ let keys = { normal = { space = { - g = [ - ":new" - ":insert-output XDG_CONFIG_HOME=~/.config ${getExe lazygit}" - ":buffer-close!" - ":redraw" - ]; + g = [":new" ":insert-output XDG_CONFIG_HOME=~/.config ${getExe lazygit}" ":buffer-close!" ":redraw"]; i = ":toggle lsp.display-inlay-hints"; }; - esc = [ - "collapse_selection" - "keep_primary_selection" - "normal_mode" - ]; + esc = ["collapse_selection" "keep_primary_selection" "normal_mode"]; A-H = "goto_previous_buffer"; A-L = "goto_next_buffer"; A-w = ":buffer-close"; A-f = ":format"; A-r = ":reload"; A-x = "extend_to_line_bounds"; - X = [ - "extend_line_up" - "extend_to_line_bounds" - ]; + X = ["extend_line_up" "extend_to_line_bounds"]; ";" = "flip_selections"; "A-;" = "collapse_selection"; @@ -159,13 +131,8 @@ let }; select = { A-x = "extend_to_line_bounds"; - X = [ - "extend_line_up" - "extend_to_line_bounds" - ]; - g = { - e = "goto_file_end"; - }; + X = ["extend_line_up" "extend_to_line_bounds"]; + g = {e = "goto_file_end";}; }; }; }; @@ -206,7 +173,7 @@ let # zig language server zls ]; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [makeWrapper]; postBuild = '' mkdir -p $out/config/helix/themes cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml @@ -217,4 +184,4 @@ let ''; }; in -wrapped-helix + wrapped-helix diff --git a/packages/helix/languages.nix b/packages/helix/languages.nix index 00b457f..1f45c96 100644 --- a/packages/helix/languages.nix +++ b/packages/helix/languages.nix @@ -1,34 +1,30 @@ { - sources, + fetchFromGitHub, + rustPlatform, + alejandra, basedpyright, bash-language-server, - callPackage, clang-tools, cmake-format, cmake-language-server, deadnix, deno, dprint, - fetchFromGitHub, formats, gdb, kdePackages, lib, nil, ruff, - rustPlatform, shfmt, typescript-language-server, vscode-langservers-extracted, zls, ... -}: -let +}: let inherit (lib.meta) getExe getExe'; - toml = formats.toml { }; - - nixfmt = callPackage "${sources.nixfmt}/default.nix" { }; + toml = formats.toml {}; # a newer nil version, for pipes support. new-nil = nil.overrideAttrs (_: { @@ -49,157 +45,129 @@ let }; }); - new-deadnix = deadnix.overrideAttrs ( - finalAttrs: previousAttrs: { - version = "unstable-15-07-2025"; - src = fetchFromGitHub { - owner = "astro"; - repo = "deadnix"; - rev = "d75457b95d7cfa82fcd60970939f76fccfce19e5"; - hash = "sha256-O/z2neAXL8JNkGosvxC+DyZnnJ8zYP9XHApxHVmlzfY="; - }; + new-deadnix = deadnix.overrideAttrs (finalAttrs: previousAttrs: { + version = "unstable-15-07-2025"; + src = fetchFromGitHub { + owner = "astro"; + repo = "deadnix"; + rev = "d75457b95d7cfa82fcd60970939f76fccfce19e5"; + hash = "sha256-O/z2neAXL8JNkGosvxC+DyZnnJ8zYP9XHApxHVmlzfY="; + }; - doInstallCheck = false; + doInstallCheck = false; - cargoDeps = rustPlatform.fetchCargoVendor { - inherit (new-deadnix) src; - hash = "sha256-O8yhqyPflOvQXAA19k1XpbrHysgV5VNWLBX0l5Q5GkM="; - }; - } - ); + cargoDeps = rustPlatform.fetchCargoVendor { + inherit (new-deadnix) src; + hash = "sha256-O8yhqyPflOvQXAA19k1XpbrHysgV5VNWLBX0l5Q5GkM="; + }; + }); helix-languages = { - language = - let - mark = lang: { - command = getExe deno; - args = [ - "fmt" - "-" - "--ext" - lang + language = let + mark = lang: { + command = getExe deno; + args = ["fmt" "-" "--ext" lang]; + }; + in [ + { + name = "bash"; + auto-format = true; + formatter = { + command = getExe shfmt; + args = ["-i" "2"]; + }; + } + { + name = "clojure"; + injection-regex = "(clojure|clj|edn|boot|yuck)"; + file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"]; + } + { + name = "cmake"; + auto-format = true; + language-servers = ["cmake-language-server"]; + formatter = { + command = getExe cmake-format; + args = ["-"]; + }; + } + { + name = "javascript"; + auto-format = true; + language-servers = ["dprint" "typescript-language-server"]; + } + { + name = "json"; + formatter = mark "json"; + } + { + name = "markdown"; + auto-format = true; + formatter = mark "md"; + language-servers = ["taplo"]; + } + { + name = "nix"; + language-servers = ["nil"]; + } + { + name = "qml"; + language-servers = ["qmlls"]; + } + { + name = "python"; + auto-format = true; + language-servers = [ + "basedpyright" + "ruff" + ]; + } + { + name = "typescript"; + auto-format = true; + language-servers = ["dprint" "typescript-language-server"]; + } + { + name = "rust"; + } + { + name = "c"; + auto-format = true; + language-servers = ["clangd"]; + } + { + name = "zig"; + auto-format = true; + } + { + name = "c"; + debugger = { + name = "gdb"; + command = getExe gdb; + transport = "stdio"; + templates = [ + { + name = "binary"; + request = "launch"; + completion = [ + { + name = "binary"; + completion = "filename"; + } + ]; + args = { + program = "{0}"; + runInTerminal = true; + }; + } ]; }; - in - [ - { - name = "bash"; - auto-format = true; - formatter = { - command = getExe shfmt; - args = [ - "-i" - "2" - ]; - }; - } - { - name = "clojure"; - injection-regex = "(clojure|clj|edn|boot|yuck)"; - file-types = [ - "clj" - "cljs" - "cljc" - "clje" - "cljr" - "cljx" - "edn" - "boot" - "yuck" - ]; - } - { - name = "cmake"; - auto-format = true; - language-servers = [ "cmake-language-server" ]; - formatter = { - command = getExe cmake-format; - args = [ "-" ]; - }; - } - { - name = "javascript"; - auto-format = true; - language-servers = [ - "dprint" - "typescript-language-server" - ]; - } - { - name = "json"; - formatter = mark "json"; - } - { - name = "markdown"; - auto-format = true; - formatter = mark "md"; - language-servers = [ "taplo" ]; - } - { - name = "nix"; - language-servers = [ "nil" ]; - } - { - name = "qml"; - language-servers = [ "qmlls" ]; - } - { - name = "python"; - auto-format = true; - language-servers = [ - "basedpyright" - "ruff" - ]; - } - { - name = "typescript"; - auto-format = true; - language-servers = [ - "dprint" - "typescript-language-server" - ]; - } - { - name = "rust"; - } - { - name = "c"; - auto-format = true; - language-servers = [ "clangd" ]; - } - { - name = "zig"; - auto-format = true; - } - { - name = "c"; - debugger = { - name = "gdb"; - command = getExe gdb; - transport = "stdio"; - templates = [ - { - name = "binary"; - request = "launch"; - completion = [ - { - name = "binary"; - completion = "filename"; - } - ]; - args = { - program = "{0}"; - runInTerminal = true; - }; - } - ]; - }; - } - ]; + } + ]; language-server = { bash-language-server = { command = getExe bash-language-server; - args = [ "start" ]; + args = ["start"]; }; rust-analyzer = { @@ -215,15 +183,7 @@ let }; check = { command = "clippy"; - extraArgs = [ - "--" - "-W" - "clippy::pedantic" - "-W" - "clippy::nursery" - "-W" - "clippy::perf" - ]; + extraArgs = ["--" "-W" "clippy::pedantic" "-W" "clippy::nursery" "-W" "clippy::perf"]; }; lens = { references = true; @@ -237,7 +197,7 @@ let clangd = { command = "${clang-tools}/bin/clangd"; - clangd.fallbackFlags = [ "-std=c++2b" ]; + clangd.fallbackFlags = ["-std=c++2b"]; }; cmake-language-server = { @@ -246,7 +206,7 @@ let deno-lsp = { command = getExe deno; - args = [ "lsp" ]; + args = ["lsp"]; environment.NO_COLOR = "1"; config.deno = { enable = true; @@ -254,9 +214,7 @@ let unstable = true; suggest = { completeFunctionCalls = false; - imports = { - hosts."https://deno.land" = true; - }; + imports = {hosts."https://deno.land" = true;}; }; inlayHints = { enumMemberValues.enabled = true; @@ -270,13 +228,14 @@ let }; dprint = { command = getExe dprint; - args = [ "lsp" ]; + args = ["lsp"]; }; nil = { command = getExe new-nil; + # alejandro config.nil = { - formatting.command = [ "${getExe nixfmt}" ]; + formatting.command = ["${getExe alejandra}" "-q"]; diagnostics = { bindingEndHintMinLines = 3; }; @@ -293,7 +252,7 @@ let typescript-language-server = { command = getExe typescript-language-server; - args = [ "--stdio" ]; + args = ["--stdio"]; config = { typescript-language-server.source = { addMissingImports.ts = true; @@ -306,18 +265,18 @@ let }; ruff = { command = getExe ruff; - args = [ "server" ]; + args = ["server"]; }; qmlls = { command = getExe' kdePackages.qtdeclarative "qmlls"; - args = [ "-E" ]; + args = ["-E"]; }; basedpyright.command = "${basedpyright}/bin/basedpyright-langserver"; vscode-css-language-server = { command = "${vscode-langservers-extracted}/bin/vscode-css-language-server"; - args = [ "--stdio" ]; + args = ["--stdio"]; config = { provideFormatter = true; css.validate.enable = true; @@ -328,11 +287,7 @@ let command = getExe zls; config = { enable_build_on_save = true; - build_on_save_args = [ - "check" - "-fincremental" - "--watch" - ]; + build_on_save_args = ["check" "-fincremental" "--watch"]; enable_autofix = false; warn_style = true; highlight_global_var_declarations = true; @@ -341,4 +296,4 @@ let }; }; in -toml.generate "languages.toml" helix-languages + toml.generate "languages.toml" helix-languages diff --git a/packages/kakoune.nix b/packages/kakoune.nix index 73fde0b..aa51912 100644 --- a/packages/kakoune.nix +++ b/packages/kakoune.nix @@ -5,8 +5,7 @@ symlinkJoin, kakounePlugins, ... -}: -let +}: let custom-kakoune = stdenv.mkDerivation { name = "custom-kakoune"; src = fetchFromGitHub { @@ -16,10 +15,7 @@ let hash = "sha256-+xqJrJr6nnmEpQaizQ3JMDEISCD8IMB84NJZiXJ74kY="; }; - makeFlags = [ - "debug=no" - "PREFIX=${placeholder "out"}" - ]; + makeFlags = ["debug=no" "PREFIX=${placeholder "out"}"]; enableParallellBuilding = true; @@ -36,13 +32,13 @@ let ''; }; plugins = builtins.attrValues { - inherit (kakounePlugins) ; + inherit (kakounePlugins); }; kakoune-wrapped = symlinkJoin { name = "kakoune-wrapped"; - nativeBuildInputs = [ makeWrapper ]; - paths = [ custom-kakoune ] ++ plugins; + nativeBuildInputs = [makeWrapper]; + paths = [custom-kakoune] ++ plugins; postBuild = '' # create a directory for bins that kakoune needs @@ -66,4 +62,4 @@ let ''; }; in -kakoune-wrapped + kakoune-wrapped diff --git a/packages/nushell/default.nix b/packages/nushell/default.nix index d01a589..b8e29b7 100644 --- a/packages/nushell/default.nix +++ b/packages/nushell/default.nix @@ -1,45 +1,44 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let inherit (pkgs) lib; inherit (lib.meta) getExe; nu-config = pkgs.writeText "nu-init" - # nu - '' - #!/usr/bin/env nu - source ${./config.nu} - source ${./prompt.nu} + # nu + '' + #!/usr/bin/env nu + source ${./config.nu} + source ${./prompt.nu} - let autoload_dir = $nu.user-autoload-dirs.0 - mkdir $autoload_dir + let autoload_dir = $nu.user-autoload-dirs.0 + mkdir $autoload_dir - let zoxide_path = $autoload_dir | path join zoxide.nu - if not ($zoxide_path | path exists) { - ${getExe pkgs.zoxide} init nushell --cmd cd | save -f $zoxide_path - } - # Atuin is too slow, sadly. - # let atuin_path = $autoload_dir | path join atuin.nu - # if not ($atuin_path | path exists) { - # ${getExe pkgs.atuin} init nu | save -f $atuin_path - # } - let carapace_path = $autoload_dir | path join carapace.nu - if not ($carapace_path | path exists) { - ${getExe pkgs.carapace} _carapace nushell | save -f $carapace_path - } - ''; + let zoxide_path = $autoload_dir | path join zoxide.nu + if not ($zoxide_path | path exists) { + ${getExe pkgs.zoxide} init nushell --cmd cd | save -f $zoxide_path + } + # Atuin is too slow, sadly. + # let atuin_path = $autoload_dir | path join atuin.nu + # if not ($atuin_path | path exists) { + # ${getExe pkgs.atuin} init nu | save -f $atuin_path + # } + let carapace_path = $autoload_dir | path join carapace.nu + if not ($carapace_path | path exists) { + ${getExe pkgs.carapace} _carapace nushell | save -f $carapace_path + } + ''; packages = import ./packages.nix pkgs; in -(pkgs.symlinkJoin { - name = "nushell"; - paths = [ pkgs.nushell ] ++ packages; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/nu --add-flags "\ - --config ${nu-config}" - ''; -}).overrideAttrs - (_: { + (pkgs.symlinkJoin { + name = "nushell"; + paths = [pkgs.nushell] ++ packages; + nativeBuildInputs = [pkgs.makeWrapper]; + postBuild = '' + wrapProgram $out/bin/nu --add-flags "\ + --config ${nu-config}" + ''; + }) + .overrideAttrs (_: { passthru = { shellPath = "/bin/nu"; }; diff --git a/packages/nushell/packages.nix b/packages/nushell/packages.nix index cea8418..3732db4 100644 --- a/packages/nushell/packages.nix +++ b/packages/nushell/packages.nix @@ -1,6 +1,7 @@ pkgs: builtins.attrValues { - inherit (pkgs) + inherit + (pkgs) # better cd zoxide # pipe viewer diff --git a/templates/rust/default.nix b/templates/rust/default.nix index 3d6c889..69ea5e5 100644 --- a/templates/rust/default.nix +++ b/templates/rust/default.nix @@ -1,4 +1,4 @@ -{ rustPlatform }: +{rustPlatform}: rustPlatform.buildRustPackage { pname = "some-rust-package"; version = "0.0.1"; diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index c535237..738ae57 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -5,22 +5,20 @@ systems.url = "github:nix-systems/default-linux"; }; - outputs = - inputs: - let - inherit (inputs.nixpkgs) lib; - inherit (lib.attrsets) genAttrs mapAttrs; + outputs = inputs: let + inherit (inputs.nixpkgs) lib; + inherit (lib.attrsets) genAttrs mapAttrs; - eachSystem = genAttrs (import inputs.systems); - pkgsFor = inputs.nixpkgs.legacyPackages; - in - { - packages = eachSystem (system: { - default = inputs.self.packages.${system}.ralc; - ralc = pkgsFor.${system}.callPackage ./nix/package.nix { }; - }); + eachSystem = genAttrs (import inputs.systems); + pkgsFor = inputs.nixpkgs.legacyPackages; + in { + packages = eachSystem (system: { + default = inputs.self.packages.${system}.ralc; + ralc = pkgsFor.${system}.callPackage ./nix/package.nix {}; + }); - devShells = mapAttrs (system: pkgs: { + devShells = + mapAttrs (system: pkgs: { default = pkgs.mkShell { packages = with pkgs; [ cargo @@ -31,6 +29,7 @@ rustPackages.clippy ]; }; - }) pkgsFor; - }; + }) + pkgsFor; + }; }