lappy: enable guest account

This commit is contained in:
2022-07-31 11:35:15 -07:00
parent 4aa3e6cf24
commit 18bb89ded0
3 changed files with 101 additions and 69 deletions

View File

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

View File

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

View File

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