From 7332f182974f64c382dc25099f54c2eb0c7beebc Mon Sep 17 00:00:00 2001 From: Mora Unie Youer Date: Sun, 30 Mar 2025 14:22:44 +0300 Subject: style: format all `.nix` files with `nixfmt` --- flake.nix | 73 +++++++++++++++++++------------- system-sapphire.nix | 62 +++++++++++++++++++-------- user-mora.nix | 118 +++++++++++++++++++++++++++++----------------------- 3 files changed, 155 insertions(+), 98 deletions(-) diff --git a/flake.nix b/flake.nix index 66d120c..862736e 100644 --- a/flake.nix +++ b/flake.nix @@ -129,29 +129,31 @@ ]; }; - outputs = { - self, + outputs = + { + self, - nixpkgs, - nurpkgs, - nyxpkgs, - home-manager, + nixpkgs, + nurpkgs, + nyxpkgs, + home-manager, - lanzaboote, + lanzaboote, - musnix, + musnix, - fjordlauncher, - niri, - wezterm, + fjordlauncher, + niri, + wezterm, - neovim-configuration, + neovim-configuration, - ... - } @ inputs: + ... + }@inputs: let system = "x86_64-linux"; - in { + in + { nixosConfigurations.sapphire = nixpkgs.lib.nixosSystem rec { inherit system; specialArgs = { inherit inputs; }; @@ -173,7 +175,10 @@ } { - nix.trustedUsers = [ "root" "mora" ]; + nix.trustedUsers = [ + "root" + "mora" + ]; } # System Configuration @@ -182,18 +187,30 @@ # User Configurations # mora@sapphire - ({ pkgs, ... }: { - users.users.mora = { - isNormalUser = true; - extraGroups = [ "audio" "docker" "libvirtd" "lp" "scanner" "video" "wireshark" "wheel" ]; - shell = pkgs.nushell; - }; - - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = specialArgs; - home-manager.users.mora = import ./user-mora.nix; - }) + ( + { pkgs, ... }: + { + users.users.mora = { + isNormalUser = true; + extraGroups = [ + "audio" + "docker" + "libvirtd" + "lp" + "scanner" + "video" + "wireshark" + "wheel" + ]; + shell = pkgs.nushell; + }; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = specialArgs; + home-manager.users.mora = import ./user-mora.nix; + } + ) ]; }; }; diff --git a/system-sapphire.nix b/system-sapphire.nix index 997be61..63290db 100644 --- a/system-sapphire.nix +++ b/system-sapphire.nix @@ -1,16 +1,26 @@ -{ inputs, modulesPath, config, lib, pkgs, ... }: +{ + inputs, + modulesPath, + config, + lib, + pkgs, + ... +}: { ### ### NixOS and Nixpkgs configuration ### - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; system.stateVersion = "25.05"; nixpkgs.config.allowUnfree = true; # Use the same nixpkgs for system and for `nix-shell` and `nix shell` nix.registry.nixpkgs.flake = inputs.nixpkgs; - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" "/nix/var/nix/profiles/per-user/root/channels" ]; + nix.nixPath = [ + "nixpkgs=${inputs.nixpkgs.outPath}" + "/nix/var/nix/profiles/per-user/root/channels" + ]; ### ### Filesystems @@ -25,7 +35,10 @@ "/efi" = { device = "/dev/disk/by-uuid/796C-8DE8"; fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; + options = [ + "fmask=0022" + "dmask=0022" + ]; }; "/data" = { @@ -38,7 +51,6 @@ { device = "/dev/disk/by-uuid/37e818f5-1460-4f22-8207-5ad94b5ec8c4"; } ]; - ### ### Bootloader and Linux kernel ### @@ -58,11 +70,20 @@ boot.kernelParams = [ "amdgpu.ppfeaturemask=0xfffd7fff" ]; boot.kernelModules = [ "kvm-amd" ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + ]; # NOTE: We need to load `i915` before `amdgpu` due to Chromium bugs # Will be removed when Chromium 131 will be released and Electron will upgrade to it - boot.initrd.kernelModules = [ "i915" "amdgpu" "dm-snapshot" ]; + boot.initrd.kernelModules = [ + "i915" + "amdgpu" + "dm-snapshot" + ]; # boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.postBootCommands = '' @@ -117,7 +138,6 @@ pulse.enable = true; }; - ### ### Timezone and Networking ### @@ -130,9 +150,8 @@ services.openssh.enable = true; services.openssh.settings.PasswordAuthentication = false; - networking.firewall.allowedTCPPorts = []; - networking.firewall.allowedUDPPorts = []; - + networking.firewall.allowedTCPPorts = [ ]; + networking.firewall.allowedUDPPorts = [ ]; ### ### Software configuration @@ -149,19 +168,25 @@ }; programs.dconf.enable = true; - services.dbus.packages = with pkgs; [ dconf gcr ]; - + services.dbus.packages = with pkgs; [ + dconf + gcr + ]; xdg.portal = { enable = true; - config.common.default = [ "gtk" "gnome" ]; - extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-gnome ]; + config.common.default = [ + "gtk" + "gnome" + ]; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + ]; }; - services.flatpak.enable = true; - # NOTE: I now use this as alternative to steam-run'ing every precompiled binary # This should be much easier now, than `steam-run ` every time services.envfs.enable = true; @@ -231,7 +256,8 @@ ### Extra Packages ### environment.systemPackages = with pkgs; [ - git git-crypt + git + git-crypt lact ]; diff --git a/user-mora.nix b/user-mora.nix index b7afc82..99601be 100644 --- a/user-mora.nix +++ b/user-mora.nix @@ -25,14 +25,12 @@ in programs.carapace.enable = true; - ### ### NeoVim ### # NOTE: this section works only due to neovim-configuration module nvim.enable = true; - ### ### Software ### @@ -43,16 +41,18 @@ in programs.git = { enable = true; delta.enable = true; - includes = [{ - contents = { - user.name = "Mora Unie Youer"; - user.email = "mora_unie_youer@riseup.net"; - user.signingKey = "0x7AB91D83B25E6D7F"; - commit.gpgSign = true; - init.defaultBranch = "master"; - safe.directory = "*"; - }; - }]; + includes = [ + { + contents = { + user.name = "Mora Unie Youer"; + user.email = "mora_unie_youer@riseup.net"; + user.signingKey = "0x7AB91D83B25E6D7F"; + commit.gpgSign = true; + init.defaultBranch = "master"; + safe.directory = "*"; + }; + } + ]; }; programs.gpg = { @@ -60,9 +60,20 @@ in settings = { ask-cert-level = true; expert = true; - list-options = [ "show-sig-expire" "show-uid-validity" "show-unusable-subkeys" "show-unusable-uids"]; - verify-options = [ "show-uid-validity" "show-unusable-uids" ]; - with-fingerprint = [ "" "" ]; # Repeat with-fingerprint twice + list-options = [ + "show-sig-expire" + "show-uid-validity" + "show-unusable-subkeys" + "show-unusable-uids" + ]; + verify-options = [ + "show-uid-validity" + "show-unusable-uids" + ]; + with-fingerprint = [ + "" + "" + ]; # Repeat with-fingerprint twice with-keygrip = true; }; }; @@ -75,13 +86,14 @@ in services.gnome-keyring = { enable = true; - components = [ "secrets" "ssh" ]; + components = [ + "secrets" + "ssh" + ]; }; - services.easyeffects.enable = true; - ### ### Customization ### @@ -95,21 +107,22 @@ in }; }; - home.pointerCursor = let - catppuccin-cursors' = pkgs-pinned.catppuccin-cursors.overrideAttrs (prev: { - patchPhase = '' - # FIX: GTK3-4 is screaming ;_; - sed -i scripts/build-cursors -e 's/NOMINAL_SIZE=24/NOMINAL_SIZE=32/' - ''; - }); - in { - package = catppuccin-cursors'.mochaMauve; - name = "catppuccin-mocha-mauve-cursors"; - size = 24; - gtk.enable = true; - x11.enable = true; - }; - + home.pointerCursor = + let + catppuccin-cursors' = pkgs-pinned.catppuccin-cursors.overrideAttrs (prev: { + patchPhase = '' + # FIX: GTK3-4 is screaming ;_; + sed -i scripts/build-cursors -e 's/NOMINAL_SIZE=24/NOMINAL_SIZE=32/' + ''; + }); + in + { + package = catppuccin-cursors'.mochaMauve; + name = "catppuccin-mocha-mauve-cursors"; + size = 24; + gtk.enable = true; + x11.enable = true; + }; ### ### Graphical Session @@ -117,7 +130,6 @@ in programs.niri.enable = true; programs.niri.package = pkgs.niri-unstable; - ### ### Extra Packages ### @@ -164,25 +176,27 @@ in ### ### Extra Services ### - systemd.user.services.wl-gammarelay-rs = let - wl-gammarelay-rs' = pkgs.writeShellScript "wl-gammarelay-rs" '' - ${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs & - sleep 1 - busctl --user -- set-property rs.wl-gammarelay /outputs/DP_2 rs.wl.gammarelay Brightness d 0.7 - busctl --user -- set-property rs.wl-gammarelay /outputs/DP_3 rs.wl.gammarelay Brightness d 0.75 - busctl --user -- set-property rs.wl-gammarelay /outputs/DP_4 rs.wl.gammarelay Brightness d 0.65 - wait - ''; - in { - Unit.PartOf = [ "graphical-session.target" ]; - Unit.After = [ "niri.service" ]; - Unit.Wants = [ "niri.service" ]; - Install.WantedBy = [ "graphical-session.target" ]; - Service = { - ExecStart = "${wl-gammarelay-rs'}"; - Restart = "on-failure"; + systemd.user.services.wl-gammarelay-rs = + let + wl-gammarelay-rs' = pkgs.writeShellScript "wl-gammarelay-rs" '' + ${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs & + sleep 1 + busctl --user -- set-property rs.wl-gammarelay /outputs/DP_2 rs.wl.gammarelay Brightness d 0.7 + busctl --user -- set-property rs.wl-gammarelay /outputs/DP_3 rs.wl.gammarelay Brightness d 0.75 + busctl --user -- set-property rs.wl-gammarelay /outputs/DP_4 rs.wl.gammarelay Brightness d 0.65 + wait + ''; + in + { + Unit.PartOf = [ "graphical-session.target" ]; + Unit.After = [ "niri.service" ]; + Unit.Wants = [ "niri.service" ]; + Install.WantedBy = [ "graphical-session.target" ]; + Service = { + ExecStart = "${wl-gammarelay-rs'}"; + Restart = "on-failure"; + }; }; - }; systemd.user.services.xwayland-satellite = { Unit.PartOf = [ "graphical-session.target" ]; -- cgit v1.2.3-70-g09d2