diff --git a/dotfiles/nvim/flake.nix b/dotfiles/nvim/flake.nix index 0501c34..117a4ef 100644 --- a/dotfiles/nvim/flake.nix +++ b/dotfiles/nvim/flake.nix @@ -10,30 +10,33 @@ }; }; - outputs = { self, nixpkgs, flake-utils, fenix }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - fenixLib = fenix.packages.${system}; - rustToolchain = fenixLib.stable.toolchain; - in - { - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - lua-language-server - stylua - ripgrep - fd + outputs = { + self, + nixpkgs, + flake-utils, + fenix, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + fenixLib = fenix.packages.${system}; + rustToolchain = fenixLib.stable.toolchain; + in { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + lua-language-server + stylua + ripgrep + fd - nodejs_24 - python313 - rustToolchain - ]; - - shellHook = '' - echo "Neovim development environment" - echo "nvim is configured with your local config" - ''; - }; - }); + nodejs_24 + python313 + rustToolchain + ]; + + shellHook = '' + echo "Neovim development environment" + echo "nvim is configured with your local config" + ''; + }; + }); } diff --git a/flake.nix b/flake.nix index cabf269..7fe6f9c 100644 --- a/flake.nix +++ b/flake.nix @@ -40,34 +40,34 @@ }; }; - outputs = { nixpkgs, ... }@inputs: - let - inherit (nixpkgs) lib; - mkHost = host: { - ${host} = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; + outputs = {nixpkgs, ...} @ inputs: let + inherit (nixpkgs) lib; + mkHost = host: { + ${host} = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; - # Extend lib with lib.custom - lib = nixpkgs.lib.extend (self: super: { - custom = import ./lib { inherit (nixpkgs) lib; }; - }); - }; - - modules = [ ./hosts/nixos/${host} ]; + # Extend lib with lib.custom + lib = nixpkgs.lib.extend (self: super: { + custom = import ./lib {inherit (nixpkgs) lib;}; + }); }; - }; - mkHostConfigs = hosts: - lib.foldl (acc: set: acc // set) { } - (lib.map (host: mkHost host) hosts); - readHosts = folder: lib.attrNames (builtins.readDir ./hosts/${folder}); - in { - nixosConfigurations = mkHostConfigs (readHosts "nixos"); - devShell.x86_64-linux = let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - in pkgs.mkShell { - buildInputs = with pkgs; [ nil lua-language-server ]; + modules = [./hosts/nixos/${host}]; }; }; + mkHostConfigs = hosts: + lib.foldl (acc: set: acc // set) {} + (lib.map (host: mkHost host) hosts); + readHosts = folder: lib.attrNames (builtins.readDir ./hosts/${folder}); + in { + nixosConfigurations = mkHostConfigs (readHosts "nixos"); + + devShell.x86_64-linux = let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in + pkgs.mkShell { + buildInputs = with pkgs; [nil lua-language-server]; + }; + }; } diff --git a/home/shahab/common/core/default.nix b/home/shahab/common/core/default.nix index 8cd96cb..2406b7e 100644 --- a/home/shahab/common/core/default.nix +++ b/home/shahab/common/core/default.nix @@ -1,6 +1,12 @@ -{ config, lib, pkgs, hostSpec, ... }: { +{ + config, + lib, + pkgs, + hostSpec, + ... +}: { imports = lib.flatten [ - (map lib.custom.relativeToRoot [ "modules/common" "modules/home-manager" ]) + (map lib.custom.relativeToRoot ["modules/common" "modules/home-manager"]) ./kitty.nix ./direnv.nix @@ -14,7 +20,7 @@ username = lib.mkDefault config.hostSpec.username; homeDirectory = lib.mkDefault config.hostSpec.home; stateVersion = lib.mkDefault "25.05"; - sessionPath = [ "$HOME/.local/bin" ]; + sessionPath = ["$HOME/.local/bin"]; sessionVariables = { FLAKE = "$HOME/src/nix/nix-config"; SHELL = "zsh"; @@ -52,7 +58,7 @@ nix = { package = lib.mkDefault pkgs.nix; settings = { - experimental-features = [ "nix-command" "flakes" ]; + experimental-features = ["nix-command" "flakes"]; warn-dirty = false; }; }; diff --git a/home/shahab/common/core/fonts.nix b/home/shahab/common/core/fonts.nix index aa04b06..fe61335 100644 --- a/home/shahab/common/core/fonts.nix +++ b/home/shahab/common/core/fonts.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { fonts.fontconfig.enable = true; - home.packages = with pkgs; [ nerd-fonts.jetbrains-mono ]; + home.packages = with pkgs; [nerd-fonts.jetbrains-mono]; } diff --git a/home/shahab/common/core/ghostty.nix b/home/shahab/common/core/ghostty.nix index 6fc6510..5af0d23 100644 --- a/home/shahab/common/core/ghostty.nix +++ b/home/shahab/common/core/ghostty.nix @@ -1,9 +1,4 @@ -{ - config, - ... -}: - -{ +{config, ...}: { programs.ghostty = { enable = true; diff --git a/home/shahab/common/core/git.nix b/home/shahab/common/core/git.nix index 2dcf67e..49b2ea0 100644 --- a/home/shahab/common/core/git.nix +++ b/home/shahab/common/core/git.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, config, ... }: { +{ + lib, + pkgs, + config, + ... +}: { programs.git = { package = pkgs.gitAndTools.gitFull; enable = true; @@ -7,15 +12,15 @@ lfs.enable = true; extraConfig = { - gpg = { format = "ssh"; }; + gpg = {format = "ssh";}; "gpg \"ssh\"" = { program = "${lib.getExe' pkgs._1password-gui "op-ssh-sign"}"; }; - commit = { gpgsign = true; }; - user = { signingKey = "~/.ssh/id_rihla.pub"; }; - pull = { rebase = true; }; - init = { defaultBranch = "main"; }; - lfs = { locksverify = true; }; + commit = {gpgsign = true;}; + user = {signingKey = "~/.ssh/id_rihla.pub";}; + pull = {rebase = true;}; + init = {defaultBranch = "main";}; + lfs = {locksverify = true;}; }; }; } diff --git a/home/shahab/common/core/kitty.nix b/home/shahab/common/core/kitty.nix index f79463a..0bdc87b 100644 --- a/home/shahab/common/core/kitty.nix +++ b/home/shahab/common/core/kitty.nix @@ -1,9 +1,4 @@ -{ - config, - ... -}: - -{ +{config, ...}: { programs.kitty = { enable = true; diff --git a/home/shahab/common/optional/btop.nix b/home/shahab/common/optional/btop.nix index 190500f..8b659f5 100644 --- a/home/shahab/common/optional/btop.nix +++ b/home/shahab/common/optional/btop.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ - programs.btop = { enable = true; }; +{...}: { + programs.btop = {enable = true;}; } diff --git a/home/shahab/common/optional/firefox.nix b/home/shahab/common/optional/firefox.nix index 17af757..70341ac 100644 --- a/home/shahab/common/optional/firefox.nix +++ b/home/shahab/common/optional/firefox.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.firefox = { enable = true; package = pkgs.firefox.override { diff --git a/home/shahab/common/optional/misc-packages.nix b/home/shahab/common/optional/misc-packages.nix index 35fa402..810ec11 100644 --- a/home/shahab/common/optional/misc-packages.nix +++ b/home/shahab/common/optional/misc-packages.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { home.packages = with pkgs; [ lazygit gh diff --git a/home/shahab/common/optional/nvim.nix b/home/shahab/common/optional/nvim.nix index 7532f7c..01237db 100644 --- a/home/shahab/common/optional/nvim.nix +++ b/home/shahab/common/optional/nvim.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -{ +{config, ...}: { programs.neovim = { enable = true; defaultEditor = true; @@ -9,6 +7,7 @@ }; # Create a symlink from ~/.config/nvim to the dotfiles directory - home.file.".config/nvim".source = config.lib.file.mkOutOfStoreSymlink + home.file.".config/nvim".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/git/nix-config/dotfiles/nvim"; } diff --git a/home/shahab/common/optional/ssh.nix b/home/shahab/common/optional/ssh.nix index 565e260..7301d49 100644 --- a/home/shahab/common/optional/ssh.nix +++ b/home/shahab/common/optional/ssh.nix @@ -1,5 +1,5 @@ -{ ... }: -let onePassPath = "~/.1password/agent.sock"; +{...}: let + onePassPath = "~/.1password/agent.sock"; in { programs.ssh = { enable = true; diff --git a/home/shahab/common/optional/starship.nix b/home/shahab/common/optional/starship.nix index dbfc87e..b17e578 100644 --- a/home/shahab/common/optional/starship.nix +++ b/home/shahab/common/optional/starship.nix @@ -1 +1 @@ -{ ... }: { programs.starship.enable = true; } +{...}: {programs.starship.enable = true;} diff --git a/home/shahab/common/optional/tmux.nix b/home/shahab/common/optional/tmux.nix index f4eba69..527859e 100644 --- a/home/shahab/common/optional/tmux.nix +++ b/home/shahab/common/optional/tmux.nix @@ -1,12 +1,15 @@ -{ config, lib, pkgs, ... }: - { + config, + lib, + pkgs, + ... +}: { home = { file = { "${config.xdg.configHome}/tmux".source = lib.custom.relativeToRoot "dotfiles/tmux"; }; - packages = with pkgs; [ tmux ]; + packages = with pkgs; [tmux]; }; } diff --git a/home/shahab/common/optional/zsh.nix b/home/shahab/common/optional/zsh.nix index 39d74cb..10cc76d 100644 --- a/home/shahab/common/optional/zsh.nix +++ b/home/shahab/common/optional/zsh.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{config, ...}: { programs.zsh = { enable = true; enableCompletion = true; diff --git a/home/shahab/rihla.nix b/home/shahab/rihla.nix index f95451b..08bed9e 100644 --- a/home/shahab/rihla.nix +++ b/home/shahab/rihla.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{lib, ...}: { imports = lib.flatten [ # # ========== Required Configs ========== diff --git a/home/shahab/specialisations/gaming.nix b/home/shahab/specialisations/gaming.nix index acb4ea9..4b8f514 100644 --- a/home/shahab/specialisations/gaming.nix +++ b/home/shahab/specialisations/gaming.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { home.packages = with pkgs; [ discord protonmail-desktop diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index 00d7462..a66e419 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -1,6 +1,10 @@ -{ pkgs, inputs, config, lib, ... }: - { + pkgs, + inputs, + config, + lib, + ... +}: { imports = lib.flatten [ inputs.home-manager.nixosModules.home-manager inputs.sops-nix.nixosModules.sops @@ -14,7 +18,7 @@ hostSpec = { username = "shahab"; handle = "shahab96"; - email = { user = "shahab@dogar.dev"; }; + email = {user = "shahab@dogar.dev";}; userFullName = "Shahab Dogar"; domain = "rihla"; networking.ports.tcp.ssh = 22; @@ -50,13 +54,13 @@ auto-optimise-store = true; warn-dirty = false; - trusted-users = [ "@wheel" ]; + trusted-users = ["@wheel"]; - substituters = [ "https://hyprland.cachix.org" ]; + substituters = ["https://hyprland.cachix.org"]; trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; - experimental-features = [ "nix-command" "flakes" ]; + experimental-features = ["nix-command" "flakes"]; }; }; @@ -70,7 +74,7 @@ }; # ========= Sops ========= - environment.systemPackages = with pkgs; [ sops ]; + environment.systemPackages = with pkgs; [sops]; # # ========== Localization ========== diff --git a/hosts/common/disks/rihla.nix b/hosts/common/disks/rihla.nix index 970c3ef..4c19215 100644 --- a/hosts/common/disks/rihla.nix +++ b/hosts/common/disks/rihla.nix @@ -1,6 +1,12 @@ -{ lib, config, device, withSwap, swapSize, label, ... }: - { + lib, + config, + device, + withSwap, + swapSize, + label, + ... +}: { disko = { devices = { disk = { @@ -34,8 +40,7 @@ passwordFile = "/tmp/secret.key"; settings = { allowDiscards = true; - crypttabExtraOpts = - [ "fido2-device=auto" "token-timeout=10" ]; + crypttabExtraOpts = ["fido2-device=auto" "token-timeout=10"]; }; content = { type = "lvm_pv"; @@ -62,20 +67,19 @@ size = "100%"; content = { type = "btrfs"; - extraArgs = [ "-L" label "-f" ]; + extraArgs = ["-L" label "-f"]; subvolumes = { "@root" = { mountpoint = "/"; - mountOptions = [ "subvol=root" "compress=zstd" "noatime" ]; + mountOptions = ["subvol=root" "compress=zstd" "noatime"]; }; "@persist" = { mountpoint = config.hostSpec.persist; - mountOptions = - [ "subvol=persist" "compress=zstd" "noatime" ]; + mountOptions = ["subvol=persist" "compress=zstd" "noatime"]; }; "@nix" = { mountpoint = "/nix"; - mountOptions = [ "subvol=nix" "compress=zstd" "noatime" ]; + mountOptions = ["subvol=nix" "compress=zstd" "noatime"]; }; }; }; diff --git a/hosts/common/optional/1password.nix b/hosts/common/optional/1password.nix index 80664b7..a1db86a 100644 --- a/hosts/common/optional/1password.nix +++ b/hosts/common/optional/1password.nix @@ -1,11 +1,9 @@ -{ config, ... }: - -{ +{config, ...}: { programs = { _1password.enable = true; _1password-gui = { enable = true; - polkitPolicyOwners = [ config.hostSpec.username ]; + polkitPolicyOwners = [config.hostSpec.username]; }; }; } diff --git a/hosts/common/optional/claude-code.nix b/hosts/common/optional/claude-code.nix index 031bd72..e23bbaa 100644 --- a/hosts/common/optional/claude-code.nix +++ b/hosts/common/optional/claude-code.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ claude-code ]; +{pkgs, ...}: { + environment.systemPackages = with pkgs; [claude-code]; } diff --git a/hosts/common/optional/dconf.nix b/hosts/common/optional/dconf.nix index 11c2c3b..e3002fb 100644 --- a/hosts/common/optional/dconf.nix +++ b/hosts/common/optional/dconf.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ +{...}: { programs.dconf.enable = true; } diff --git a/hosts/common/optional/docker.nix b/hosts/common/optional/docker.nix index 073a7dc..630dcbc 100644 --- a/hosts/common/optional/docker.nix +++ b/hosts/common/optional/docker.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { virtualisation = { podman = { enable = true; @@ -11,7 +11,7 @@ }; }; - containers = { registries = { search = [ "docker.io" ]; }; }; + containers = {registries = {search = ["docker.io"];};}; libvirtd = { enable = true; @@ -20,7 +20,7 @@ ovmf = { enable = true; - packages = with pkgs; [ OVMFFull.fd ]; + packages = with pkgs; [OVMFFull.fd]; }; }; }; diff --git a/hosts/common/optional/hoppscotch.nix b/hosts/common/optional/hoppscotch.nix index 600188a..540fb59 100644 --- a/hosts/common/optional/hoppscotch.nix +++ b/hosts/common/optional/hoppscotch.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ hoppscotch ]; +{pkgs, ...}: { + environment.systemPackages = with pkgs; [hoppscotch]; } diff --git a/hosts/common/optional/hyprland.nix b/hosts/common/optional/hyprland.nix index b6d338f..c3cbda3 100644 --- a/hosts/common/optional/hyprland.nix +++ b/hosts/common/optional/hyprland.nix @@ -1,6 +1,8 @@ -{ inputs, pkgs, ... }: - { + inputs, + pkgs, + ... +}: { programs.hyprland = { enable = true; package = diff --git a/hosts/common/optional/nix-ld.nix b/hosts/common/optional/nix-ld.nix index aaab925..7720e1b 100644 --- a/hosts/common/optional/nix-ld.nix +++ b/hosts/common/optional/nix-ld.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ +{...}: { programs.nix-ld.enable = true; } diff --git a/hosts/common/optional/secure-boot.nix b/hosts/common/optional/secure-boot.nix index 90a57f7..80eb559 100644 --- a/hosts/common/optional/secure-boot.nix +++ b/hosts/common/optional/secure-boot.nix @@ -1,5 +1,3 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ sbctl ]; +{pkgs, ...}: { + environment.systemPackages = with pkgs; [sbctl]; } diff --git a/hosts/common/optional/services/audio.nix b/hosts/common/optional/services/audio.nix index 2a807a4..c411ef8 100644 --- a/hosts/common/optional/services/audio.nix +++ b/hosts/common/optional/services/audio.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { services = { # Enable sound with pipewire. pulseaudio.enable = false; @@ -15,5 +13,5 @@ security.rtkit.enable = true; environment.systemPackages = - builtins.attrValues { inherit (pkgs) pavucontrol; }; + builtins.attrValues {inherit (pkgs) pavucontrol;}; } diff --git a/hosts/common/optional/services/bluetooth.nix b/hosts/common/optional/services/bluetooth.nix index 43d4a6a..46e66b3 100644 --- a/hosts/common/optional/services/bluetooth.nix +++ b/hosts/common/optional/services/bluetooth.nix @@ -1,6 +1,4 @@ -{ ... }: - -{ +{...}: { services.blueman.enable = true; hardware = { bluetooth.enable = true; diff --git a/hosts/common/optional/services/firmware.nix b/hosts/common/optional/services/firmware.nix index 52dc13e..999ca72 100644 --- a/hosts/common/optional/services/firmware.nix +++ b/hosts/common/optional/services/firmware.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ +{...}: { services.fwupd.enable = true; } diff --git a/hosts/common/optional/services/greetd.nix b/hosts/common/optional/services/greetd.nix index 5c8eca8..7da6890 100644 --- a/hosts/common/optional/services/greetd.nix +++ b/hosts/common/optional/services/greetd.nix @@ -1,12 +1,9 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { services.greetd = { enable = true; settings = { default_session = { - command = - "${pkgs.tuigreet}/bin/tuigreet --greeting 'Welcome to NixOS!' --asterisks --remember --remember-user-session --time --cmd ${pkgs.hyprland}/bin/Hyprland"; + command = "${pkgs.tuigreet}/bin/tuigreet --greeting 'Welcome to NixOS!' --asterisks --remember --remember-user-session --time --cmd ${pkgs.hyprland}/bin/Hyprland"; user = "greeter"; }; }; diff --git a/hosts/common/optional/services/openssh.nix b/hosts/common/optional/services/openssh.nix index 8f5a241..2c182b3 100644 --- a/hosts/common/optional/services/openssh.nix +++ b/hosts/common/optional/services/openssh.nix @@ -1,9 +1,9 @@ -{ config, ... }: -let sshPort = config.hostSpec.networking.ports.tcp.ssh; +{config, ...}: let + sshPort = config.hostSpec.networking.ports.tcp.ssh; in { services.openssh = { enable = true; - ports = [ sshPort ]; + ports = [sshPort]; settings = { PermitRootLogin = "no"; @@ -14,5 +14,5 @@ in { openFirewall = true; }; - networking.firewall.allowedTCPPorts = [ sshPort ]; + networking.firewall.allowedTCPPorts = [sshPort]; } diff --git a/hosts/common/optional/services/printing.nix b/hosts/common/optional/services/printing.nix index ff19c63..eeadc9b 100644 --- a/hosts/common/optional/services/printing.nix +++ b/hosts/common/optional/services/printing.nix @@ -1,6 +1,4 @@ # Reminder that CUPS cpanel defaults to localhost:631 -{ ... }: - -{ +{...}: { services.printing.enable = true; } diff --git a/hosts/common/optional/services/smart-card.nix b/hosts/common/optional/services/smart-card.nix index 4033dbd..0170b2e 100644 --- a/hosts/common/optional/services/smart-card.nix +++ b/hosts/common/optional/services/smart-card.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ +{...}: { services.pcscd.enable = true; } diff --git a/hosts/common/optional/yubikey.nix b/hosts/common/optional/yubikey.nix index 704e66f..94d4053 100644 --- a/hosts/common/optional/yubikey.nix +++ b/hosts/common/optional/yubikey.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { # yubikey login / sudo security.pam = { u2f = { @@ -13,5 +11,5 @@ }; }; - environment.systemPackages = with pkgs; [ yubikey-manager ]; + environment.systemPackages = with pkgs; [yubikey-manager]; } diff --git a/hosts/common/specialisations/gaming.nix b/hosts/common/specialisations/gaming.nix index acd5555..d493703 100644 --- a/hosts/common/specialisations/gaming.nix +++ b/hosts/common/specialisations/gaming.nix @@ -1,5 +1,9 @@ -{ pkgs, config, lib, ... }: -let +{ + pkgs, + config, + lib, + ... +}: let hostSpec = config.hostSpec; in { specialisation.gaming.configuration = { @@ -15,15 +19,15 @@ in { }; home-manager.users."${hostSpec.username}".imports = lib.flatten [ - ({ config, ... }: + ({config, ...}: import (lib.custom.relativeToRoot "home/${hostSpec.username}/specialisations/gaming.nix") { - inherit pkgs; - }) + inherit pkgs; + }) ]; powerManagement.cpuFreqGovernor = "performance"; - environment.systemPackages = with pkgs; [ mangohud protonup-qt ]; + environment.systemPackages = with pkgs; [mangohud protonup-qt]; }; } diff --git a/hosts/common/users/primary/default.nix b/hosts/common/users/primary/default.nix index 2dc6410..879c09a 100644 --- a/hosts/common/users/primary/default.nix +++ b/hosts/common/users/primary/default.nix @@ -1,5 +1,10 @@ -{ pkgs, config, lib, inputs, ... }: -let +{ + pkgs, + config, + lib, + inputs, + ... +}: let hostSpec = config.hostSpec; pubKeys = lib.filesystem.listFilesRecursive ./keys; in { @@ -13,15 +18,14 @@ in { shell = pkgs.zsh; home = hostSpec.home; isNormalUser = true; - hashedPassword = - "$y$j9T$pvjyL7hL5x2VBarGNTnMl1$mLA2UsWTbfp8Hgp/ug5l8224thi..Mo8.p7ME.tDZ.4"; - extraGroups = [ "networkmanager" "wheel" "input" "libvirtd" ]; + hashedPassword = "$y$j9T$pvjyL7hL5x2VBarGNTnMl1$mLA2UsWTbfp8Hgp/ug5l8224thi..Mo8.p7ME.tDZ.4"; + extraGroups = ["networkmanager" "wheel" "input" "libvirtd"]; # Read all keys in ./keys and add them to authorizedKeys. openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key); - packages = with pkgs; [ libnotify ]; + packages = with pkgs; [libnotify]; }; }; @@ -31,11 +35,11 @@ in { hostSpec = config.hostSpec; }; users.${hostSpec.username}.imports = lib.flatten [ - ({ config, ... }: + ({config, ...}: import (lib.custom.relativeToRoot "home/${hostSpec.username}/${hostSpec.hostName}.nix") { - inherit pkgs inputs config lib hostSpec; - }) + inherit pkgs inputs config lib hostSpec; + }) ]; }; } diff --git a/hosts/nixos/rihla/default.nix b/hosts/nixos/rihla/default.nix index c476b21..229e75e 100644 --- a/hosts/nixos/rihla/default.nix +++ b/hosts/nixos/rihla/default.nix @@ -1,6 +1,10 @@ -{ inputs, pkgs, lib, config, ... }: - { + inputs, + pkgs, + lib, + config, + ... +}: { imports = lib.flatten [ # # ========= Hardware ========= @@ -33,7 +37,7 @@ # # ========= Required Configs ========= # - (map lib.custom.relativeToRoot [ "hosts/common/core" ]) + (map lib.custom.relativeToRoot ["hosts/common/core"]) # # ========= Optional Configs ========= @@ -99,7 +103,8 @@ efi.canTouchEfiVariables = true; }; - initrd.postResumeCommands = lib.mkIf config.hostSpec.impermanance + initrd.postResumeCommands = + lib.mkIf config.hostSpec.impermanance (lib.mkAfter '' mkdir /btrfs_tmp mount /dev/crypt_vg/root /btrfs_tmp @@ -133,7 +138,7 @@ security.rtkit.enable = true; - environment.systemPackages = with pkgs; [ pciutils bc ]; + environment.systemPackages = with pkgs; [pciutils bc]; system.stateVersion = "25.05"; } diff --git a/hosts/nixos/rihla/hardware-configuration.nix b/hosts/nixos/rihla/hardware-configuration.nix index 9496b85..7be279f 100644 --- a/hosts/nixos/rihla/hardware-configuration.nix +++ b/hosts/nixos/rihla/hardware-configuration.nix @@ -1,8 +1,14 @@ # 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. -{ pkgs, config, lib, modulesPath, ... }: { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; +{ + pkgs, + config, + lib, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; boot = { initrd = { @@ -15,11 +21,11 @@ "usb_storage" "sd_mod" ]; - kernelModules = [ ]; + kernelModules = []; }; - kernelModules = [ "kvm-amd" ]; - extraModulePackages = [ ]; + kernelModules = ["kvm-amd"]; + extraModulePackages = []; }; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking @@ -36,7 +42,7 @@ lib.mkDefault config.hardware.enableRedistributableFirmware; graphics = { enable = true; - extraPackages = with pkgs; [ amdvlk ]; + extraPackages = with pkgs; [amdvlk]; }; }; } diff --git a/lib/default.nix b/lib/default.nix index 0674027..dee00bf 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,3 @@ -{ lib, ... }: - -{ +{lib, ...}: { relativeToRoot = lib.path.append ../.; } diff --git a/modules/common/default.nix b/modules/common/default.nix index 023c3df..0779690 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ - imports = [ ./host-spec.nix ]; +{...}: { + imports = [./host-spec.nix]; } diff --git a/modules/common/host-spec.nix b/modules/common/host-spec.nix index 71fec22..96d03bf 100644 --- a/modules/common/host-spec.nix +++ b/modules/common/host-spec.nix @@ -1,5 +1,9 @@ # Specifications For Differentiating Hosts -{ config, lib, ... }: { +{ + config, + lib, + ... +}: { options.hostSpec = { username = lib.mkOption { type = lib.types.str; @@ -14,7 +18,7 @@ description = "The email of the user"; }; networking = lib.mkOption { - default = { }; + default = {}; type = lib.types.attrsOf lib.types.anything; description = "An attribute set of networking information"; }; @@ -68,8 +72,7 @@ scaling = lib.mkOption { type = lib.types.str; default = "1"; - description = - "Used to indicate what scaling to use. Floating point number"; + description = "Used to indicate what scaling to use. Floating point number"; }; font = lib.mkOption { type = lib.types.str; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index a6ddcb1..14facfc 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,5 +1,3 @@ -{ ... }: - -{ - imports = [ ./yubikey-touch-detector.nix ]; +{...}: { + imports = [./yubikey-touch-detector.nix]; } diff --git a/modules/home-manager/yubikey-touch-detector.nix b/modules/home-manager/yubikey-touch-detector.nix index 68f7d87..e274a43 100644 --- a/modules/home-manager/yubikey-touch-detector.nix +++ b/modules/home-manager/yubikey-touch-detector.nix @@ -1,11 +1,15 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let cfg = config.services.yubikey-touch-detector; +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.services.yubikey-touch-detector; in { options.services.yubikey-touch-detector = { - enable = mkEnableOption + enable = + mkEnableOption "a tool to detect when your YubiKey is waiting for a touch"; package = mkOption { @@ -22,7 +26,7 @@ in { extraArgs = mkOption { type = types.listOf types.str; - default = [ "--libnotify" ]; + default = ["--libnotify"]; defaultText = literalExpression ''[ "--libnotify" ]''; description = '' Extra arguments to pass to the tool. The arguments are not escaped. @@ -31,20 +35,19 @@ in { }; config = mkIf cfg.enable { - home.packages = [ cfg.package ]; + home.packages = [cfg.package]; # Service description licensed under ISC # See https://github.com/maximbaz/yubikey-touch-detector/blob/c9fdff7163361d6323e2de0449026710cacbc08a/LICENSE # Author: Maxim Baz systemd.user.sockets.yubikey-touch-detector = mkIf cfg.socket.enable { - Unit.Description = - "Unix socket activation for YubiKey touch detector service"; + Unit.Description = "Unix socket activation for YubiKey touch detector service"; Socket = { ListenFIFO = "%t/yubikey-touch-detector.sock"; RemoveOnStop = true; SocketMode = "0660"; }; - Install.WantedBy = [ "sockets.target" ]; + Install.WantedBy = ["sockets.target"]; }; # Same license thing for the description here @@ -52,19 +55,19 @@ in { Unit = { Description = "Detects when your YubiKey is waiting for a touch"; Requires = - optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ]; + optionals cfg.socket.enable ["yubikey-touch-detector.socket"]; }; Service = { ExecStart = "${cfg.package}/bin/yubikey-touch-detector ${ - concatStringsSep " " cfg.extraArgs - }"; - Environment = [ "PATH=${lib.makeBinPath [ pkgs.gnupg ]}" ]; + concatStringsSep " " cfg.extraArgs + }"; + Environment = ["PATH=${lib.makeBinPath [pkgs.gnupg]}"]; Restart = "on-failure"; RestartSec = "1sec"; }; Install.Also = - optionals cfg.socket.enable [ "yubikey-touch-detector.socket" ]; - Install.WantedBy = [ "default.target" ]; + optionals cfg.socket.enable ["yubikey-touch-detector.socket"]; + Install.WantedBy = ["default.target"]; }; }; }