nixfiles/modules/common.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

2022-02-06 00:06:26 +00:00
{ lib, pkgs, inputs, config, options, ... }:
let
inherit (lib) mkIf mkDefault mkAliasDefinitions;
inherit (lib.my) mkOpt;
in {
options.my = with lib.types; {
user = mkOpt (attrsOf anything) {};
};
config =
let
defaultUsername = "dev";
uname = config.my.user.name;
in {
my.user = rec {
name = mkDefault defaultUsername;
isNormalUser = true;
uid = mkDefault 1000;
extraGroups = mkDefault [ "wheel" ];
password = mkDefault "hunter2"; # TODO: secrets...
};
time.timeZone = mkDefault "Europe/Dublin";
users.mutableUsers = false;
users.users.${uname} = mkAliasDefinitions options.my.user;
users.groups.${uname}.gid = mkDefault config.users.users.${uname}.uid;
security = {
sudo.enable = mkDefault false;
doas = {
enable = mkDefault true;
wheelNeedsPassword = mkDefault false;
};
};
environment.systemPackages = with pkgs; [
vim
iperf3
];
system.stateVersion = "21.11";
system.configurationRevision = with inputs; mkIf (self ? rev) self.rev;
};
}