lappy: enable guest account
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
./fs.nix
|
||||
];
|
||||
|
||||
colinsane.users.guest.enable = true;
|
||||
colinsane.gui.sway.enable = true;
|
||||
colinsane.impermanence.enable = true;
|
||||
boot.loader.generic-extlinux-compatible.enable = true;
|
||||
|
@@ -24,6 +24,7 @@ in
|
||||
colinsane.allocations.greeter-gid = mkId 999;
|
||||
|
||||
colinsane.allocations.colin-uid = mkId 1000;
|
||||
colinsane.allocations.guest-uid = mkId 1100;
|
||||
|
||||
# found on all machines
|
||||
colinsane.allocations.sshd-uid = mkId 2001; # 997
|
||||
|
32
modules/universal/env/users.nix
vendored
32
modules/universal/env/users.nix
vendored
@@ -1,7 +1,19 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# installer docs: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/installation-device.nix
|
||||
with lib;
|
||||
let
|
||||
cfg = config.colinsane.users;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
colinsane.users.guest.enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# Users are exactly these specified here;
|
||||
# old ones will be deleted (from /etc/passwd, etc) upon upgrade.
|
||||
users.mutableUsers = false;
|
||||
@@ -41,6 +53,24 @@
|
||||
];
|
||||
};
|
||||
|
||||
colinsane.impermanence.service-dirs = mkIf cfg.guest.enable [
|
||||
{ user = "guest"; group = "users"; directory = "/home/guest"; }
|
||||
];
|
||||
users.users.guest = mkIf cfg.guest.enable {
|
||||
isNormalUser = true;
|
||||
home = "/home/guest";
|
||||
uid = config.colinsane.allocations.guest-uid;
|
||||
subUidRanges = [
|
||||
{ startUid=200000; count=1; }
|
||||
];
|
||||
group = "users";
|
||||
initialPassword = lib.mkDefault "";
|
||||
shell = pkgs.zsh;
|
||||
openssh.authorizedKeys.keys = [
|
||||
# TODO: insert pubkeys that should be allowed in
|
||||
];
|
||||
};
|
||||
|
||||
security.sudo = {
|
||||
enable = true;
|
||||
wheelNeedsPassword = false;
|
||||
@@ -73,5 +103,5 @@
|
||||
message = "non-deterministic subUids/Guids detected for: ${name}";
|
||||
}) config.users.users);
|
||||
in uidAssertions ++ gidAssertions ++ autoSubAssertions;
|
||||
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user