refactor: make username global variable

This commit is contained in:
Mohammad Rafiq 2025-03-27 01:35:31 +08:00
parent a5b3e2a175
commit 5d9230d64f
No known key found for this signature in database
14 changed files with 25 additions and 79 deletions

View file

@ -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;

View file

@ -1,5 +1,6 @@
{ username, ... }:
{
services.getty = {
autologinUser = "rafiq";
autologinUser = "${username}";
};
}

View file

@ -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;

View file

@ -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 = {};
}