refactor(modules): make username not hardcoded
This commit is contained in:
parent
9e17187b02
commit
fc7d95acfd
4 changed files with 15 additions and 4 deletions
|
@ -17,6 +17,7 @@
|
||||||
];
|
];
|
||||||
nixosModules.enable = true;
|
nixosModules.enable = true;
|
||||||
nixosModules.hostname = hostname;
|
nixosModules.hostname = hostname;
|
||||||
|
nixosModules.mainUser = "rafiq";
|
||||||
hmModules.enable = true;
|
hmModules.enable = true;
|
||||||
nix-config.enable = true;
|
nix-config.enable = true;
|
||||||
boot-config.enable = true;
|
boot-config.enable = true;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
let
|
let
|
||||||
moduleName = "hmModules";
|
moduleName = "hmModules";
|
||||||
cfg = config."${moduleName}";
|
cfg = config."${moduleName}";
|
||||||
|
username = config.nixosModules.mainUser;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -26,9 +27,9 @@ in
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
extraSpecialArgs = specialArgs;
|
extraSpecialArgs = specialArgs;
|
||||||
users.rafiq.home = {
|
users."${username}".home = {
|
||||||
username = "rafiq";
|
username = username;
|
||||||
homeDirectory = "/home/rafiq";
|
homeDirectory = "/home/${username}";
|
||||||
stateVersion = "25.05";
|
stateVersion = "25.05";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,10 +3,13 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
username = config.nixosModules.mainUser;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf config."hardware-config".usbAutoMount {
|
(lib.mkIf config."hardware-config".usbAutoMount {
|
||||||
home-manager.users.rafiq.services.udiskie = {
|
home-manager.users.${username}.services.udiskie = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
# workaround for
|
# workaround for
|
||||||
|
|
|
@ -27,6 +27,12 @@ in
|
||||||
example = "goron";
|
example = "goron";
|
||||||
description = "The name this machine will be known by.";
|
description = "The name this machine will be known by.";
|
||||||
};
|
};
|
||||||
|
mainUser = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
example = "link";
|
||||||
|
description = "The main user of pantheon.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue