diff --git a/.sops.yaml b/.sops.yaml index bd99b6b..beea2c9 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -1,9 +1,9 @@ keys: - - &rafiq age12l33pas8eptwjc7ewux3d8snyzfzwz0tn9qg5kw8le79fswmjgjqdjgyy6 + - &admin age12l33pas8eptwjc7ewux3d8snyzfzwz0tn9qg5kw8le79fswmjgjqdjgyy6 - &nemesis age1sq4n2ywk6h94a0r5rye6vzkqy5x6ae736faqregz8u2ku8ttepeqqh5crh creation_rules: - path_regex: secrets/[^/]+\.(yaml|json|env|ini)$ key_groups: - age: - - *rafiq + - *admin - *nemesis diff --git a/flake.nix b/flake.nix index 3402c46..1c8effb 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ ... }@inputs: let + username = "rafiq"; mkSystem = type: hostname: { name = "${hostname}"; value = @@ -15,6 +16,7 @@ inputs type hostname + username ; }; in diff --git a/systems/default.nix b/systems/default.nix index e1ac61e..9f4fad5 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -7,10 +7,12 @@ inputs, config, specialArgs, + username, ... }: { imports = builtins.concatLists [ + # Common options for all machines. [ (modulesPath + "/installer/scan/not-detected.nix") ./modules/bootloaders/systemd-boot.nix @@ -24,12 +26,13 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = specialArgs; - users.rafiq.imports = [ + users.${username}.imports = [ ../users/rafiq.nix ]; }; } ] + # Options for desktops. (lib.optionals (type == "desktop") [ ./modules/hardware/audio.nix ./modules/hardware/bluetooth.nix @@ -38,6 +41,7 @@ ./modules/programs/hyprlock.nix ./modules/stylix.nix ]) + # Options for specific hostnames. (lib.optionals (hostname == "nemesis") [ ./hw-nemesis.nix ./modules/hardware/nvidia.nix @@ -88,16 +92,16 @@ }; users.mutableUsers = false; # Always reset users on system activation - users.users.rafiq = { + users.users.${username} = { isNormalUser = true; - description = "rafiq"; + description = "${username}"; hashedPasswordFile = config.sops.secrets.password.path; extraGroups = [ "networkmanager" "wheel" ]; openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n" ]; }; security.sudo.wheelNeedsPassword = false; diff --git a/systems/modules/programs/getty.nix b/systems/modules/programs/getty.nix index 08faabb..4a4f129 100644 --- a/systems/modules/programs/getty.nix +++ b/systems/modules/programs/getty.nix @@ -1,5 +1,6 @@ +{ username, ... }: { services.getty = { - autologinUser = "rafiq"; + autologinUser = "${username}"; }; } diff --git a/systems/modules/programs/hyprlock.nix b/systems/modules/programs/hyprlock.nix index 71e06ca..fa96f41 100644 --- a/systems/modules/programs/hyprlock.nix +++ b/systems/modules/programs/hyprlock.nix @@ -2,6 +2,7 @@ inputs, hostname, pkgs, + username, ... }: let @@ -17,7 +18,7 @@ let in { security.pam.services.hyprlock = { }; - home-manager.users.rafiq = { + home-manager.users.${username} = { programs.hyprlock = { enable = true; package = inputs.hyprlock.packages.${pkgs.stdenv.hostPlatform.system}.hyprlock; diff --git a/systems/modules/stylix.nix b/systems/modules/stylix.nix index 1dade38..571ef14 100644 --- a/systems/modules/stylix.nix +++ b/systems/modules/stylix.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ inputs, username, ... }: let opacity = 0.8; toImport = [ @@ -25,12 +25,12 @@ in fonts.enableDefaultPackages = true; imports = [ inputs.stylix.nixosModules.stylix ] ++ toImport; - home-manager.users.rafiq.imports = [ inputs.stylix.homeManagerModules.stylix ] ++ toImport; + home-manager.users.${username}.imports = [ inputs.stylix.homeManagerModules.stylix ] ++ toImport; # Put options that only exist in the NixOS module here. stylix.homeManagerIntegration.autoImport = false; stylix.homeManagerIntegration.followSystem = false; # Put options that only exist in the home-manager module here. - # home-manager.users.rafiq.stylix = {}; + # home-manager.users.${username}.stylix = {}; } diff --git a/users/modules/programs/bash.nix b/users/modules/programs/bash.nix deleted file mode 100644 index d515e49..0000000 --- a/users/modules/programs/bash.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - programs.bash = { - enable = true; - }; -} diff --git a/users/modules/programs/eww.nix b/users/modules/programs/eww.nix deleted file mode 100644 index 4bafe2e..0000000 --- a/users/modules/programs/eww.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - programs.eww = { - enable = true; - configDir = ./eww; - }; -} diff --git a/users/modules/programs/eww/eww.scss b/users/modules/programs/eww/eww.scss deleted file mode 100644 index e69de29..0000000 diff --git a/users/modules/programs/eww/eww.yuck b/users/modules/programs/eww/eww.yuck deleted file mode 100644 index 763e510..0000000 --- a/users/modules/programs/eww/eww.yuck +++ /dev/null @@ -1,30 +0,0 @@ -(defwindow lockscreen_background :monitor 0 - :geometry (geometry :width "100%" - :height "100%" - :anchor "center") - :stacking "fg" - (box)) - -(defwindow lockscreen_title :monitor 0 - :geometry (geometry :anchor "center") - :stacking "fg" - (greeting)) - -(defwidget greeting[] - (box (label :markup 'Hi, rafiq.'))) - -(defwindow lockscreen_input :monitor 0 - :geometry (geometry :y "55%" - :width "5%" - :height "2.5%" - :anchor "center top") - :stacking "fg" - :focusable "ondemand" - (password_input)) - -(defwidget password_input[] - (box - (input :onaccept "${EWW_CMD} close-all" - :password true - :class "password_input" - :css ".password_input {border-radius:50px;}"))) diff --git a/users/modules/programs/font-terminess.nix b/users/modules/programs/font-terminess.nix deleted file mode 100644 index a0cafa8..0000000 --- a/users/modules/programs/font-terminess.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - fonts = { - fontconfig = { - enable = true; - defaultFonts.emoji = ["Terminess Nerd Font"]; - defaultFonts.monospace = ["Terminess Nerd Font Mono"]; - defaultFonts.sansSerif = ["Terminess Nerd Font"]; - defaultFonts.serif = ["Terminess Nerd Font"]; - }; - }; -} diff --git a/users/modules/programs/git.nix b/users/modules/programs/git.nix index 1476683..166ac67 100644 --- a/users/modules/programs/git.nix +++ b/users/modules/programs/git.nix @@ -1,11 +1,12 @@ -{config, ...}: { +{ config, ... }: +{ home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config"; programs.git = { enable = true; userName = "Mohammad Rafiq"; userEmail = "mohammadrafiq567@gmail.com"; - signing.key = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + signing.key = "~/.ssh/id_ed25519.pub"; signing.signByDefault = true; extraConfig = { init.defaultBranch = "prime"; diff --git a/users/modules/programs/waybar.nix b/users/modules/programs/waybar.nix deleted file mode 100644 index 90438fa..0000000 --- a/users/modules/programs/waybar.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - programs.waybar = { - enable = true; - settings = { - mainBar = { - layer = "top"; - }; - }; - style = '' - ''; - }; -} diff --git a/users/rafiq.nix b/users/rafiq.nix index acccfe3..4566ac6 100644 --- a/users/rafiq.nix +++ b/users/rafiq.nix @@ -2,6 +2,7 @@ pkgs, inputs, lib, + username, ... }: { @@ -15,8 +16,8 @@ programs.home-manager.enable = true; home = { - username = "rafiq"; - homeDirectory = "/home/rafiq"; + username = "${username}"; + homeDirectory = "/home/${username}"; # This defines the version home-manager # was originally bulit against on this system.