nixfiles/modules/common.nix

94 lines
2.3 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
'';
};
nixpkgs = {
config = {
allowUnfree = true;
};
};
boot = {
# Use latest LTS release by default
kernelPackages = mkDefault pkgs.linuxKernel.packages.linux_5_15;
loader = {
efi = {
efiSysMountPoint = mkDefault "/boot";
canTouchEfiVariables = mkDefault false;
};
systemd-boot = {
enable = mkDefault true;
editor = mkDefault true;
consoleMode = mkDefault "max";
configurationLimit = mkDefault 10;
memtest86.enable = mkDefault true;
};
};
};
2022-02-06 00:19:29 +00:00
networking = {
useDHCP = mkDefault false;
enableIPv6 = mkDefault true;
};
2022-02-06 00:06:26 +00:00
environment.systemPackages = with pkgs; [
2022-02-09 20:41:51 +00:00
bash-completion
tree
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
];
services.openssh = {
enable = true;
};
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
};
}