From 144c46a9843d030e9b74a580e1c959047b1570b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Wed, 18 Sep 2024 12:03:23 +0200 Subject: [PATCH] chore: format code with alejandra --- common.nix | 44 ++++++++++++++----------- flake.nix | 16 ++++----- hardware-configuration-t470.nix | 41 +++++++++++++----------- hardware-configuration-void.nix | 50 ++++++++++++++++------------- home.nix | 41 ++++++++++++++++++------ overlays/cacert.nix | 5 ++- snipeit.nix | 57 ++++++++++++++++----------------- sourcehut.nix | 6 ++-- stylix.nix | 5 ++- t470.nix | 20 ++++++------ void.nix | 1 - wm/river.nix | 3 +- wm/waybar.nix | 6 ++-- 13 files changed, 164 insertions(+), 131 deletions(-) diff --git a/common.nix b/common.nix index b0d9649..6bab44a 100644 --- a/common.nix +++ b/common.nix @@ -1,5 +1,8 @@ -{ pkgs, pkgs-unstable, ... }: { + pkgs, + pkgs-unstable, + ... +}: { # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -8,8 +11,8 @@ networking.networkmanager.enable = true; # setup magicdns for tailscale - networking.nameservers = [ "100.100.100.100" "1.1.1.1" "8.8.8.8" ]; - networking.search = [ "hummingbird-stork.ts.net" ]; + networking.nameservers = ["100.100.100.100" "1.1.1.1" "8.8.8.8"]; + networking.search = ["hummingbird-stork.ts.net"]; # Set your time zone. time.timeZone = "Europe/Paris"; @@ -81,7 +84,7 @@ initialPassword = "asunarovow"; isNormalUser = true; description = "Khaïs COLIN"; - extraGroups = [ "networkmanager" "wheel" "podman" "libvirtd" "music" ]; + extraGroups = ["networkmanager" "wheel" "podman" "libvirtd" "music"]; shell = pkgs.zsh; }; # access to /pile/Music @@ -91,7 +94,7 @@ createHome = true; isNormalUser = true; description = "Guest Account"; - extraGroups = [ "networkmanager" ]; + extraGroups = ["networkmanager"]; shell = pkgs.zsh; packages = with pkgs; [ mpv @@ -129,14 +132,18 @@ tailscale wluma # man pages - man-pages man-pages-posix + man-pages + man-pages-posix # kde - kdePackages.kate kdePackages.plasma-workspace kdePackages.dolphin + kdePackages.kate + kdePackages.plasma-workspace + kdePackages.dolphin # fix kde apps having no icons kdePackages.qtsvg thunderbird-128 # for screen sharing - xdg-desktop-portal xdg-desktop-portal-kde + xdg-desktop-portal + xdg-desktop-portal-kde ]; # set user environment variables @@ -169,9 +176,9 @@ ]; fontconfig = { defaultFonts = { - monospace = [ "VictorMono NF Medium" ]; - sansSerif = [ "IBM Plex Sans" ]; - serif = [ "CMU Serif" ]; + monospace = ["VictorMono NF Medium"]; + sansSerif = ["IBM Plex Sans"]; + serif = ["CMU Serif"]; }; }; }; @@ -179,20 +186,20 @@ services.tailscale = { enable = true; useRoutingFeatures = "both"; - extraUpFlags = [ "--ssh" ]; + extraUpFlags = ["--ssh"]; }; # enable wluma for automatic brightness adjustment systemd.user.services.wluma = { enable = true; description = "Adjusting screen brightness based on screen contents and amount of ambient light"; - after = [ "graphical-session.target" ]; - partOf = [ "graphical-session.target" ]; + after = ["graphical-session.target"]; + partOf = ["graphical-session.target"]; serviceConfig = { ExecStart = "${pkgs.wluma}/bin/wluma"; Restart = "always"; }; - wantedBy = [ "graphical-session.target" ]; + wantedBy = ["graphical-session.target"]; }; programs.gnupg.agent = { @@ -224,9 +231,10 @@ # enable VAAPI and intel QSV # enable vaapi nixpkgs.config.packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;}; }; - hardware.opengl = { # hardware.graphics in unstable + hardware.opengl = { + # hardware.graphics in unstable enable = true; extraPackages = with pkgs; [ intel-media-driver @@ -257,7 +265,7 @@ system.stateVersion = "24.05"; # Did you read the comment? # flakes - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = ["nix-command" "flakes"]; # automatically collect garbage nix.gc = { diff --git a/flake.nix b/flake.nix index c18efcd..8b99e88 100644 --- a/flake.nix +++ b/flake.nix @@ -36,17 +36,14 @@ outputs = { nixpkgs, nixpkgs-unstable, - home-manager, stylix, - nixvim, river-shifttags, breezex-cursor, - nixos-06cb-009a-fingerprint-sensor, - ... }: - let + ... + }: let system = "x86_64-linux"; home-manager-args = { nixvim = nixvim.packages.${system}.default; @@ -54,14 +51,14 @@ breezex-cursor = breezex-cursor.packages.${system}.default; kitty-unstable = nixpkgs-unstable.legacyPackages.${system}.kitty; }; - in - { + in { nixosConfigurations.void = nixpkgs.lib.nixosSystem { inherit system; modules = [ ./void.nix - home-manager.nixosModules.home-manager { + home-manager.nixosModules.home-manager + { home-manager = { useGlobalPkgs = true; useUserPackages = true; @@ -82,7 +79,8 @@ modules = [ ./t470.nix - home-manager.nixosModules.home-manager { + home-manager.nixosModules.home-manager + { home-manager = { useGlobalPkgs = true; useUserPackages = true; diff --git a/hardware-configuration-t470.nix b/hardware-configuration-t470.nix index e9eca5b..ab3209b 100644 --- a/hardware-configuration-t470.nix +++ b/hardware-configuration-t470.nix @@ -1,30 +1,33 @@ # 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" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/25f87dfd-b7bb-475a-ab05-732a5e2026d9"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/25f87dfd-b7bb-475a-ab05-732a5e2026d9"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/929D-FA32"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/929D-FA32"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; - 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/hardware-configuration-void.nix b/hardware-configuration-void.nix index e1a9bb7..8790547 100644 --- a/hardware-configuration-void.nix +++ b/hardware-configuration-void.nix @@ -1,35 +1,39 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/29ecd09f-8852-4582-a78a-ec1aa1e7b2b9"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/29ecd09f-8852-4582-a78a-ec1aa1e7b2b9"; + fsType = "ext4"; + }; - fileSystems."/pile" = - { device = "/dev/disk/by-uuid/51ff5791-f197-4dfd-850a-00a8726ddb31"; - fsType = "ext4"; - }; + fileSystems."/pile" = { + device = "/dev/disk/by-uuid/51ff5791-f197-4dfd-850a-00a8726ddb31"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/E135-9F42"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/E135-9F42"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; - 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/home.nix b/home.nix index 56b1e88..5f44404 100644 --- a/home.nix +++ b/home.nix @@ -1,4 +1,10 @@ -{ pkgs, nixvim, river-shifttags, kitty-unstable, ... }: let +{ + pkgs, + nixvim, + river-shifttags, + kitty-unstable, + ... +}: let username = "khais"; in { imports = [ @@ -9,7 +15,15 @@ in { home = { packages = with pkgs; [ # system tools & bragging - htop neofetch ripgrep usbutils wget curl ncdu trashy unzip + htop + neofetch + ripgrep + usbutils + wget + curl + ncdu + trashy + unzip # remote working remmina # communication @@ -22,13 +36,18 @@ in { # https://superuser.com/a/1803183 wl-clipboard # wm river utils - playerctl brightnessctl river-shifttags wlr-randr + playerctl + brightnessctl + river-shifttags + wlr-randr # dev tools - gitu lnav + gitu + lnav # music cmus # music collection tools - picard kid3 + picard + kid3 # audio audacity # video @@ -36,14 +55,16 @@ in { # file sending magic-wormhole # drawing apps - krita inkscape + krita + inkscape # office apps libreoffice-fresh hunspellDicts.fr-moderne hunspellDicts.de-de hunspellDicts.en-us # nixos tools - nh nix-output-monitor + nh + nix-output-monitor ]; file = { @@ -87,8 +108,8 @@ in { }; ui = { editor = "nvim"; - diff-editor = [ "nvim" "-c" "DiffEditor $left $right $output" ]; - merge-editor = [ "nvim" "-c" "DiffEditor $left $right $output" ]; + diff-editor = ["nvim" "-c" "DiffEditor $left $right $output"]; + merge-editor = ["nvim" "-c" "DiffEditor $left $right $output"]; }; }; }; @@ -163,7 +184,7 @@ in { incremental = false; write = true; }; - plugins = [ "lyrics" "web" "info" "edit" ]; + plugins = ["lyrics" "web" "info" "edit"]; }; }; diff --git a/overlays/cacert.nix b/overlays/cacert.nix index ca1d97b..2f9f473 100644 --- a/overlays/cacert.nix +++ b/overlays/cacert.nix @@ -1,6 +1,5 @@ -self: super: -{ +self: super: { cacert = super.cacert.override { - extraCertificateFiles = [ ../certs/myCA.pem ]; + extraCertificateFiles = [../certs/myCA.pem]; }; } diff --git a/snipeit.nix b/snipeit.nix index 9af2fad..9f29d43 100644 --- a/snipeit.nix +++ b/snipeit.nix @@ -1,34 +1,33 @@ let snipeit-fqdn = "snipe-it.nixos.local"; in -{ pkgs, ... }: -{ - services.snipe-it = { - enable = true; - appKeyFile = "/etc/nixos/secrets/snipe-it/appkey"; - appURL = "https://${snipeit-fqdn}"; - hostName = snipeit-fqdn; - database = { - user = "snipeit"; + {pkgs, ...}: { + services.snipe-it = { + enable = true; + appKeyFile = "/etc/nixos/secrets/snipe-it/appkey"; + appURL = "https://${snipeit-fqdn}"; + hostName = snipeit-fqdn; + database = { + user = "snipeit"; + }; + nginx = { + sslCertificate = "/etc/nixos/secrets/certs/snipe-it.nixos.local.crt"; + sslCertificateKey = "/etc/nixos/secrets/certs/snipe-it.nixos.local.key"; + forceSSL = true; + kTLS = true; + }; }; - nginx = { - sslCertificate = "/etc/nixos/secrets/certs/snipe-it.nixos.local.crt"; - sslCertificateKey = "/etc/nixos/secrets/certs/snipe-it.nixos.local.key"; - forceSSL = true; - kTLS = true; + services.mysql = { + enable = true; + package = pkgs.mariadb; + ensureUsers = [ + { + name = "snipeit"; + ensurePermissions = { + "snipeit.*" = "ALL PRIVILEGES"; + }; + } + ]; + ensureDatabases = ["snipeit"]; }; - }; - services.mysql = { - enable = true; - package = pkgs.mariadb; - ensureUsers = [ - { - name = "snipeit"; - ensurePermissions = { - "snipeit.*" = "ALL PRIVILEGES"; - }; - } - ]; - ensureDatabases = [ "snipeit" ]; - }; -} + } diff --git a/sourcehut.nix b/sourcehut.nix index 7c89fed..0ef5ac3 100644 --- a/sourcehut.nix +++ b/sourcehut.nix @@ -1,8 +1,6 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let sourcehut-fqdn = "sourcehut.nixos.local"; -in -{ +in { systemd.services.gitsrht = { environment = { # make python's requests package use the global ca-certificates store, which will contain my own CA cert diff --git a/stylix.nix b/stylix.nix index a703459..7989f35 100644 --- a/stylix.nix +++ b/stylix.nix @@ -1,5 +1,8 @@ -{ breezex-cursor, pkgs, ... }: { + breezex-cursor, + pkgs, + ... +}: { stylix = { enable = true; image = ./wallpapers/nixos_inspector_tan.png; diff --git a/t470.nix b/t470.nix index 1594c2f..cff33c2 100644 --- a/t470.nix +++ b/t470.nix @@ -1,9 +1,11 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ pkgs, lib, ... }: { + pkgs, + lib, + ... +}: { imports = [ ./hardware-configuration-t470.nix ./common.nix @@ -16,10 +18,10 @@ fileSystems."/home/khais/Books" = { device = "//void/Books"; fsType = "cifs"; - options = let + options = let # prevent hanging when network is not reachable automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; - in [ "${automount_opts},credentials=/etc/nixos/secrets/books.smb" ]; + in ["${automount_opts},credentials=/etc/nixos/secrets/books.smb"]; }; # scanner drop point @@ -30,7 +32,7 @@ writeEnable = true; chrootlocalUser = true; userlistEnable = true; - userlist = [ "paperless-upload" ]; + userlist = ["paperless-upload"]; userlistDeny = false; extraConfig = '' log_ftp_protocol=YES @@ -44,7 +46,7 @@ allow_writeable_chroot=YES ''; }; - networking.firewall.allowedTCPPorts = [ 21 ]; + networking.firewall.allowedTCPPorts = [21]; networking.firewall.allowedTCPPortRanges = [ { from = 51000; @@ -56,14 +58,14 @@ isNormalUser = true; group = "paperless-upload"; }; - system.activationScripts.makeFtpDirectory = lib.stringAfter [ "var" ] '' + system.activationScripts.makeFtpDirectory = lib.stringAfter ["var"] '' mkdir -m 775 -p /var/lib/ftp chown root:root /var/lib/ftp mkdir -m 700 -p /var/lib/ftp/paperless-upload chown paperless-upload:paperless-upload /var/lib/ftp/paperless-upload ''; systemd.services.uploadPaperlessDocuments = { - path = [ pkgs.openssh pkgs.inotify-tools ]; + path = [pkgs.openssh pkgs.inotify-tools]; serviceConfig = { User = "paperless-upload"; StandardOutput = "journal+console"; @@ -80,7 +82,7 @@ pathConfig = { PathChanged = "/var/lib/ftp/paperless-upload/"; }; - wantedBy = [ "multi-user.target" ]; + wantedBy = ["multi-user.target"]; }; # fingerprint sensor setup diff --git a/void.nix b/void.nix index fddeffd..fb4d862 100644 --- a/void.nix +++ b/void.nix @@ -1,7 +1,6 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - { imports = [ ./hardware-configuration-void.nix diff --git a/wm/river.nix b/wm/river.nix index 10ab002..327e703 100644 --- a/wm/river.nix +++ b/wm/river.nix @@ -1,7 +1,6 @@ let lock-command = "swaylock"; -in -{ +in { wayland.windowManager.river = { enable = true; extraConfig = '' diff --git a/wm/waybar.nix b/wm/waybar.nix index b31aebf..8ef1d64 100644 --- a/wm/waybar.nix +++ b/wm/waybar.nix @@ -56,9 +56,9 @@ ]; "river/tags" = { num-tags = 10; - tag-labels = [ "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" ]; - set-tags = [ 1 2 4 8 16 32 64 128 256 512 ]; - toogle-tags = [ 1 2 4 8 16 32 64 128 256 512 ]; + tag-labels = ["1" "2" "3" "4" "5" "6" "7" "8" "9" "0"]; + set-tags = [1 2 4 8 16 32 64 128 256 512]; + toogle-tags = [1 2 4 8 16 32 64 128 256 512]; }; "mpris" = { interval = 1;