diff options
author | Ben Sima <ben@bsima.me> | 2025-01-02 16:20:21 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2025-01-02 16:20:21 -0500 |
commit | 0fb4ae72c5754761fd7666e4274f4beef0484c32 (patch) | |
tree | d8820c808f31f287c3fcc266c02e3a26ddcdfbc3 /Omni/Dev | |
parent | 3790d334c994db7a0e1eac9c130c2b1316c78c35 (diff) |
Switch to alejandra for nix formatting
I mostly wanted a formatter that would format `inherit` blocks
vertically, because otherwise they are super hard to read when diffing
or even just editing. Both alejandra and the new nixos/nixfmt format
verically like this, but alejandra has slightly better format (I guess)
and for some reason nixfmt did not respect my `GLOBIGNORE` setting when
doing `nixfmt **/*.nix` so it was trying to format stuff in `_/nix`, and
failed. So anyway I went with alejandra.
- https://github.com/kamadorueda/alejandra
- https://discourse.nixos.org/t/enforcing-nix-formatting-in-nixpkgs/49506
Diffstat (limited to 'Omni/Dev')
-rw-r--r-- | Omni/Dev/Beryllium.nix | 2 | ||||
-rw-r--r-- | Omni/Dev/Beryllium/Configuration.nix | 17 | ||||
-rw-r--r-- | Omni/Dev/Beryllium/Hardware.nix | 20 | ||||
-rw-r--r-- | Omni/Dev/Beryllium/Ollama.nix | 29 | ||||
-rw-r--r-- | Omni/Dev/Dns.nix | 9 | ||||
-rw-r--r-- | Omni/Dev/Guix.nix | 24 | ||||
-rw-r--r-- | Omni/Dev/Hoogle.nix | 26 | ||||
-rw-r--r-- | Omni/Dev/Lithium.nix | 3 | ||||
-rw-r--r-- | Omni/Dev/Lithium/Configuration.nix | 30 | ||||
-rw-r--r-- | Omni/Dev/Lithium/Hardware.nix | 17 | ||||
-rw-r--r-- | Omni/Dev/Networking.nix | 16 | ||||
-rw-r--r-- | Omni/Dev/Vpn.nix | 13 |
12 files changed, 97 insertions, 109 deletions
diff --git a/Omni/Dev/Beryllium.nix b/Omni/Dev/Beryllium.nix index b9fe363..8452d1e 100644 --- a/Omni/Dev/Beryllium.nix +++ b/Omni/Dev/Beryllium.nix @@ -1,4 +1,4 @@ -{ bild }: +{bild}: bild.os { imports = [ ../Os/Base.nix diff --git a/Omni/Dev/Beryllium/Configuration.nix b/Omni/Dev/Beryllium/Configuration.nix index 16f4bca..69c83a6 100644 --- a/Omni/Dev/Beryllium/Configuration.nix +++ b/Omni/Dev/Beryllium/Configuration.nix @@ -1,8 +1,8 @@ -{ pkgs, ... }: - -let ports = import ../../Cloud/Ports.nix; +{pkgs, ...}: let + ports = import ../../Cloud/Ports.nix; in { - imports = [ # Include the results of the hardware scan. + imports = [ + # Include the results of the hardware scan. ./Hardware.nix ]; @@ -10,8 +10,8 @@ in { boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - boot.kernelModules = [ "v4l2loopback" ]; - boot.extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ]; + boot.kernelModules = ["v4l2loopback"]; + boot.extraModulePackages = [pkgs.linuxPackages.v4l2loopback]; # Enable networking networking.networkmanager.enable = true; @@ -68,7 +68,7 @@ in { hardware.opengl.enable = true; hardware.opengl.driSupport32Bit = true; - services.xserver.videoDrivers = [ "nvidia" ]; + services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia.nvidiaPersistenced = true; hardware.nvidia.modesetting.enable = true; hardware.nvidia.powerManagement.enable = false; @@ -103,7 +103,7 @@ in { systemd.services.NetworkManager-wait-online.enable = false; - networking.firewall.allowedTCPPorts = [ ports.barrier ]; + networking.firewall.allowedTCPPorts = [ports.barrier]; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave @@ -111,5 +111,4 @@ in { # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.05"; # Did you read the comment? - } diff --git a/Omni/Dev/Beryllium/Hardware.nix b/Omni/Dev/Beryllium/Hardware.nix index ecf425c..5a8b583 100644 --- a/Omni/Dev/Beryllium/Hardware.nix +++ b/Omni/Dev/Beryllium/Hardware.nix @@ -1,16 +1,18 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + config, + lib, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/f96eaa16-d0e2-4230-aece-131ce7b630da"; @@ -22,7 +24,7 @@ fsType = "vfat"; }; - 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/Omni/Dev/Beryllium/Ollama.nix b/Omni/Dev/Beryllium/Ollama.nix index 35b4fe1..0018f49 100644 --- a/Omni/Dev/Beryllium/Ollama.nix +++ b/Omni/Dev/Beryllium/Ollama.nix @@ -1,19 +1,20 @@ -{ pkgs, ... }: -/* Ollama API service +{pkgs, ...}: +/* +Ollama API service - Don't put too much work into this, there's a much better and more complete - ollama service (with webui!) being built here: - https://github.com/NixOS/nixpkgs/pull/275448 +Don't put too much work into this, there's a much better and more complete +ollama service (with webui!) being built here: +https://github.com/NixOS/nixpkgs/pull/275448 - If you want to spend time on it, spend time over there. +If you want to spend time on it, spend time over there. */ -let pkg = pkgs.unstable.ollama; +let + pkg = pkgs.unstable.ollama; in { - systemd.services.ollama = { description = "ollama"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; + after = ["network.target"]; + wantedBy = ["multi-user.target"]; environment = { OLLAMA_HOST = "localhost:11434"; @@ -31,18 +32,18 @@ in { Restart = "on-failure"; RestartSec = 3; # Persistent storage for model files, i.e. /var/lib/<StateDirectory> - StateDirectory = [ "ollama" ]; + StateDirectory = ["ollama"]; }; }; # for administration, make this available to users' PATH - environment.systemPackages = [ pkg ]; + environment.systemPackages = [pkg]; - users.groups.ollama = { }; + users.groups.ollama = {}; users.users.ollama = { group = "ollama"; isSystemUser = true; - extraGroups = [ "render" "video" ]; + extraGroups = ["render" "video"]; }; } diff --git a/Omni/Dev/Dns.nix b/Omni/Dev/Dns.nix index baf79aa..e42b10a 100644 --- a/Omni/Dev/Dns.nix +++ b/Omni/Dev/Dns.nix @@ -1,10 +1,8 @@ -{ ... }: - -{ +{...}: { services.bind = { enable = true; - forwarders = [ "8.8.8.8" "1.1.1.1" ]; - cacheNetworks = [ "127.0.0.0/8" "192.168.0.0/24" ]; + forwarders = ["8.8.8.8" "1.1.1.1"]; + cacheNetworks = ["127.0.0.0/8" "192.168.0.0/24"]; extraConfig = ""; extraOptions = '' dnssec-validation auto; @@ -15,5 +13,4 @@ # 192.168.0.1 router.home # 192.168.0.196 lithium.home #''; - } diff --git a/Omni/Dev/Guix.nix b/Omni/Dev/Guix.nix index 0b261fb..837e5f2 100644 --- a/Omni/Dev/Guix.nix +++ b/Omni/Dev/Guix.nix @@ -1,13 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cfg = config.services.guix; - in { - options.services.guix = { enable = mkEnableOption "GNU Guix package manager"; }; @@ -16,12 +15,11 @@ in { systemd.services.guix-daemon = { description = "Build daemon for GNU Guix"; - wantedBy = [ "multi-user.target" ]; + wantedBy = ["multi-user.target"]; serviceConfig = { Restart = "always"; - ExecStart = - "${pkgs.guix}/bin/guix-daemon --build-users-group=guixbuild"; + ExecStart = "${pkgs.guix}/bin/guix-daemon --build-users-group=guixbuild"; Environment = null; RemainAfterExit = "yes"; StandardOutput = "syslog"; @@ -33,11 +31,11 @@ in { extraUsers = lib.attrs.genAttrs (lib.lists.range 1 10) (n: { name = "guixbuilder${n}"; isSystemUser = true; - extraGroups = [ "guixbuild" ]; + extraGroups = ["guixbuild"]; group = "guixbuild"; description = "Guix build user ${n}"; }); - extraGroups = { "guixbuild" = { }; }; + extraGroups = {"guixbuild" = {};}; }; }; } diff --git a/Omni/Dev/Hoogle.nix b/Omni/Dev/Hoogle.nix index 213a31c..1a4ab51 100644 --- a/Omni/Dev/Hoogle.nix +++ b/Omni/Dev/Hoogle.nix @@ -1,18 +1,17 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - +{ + config, + lib, + pkgs, + ... +}: +with lib; let cfg = config.services.my-hoogle; hoogleEnv = pkgs.buildEnv { name = "hoogle"; - paths = [ (cfg.haskellPackages.ghcWithHoogle cfg.packages) ]; + paths = [(cfg.haskellPackages.ghcWithHoogle cfg.packages)]; }; - in { - options.services.my-hoogle = { enable = mkEnableOption "Haskell documentation server"; @@ -25,7 +24,7 @@ in { }; packages = mkOption { - default = _hp: [ ]; + default = _hp: []; defaultText = "hp: []"; example = "hp: with hp; [ text lens ]"; description = '' @@ -60,13 +59,13 @@ in { systemd.services.hoogle = { description = "Haskell documentation server"; - wantedBy = [ "multi-user.target" ]; + wantedBy = ["multi-user.target"]; serviceConfig = { Restart = "always"; ExecStart = "${hoogleEnv}/bin/hoogle server --local --port ${ - toString cfg.port - } --home ${cfg.home} --host ${cfg.host}"; + toString cfg.port + } --home ${cfg.home} --host ${cfg.host}"; DynamicUser = true; @@ -77,5 +76,4 @@ in { }; }; }; - } diff --git a/Omni/Dev/Lithium.nix b/Omni/Dev/Lithium.nix index 9eb8304..72a841f 100644 --- a/Omni/Dev/Lithium.nix +++ b/Omni/Dev/Lithium.nix @@ -1,6 +1,5 @@ -{ bild }: +{bild}: # Dev machine for work and building stuff. - bild.os { imports = [ ../Os/Base.nix diff --git a/Omni/Dev/Lithium/Configuration.nix b/Omni/Dev/Lithium/Configuration.nix index 91b7f59..e050d48 100644 --- a/Omni/Dev/Lithium/Configuration.nix +++ b/Omni/Dev/Lithium/Configuration.nix @@ -1,6 +1,8 @@ -{ lib, pkgs, ... }: - -let +{ + lib, + pkgs, + ... +}: let ghcCompiler = (import ../../Bild/Constants.nix).ghcCompiler; ports = import ../../Cloud/Ports.nix; in { @@ -24,8 +26,7 @@ in { fira-code-symbols ]; - environment.systemPackages = - [ pkgs.nvtop pkgs.k3s pkgs.wemux pkgs.tmux pkgs.wireguard-tools ]; + environment.systemPackages = [pkgs.nvtop pkgs.k3s pkgs.wemux pkgs.tmux pkgs.wireguard-tools]; hardware.opengl.enable = true; @@ -68,13 +69,11 @@ in { services.tor.settings.Nickname = "ydeee3q1cjo83tsuqcz"; services.tor.settings.AccountingMax = "10 GBytes"; services.tor.settings.AccountingStart = "month 1 1:00"; - services.tor.settings.ContactInfo = - "ContactInfo pgp:66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD ciissversion:2"; + services.tor.settings.ContactInfo = "ContactInfo pgp:66A6AD150399D970DCA4C4E6C8218B7D0BFDECCD ciissversion:2"; services.bitcoind.mainnet.enable = true; services.bitcoind.mainnet.dataDir = "/mnt/campbell/bitcoind-mainnet/data"; - services.bitcoind.mainnet.configFile = - "/mnt/campbell/bitcoind-mainnet/bitcoin.conf"; + services.bitcoind.mainnet.configFile = "/mnt/campbell/bitcoind-mainnet/bitcoin.conf"; services.bitcoind.mainnet.prune = 10000; services.pcscd.enable = true; @@ -118,18 +117,17 @@ in { services.xserver.windowManager.xmonad.enable = true; services.xserver.libinput.enable = true; services.xserver.libinput.touchpad.tapping = true; - services.xserver.modules = [ pkgs.xf86_input_wacom ]; + services.xserver.modules = [pkgs.xf86_input_wacom]; services.xserver.wacom.enable = true; services.jupyter.enable = true; services.jupyter.port = ports.jupyter; services.jupyter.ip = "*"; users.users.jupyter.group = "jupyter"; - users.groups.jupyter = { }; - services.jupyter.password = - "'argon2:$argon2id$v=19$m=10240,t=10,p=8$nvQhgk+htbIYi961YYAf1w$ekpwiTT5L4+OAods0K7EDw'"; + users.groups.jupyter = {}; + services.jupyter.password = "'argon2:$argon2id$v=19$m=10240,t=10,p=8$nvQhgk+htbIYi961YYAf1w$ekpwiTT5L4+OAods0K7EDw'"; services.jupyter.kernels.python3 = let - env = (pkgs.python3.withPackages (p: + env = pkgs.python3.withPackages (p: with p; [ ipykernel pandas @@ -138,7 +136,7 @@ in { matplotlib sympy ipywidgets - ])); + ]); in { displayName = "py3"; argv = [ @@ -193,7 +191,7 @@ in { (lib.strings.splitString "\n") (lib.filter (s: s != "")) ]; - nix.settings.trusted-users = [ "root" "ben" ]; + nix.settings.trusted-users = ["root" "ben"]; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database diff --git a/Omni/Dev/Lithium/Hardware.nix b/Omni/Dev/Lithium/Hardware.nix index 54c07f5..80d4e54 100644 --- a/Omni/Dev/Lithium/Hardware.nix +++ b/Omni/Dev/Lithium/Hardware.nix @@ -1,15 +1,16 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ lib, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + lib, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/f08dd8f9-787c-4e2a-a0cc-7019edc2ce2b"; @@ -26,7 +27,7 @@ fsType = "ext4"; }; - swapDevices = [ ]; + swapDevices = []; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; } diff --git a/Omni/Dev/Networking.nix b/Omni/Dev/Networking.nix index c89add7..f7ea6e3 100644 --- a/Omni/Dev/Networking.nix +++ b/Omni/Dev/Networking.nix @@ -1,11 +1,10 @@ -{ ... }: - -let ports = import ../Cloud/Ports.nix; +{...}: let + ports = import ../Cloud/Ports.nix; in { networking = { - nameservers = [ "1.1.1.1" ]; + nameservers = ["1.1.1.1"]; hostName = "lithium"; - hosts = { "::1" = [ "localhost" "ipv6-localhost" "ipv6-loopback" ]; }; + hosts = {"::1" = ["localhost" "ipv6-localhost" "ipv6-loopback"];}; firewall = { allowedTCPPorts = [ @@ -29,9 +28,9 @@ in { ports.stableDiffusion ports.tor ]; - allowedTCPPortRanges = [ ports.torrents ports.httpdev ]; - allowedUDPPorts = [ ports.dns ports.et ports.murmur ]; - allowedUDPPortRanges = [ ports.torrents ]; + allowedTCPPortRanges = [ports.torrents ports.httpdev]; + allowedUDPPorts = [ports.dns ports.et ports.murmur]; + allowedUDPPortRanges = [ports.torrents]; }; # The global useDHCP flag is deprecated, therefore explicitly set to false here. @@ -40,5 +39,4 @@ in { useDHCP = false; interfaces.enp2s0.useDHCP = true; }; - } diff --git a/Omni/Dev/Vpn.nix b/Omni/Dev/Vpn.nix index 9b791b7..a8a1f3c 100644 --- a/Omni/Dev/Vpn.nix +++ b/Omni/Dev/Vpn.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -let +{config, ...}: let ports = import ../Cloud/Ports.nix; domain = "headscale.simatime.com"; in { @@ -8,7 +6,7 @@ in { enable = true; address = "0.0.0.0"; port = ports.headscale; - settings = { dns.base_domain = "simatime.com"; }; + settings = {dns.base_domain = "simatime.com";}; }; services.nginx.virtualHosts.${domain} = { @@ -20,14 +18,13 @@ in { }; }; - environment.systemPackages = [ config.services.headscale.package ]; + environment.systemPackages = [config.services.headscale.package]; services.tailscale.enable = true; networking.firewall = { checkReversePath = "loose"; - trustedInterfaces = [ "tailscale0" ]; - allowedUDPPorts = [ config.services.tailscale.port ]; + trustedInterfaces = ["tailscale0"]; + allowedUDPPorts = [config.services.tailscale.port]; }; - } |