nixfiles/modules/common.nix

61 lines
1.5 KiB
Nix
Raw Normal View History

2022-02-06 00:19:29 +00:00
{ lib, pkgs, inputs, system, config, options, ... }:
2022-02-06 00:06:26 +00:00
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 {
2022-02-09 20:41:51 +00:00
my = {
user = {
name = mkDefault defaultUsername;
isNormalUser = true;
uid = mkDefault 1000;
extraGroups = mkDefault [ "wheel" ];
password = mkDefault "hunter2"; # TODO: secrets...
};
2022-02-06 00:06:26 +00:00
};
time.timeZone = mkDefault "Europe/Dublin";
2022-02-09 20:41:51 +00:00
users = {
mutableUsers = false;
users.${uname} = mkAliasDefinitions options.my.user;
};
2022-02-06 00:06:26 +00:00
security = {
sudo.enable = mkDefault false;
doas = {
enable = mkDefault true;
wheelNeedsPassword = mkDefault false;
};
};
2022-02-06 00:19:29 +00:00
nix = {
package = inputs.nix.defaultPackage.${system};
extraOptions =
''
experimental-features = nix-command flakes ca-derivations
'';
};
2022-02-06 00:06:26 +00:00
environment.systemPackages = with pkgs; [
2022-02-09 20:41:51 +00:00
bash-completion
2022-02-06 00:06:26 +00:00
vim
2022-02-09 20:41:51 +00:00
htop
2022-02-06 00:06:26 +00:00
iperf3
];
2022-02-09 20:41:51 +00:00
system = {
stateVersion = "21.11";
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
};
2022-02-06 00:06:26 +00:00
};
}