user: extract user setup into user module

sh-initrd-on-root
Zynh Ludwig 2024-10-06 06:46:06 -07:00
parent dd7c2ea7c2
commit c5da0ace1c
2 changed files with 28 additions and 13 deletions

View File

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`). # and in the NixOS manual (accessible by running `nixos-help`).
{ pkgs, inputs, config, ... }: { pkgs, inputs, ... }:
{ {
imports = [ imports = [
@ -25,6 +25,7 @@
syncthing.enable = true; syncthing.enable = true;
plymouth.enable = true; plymouth.enable = true;
polkit.enable = true; polkit.enable = true;
user.enable = true;
}; };
# Enable CUPS to print documents. # Enable CUPS to print documents.
@ -32,18 +33,6 @@
services.envfs.enable = true; services.envfs.enable = true;
# users sops setup
sops.secrets."passwords/ravenshade".neededForUsers = true;
users.mutableUsers = false;
# Define a user account. Don't forget to set a password with `passwd`.
users.users.ravenshade = {
isNormalUser = true;
description = "Zynh Ludwig";
hashedPasswordFile = config.sops.secrets."passwords/ravenshade".path;
extraGroups = [ "networkmanager" "wheel" "audio" ];
};
hardware.keyboard.uhk.enable = true; hardware.keyboard.uhk.enable = true;
programs.dconf.enable = true; programs.dconf.enable = true;

26
modules/user.nix Normal file
View File

@ -0,0 +1,26 @@
{ config, lib, ... }:
let
cfg = config.snowhawk.user;
in
{
options.snowhawk.user = {
enable = lib.mkEnableOption "user nixos module";
};
config = lib.mkIf cfg.enable {
snowhawk.sops.enable = lib.mkForce true;
# users sops setup
sops.secrets."passwords/ravenshade".neededForUsers = true;
users.mutableUsers = false;
# Define a user account. Don't forget to set a password with `passwd`.
users.users.ravenshade = {
isNormalUser = true;
description = "Zynh Ludwig";
hashedPasswordFile = config.sops.secrets."passwords/ravenshade".path;
extraGroups = [ "networkmanager" "wheel" "audio" ];
};
};
}