mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-02-16 17:50:52 +01:00
feat: Make username customizable
Now it's possible to use whatever username you want for your system. The default value of "user" is good if you're concerned about information disclosure attacks through things like the username being visible in logs or other output.
This commit is contained in:
parent
558e0b1623
commit
7f05a66fa5
@ -1,5 +1,8 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.modules.system) username;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../modules/fish.nix
|
../modules/fish.nix
|
||||||
@ -52,11 +55,9 @@
|
|||||||
users = {
|
users = {
|
||||||
allowNoPasswordLogin = true;
|
allowNoPasswordLogin = true;
|
||||||
|
|
||||||
users = {
|
users.${username} = {
|
||||||
user = {
|
password = lib.mkForce null;
|
||||||
password = lib.mkForce null;
|
extraGroups = lib.mkForce [ ];
|
||||||
extraGroups = lib.mkForce [ ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ let
|
|||||||
inherit (lib) mkEnableOption mkIf;
|
inherit (lib) mkEnableOption mkIf;
|
||||||
inherit (pkgs.xfce) thunar-volman exo;
|
inherit (pkgs.xfce) thunar-volman exo;
|
||||||
inherit (pkgs) glib;
|
inherit (pkgs) glib;
|
||||||
|
inherit (config.modules.system) username;
|
||||||
|
|
||||||
theme = "monokai";
|
theme = "monokai";
|
||||||
opacity = 0.95;
|
opacity = 0.95;
|
||||||
@ -100,7 +101,7 @@ in
|
|||||||
|
|
||||||
initial_session = {
|
initial_session = {
|
||||||
command = "${pkgs.hyprland}/bin/Hyprland";
|
command = "${pkgs.hyprland}/bin/Hyprland";
|
||||||
user = "user";
|
user = username;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4,11 +4,17 @@ let
|
|||||||
inherit (lib) mkOption;
|
inherit (lib) mkOption;
|
||||||
inherit (lib.types) str listOf;
|
inherit (lib.types) str listOf;
|
||||||
inherit (pkgs.nixVersions) nix_2_19;
|
inherit (pkgs.nixVersions) nix_2_19;
|
||||||
|
inherit (cfg) username;
|
||||||
|
|
||||||
cfg = config.modules.system;
|
cfg = config.modules.system;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.modules.system = {
|
options.modules.system = {
|
||||||
|
username = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "user";
|
||||||
|
};
|
||||||
|
|
||||||
timeZone = mkOption {
|
timeZone = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "America/New_York";
|
default = "America/New_York";
|
||||||
@ -81,13 +87,11 @@ in
|
|||||||
users = {
|
users = {
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
|
|
||||||
users = {
|
users.${username} = {
|
||||||
user = {
|
isNormalUser = true;
|
||||||
isNormalUser = true;
|
uid = 1000;
|
||||||
uid = 1000;
|
password = "user";
|
||||||
password = "user";
|
extraGroups = [ "wheel" "networkmanager" ];
|
||||||
extraGroups = [ "wheel" "networkmanager" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,11 +104,10 @@ in
|
|||||||
programs.man.generateCaches = true;
|
programs.man.generateCaches = true;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
users = {
|
users.${username}.home = {
|
||||||
user = {
|
inherit username;
|
||||||
home.username = "user";
|
|
||||||
home.homeDirectory = "/home/user";
|
homeDirectory = "/home/${username}";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.modules.system) username;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -13,7 +16,7 @@
|
|||||||
|
|
||||||
autoLogin = {
|
autoLogin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "user";
|
user = username;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.modules.system) username;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -9,7 +12,7 @@
|
|||||||
|
|
||||||
autoLogin = {
|
autoLogin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "user";
|
user = username;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user