mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-13 05:06:42 +02:00
system: Disable root for containers by default
Notably removes the ability for non-containers to easily have root disabled, although this shouldn't be wanted in most cases.
This commit is contained in:
parent
4c301830d5
commit
1b71076ca1
@ -19,10 +19,6 @@
|
|||||||
|
|
||||||
nixpkgs.overlays = builtins.attrValues nix-config.overlays;
|
nixpkgs.overlays = builtins.attrValues nix-config.overlays;
|
||||||
|
|
||||||
modules = {
|
|
||||||
system.noRoot = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
variables = {
|
variables = {
|
||||||
TERM = "xterm-kitty";
|
TERM = "xterm-kitty";
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib.types) nullOr str listOf;
|
inherit (lib.types) nullOr str listOf;
|
||||||
|
inherit (config.boot) isContainer;
|
||||||
|
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
@ -25,7 +26,6 @@ let
|
|||||||
allowSRB2Port
|
allowSRB2Port
|
||||||
allowDevPort
|
allowDevPort
|
||||||
phone
|
phone
|
||||||
noRoot
|
|
||||||
postgres
|
postgres
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -76,7 +76,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
iHaveLotsOfRam = mkEnableOption "tmpfs on /tmp";
|
iHaveLotsOfRam = mkEnableOption "tmpfs on /tmp";
|
||||||
noRoot = mkEnableOption "disable access to root";
|
|
||||||
mullvad = mkEnableOption "mullvad vpn";
|
mullvad = mkEnableOption "mullvad vpn";
|
||||||
postgres = mkEnableOption "postgres database for containers";
|
postgres = mkEnableOption "postgres database for containers";
|
||||||
allowSRB2Port = mkEnableOption "port for srb2";
|
allowSRB2Port = mkEnableOption "port for srb2";
|
||||||
@ -148,17 +147,17 @@ in
|
|||||||
|
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
allowNoPasswordLogin = mkIf noRoot true;
|
allowNoPasswordLogin = mkIf isContainer true;
|
||||||
|
|
||||||
users.${username} = {
|
users.${username} = {
|
||||||
inherit hashedPassword;
|
inherit hashedPassword;
|
||||||
|
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
password = mkIf (hashedPassword == null && !noRoot) (if phone then "1234" else username);
|
password = mkIf (hashedPassword == null && !isContainer) (if phone then "1234" else username);
|
||||||
|
|
||||||
extraGroups =
|
extraGroups =
|
||||||
if noRoot then
|
if isContainer then
|
||||||
[ ]
|
[ ]
|
||||||
else
|
else
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user