nixos/modules/misc/common/default.nix

177 lines
5.0 KiB
Nix
Raw Normal View History

2024-02-02 13:45:05 +01:00
{
config,
inputs,
lib,
pkgs,
...
}:
{
2021-11-27 16:53:22 +01:00
# The rough location
location = {
latitude = 46.948;
longitude = 7.447;
};
2021-11-23 22:17:41 +01:00
# Set your time zone.
time.timeZone = "Europe/Zurich";
services.timesyncd.enable = lib.mkForce true;
2021-11-23 22:17:41 +01:00
2022-12-02 20:10:08 +01:00
services.nscd.enableNsncd = true;
2021-11-23 22:17:41 +01:00
networking = {
domain = "2li.local";
2022-01-16 17:44:05 +01:00
enableIPv6 = false;
2022-09-17 19:25:57 +02:00
firewall = {
allowPing = true;
allowedTCPPorts = [ 22 ];
};
2024-02-02 13:45:05 +01:00
timeServers = [
"10.7.89.1"
"ch.pool.ntp.org"
];
2021-11-23 22:17:41 +01:00
};
2024-02-02 13:45:05 +01:00
hardware = {
enableRedistributableFirmware = true;
};
2021-11-23 22:17:41 +01:00
# required in order to have apropos and whatis working
2021-11-24 20:39:18 +01:00
programs.mosh.enable = true;
2022-12-07 22:01:16 +01:00
programs.ssh.startAgent = true;
2022-08-15 14:55:47 +02:00
services.openssh = {
enable = true;
2023-06-04 14:36:06 +02:00
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
2022-08-15 14:55:47 +02:00
extraConfig = ''
AllowTcpForwarding yes
X11Forwarding no
AllowAgentForwarding no
AllowStreamLocalForwarding no
AuthenticationMethods publickey
'';
2021-11-23 22:17:41 +01:00
};
# Select internationalisation properties.
2023-03-07 20:51:58 +01:00
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_NUMERIC = "de_CH.UTF-8";
LC_TIME = "en_IE.UTF-8";
2023-03-07 20:51:58 +01:00
LC_MONETARY = "de_CH.UTF-8";
LC_PAPER = "en_IE.UTF-8";
2023-03-07 20:51:58 +01:00
LC_TELEPHONE = "de_CH.UTF-8";
LC_MEASUREMENT = "en_IE.UTF-8";
2023-03-07 20:51:58 +01:00
};
};
2021-11-23 22:17:41 +01:00
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
2023-12-29 09:55:35 +01:00
environment = {
variables = {
EDITOR = "vim";
VISUAL = "vim";
};
2024-01-29 16:46:32 +01:00
shellAliases = {
btm = "btm --color default-light";
sudo = "sudo ";
};
2024-02-02 13:45:05 +01:00
systemPackages = [
pkgs.bottom
pkgs.highlight
pkgs.killall
2024-02-02 13:45:05 +01:00
pkgs.man-pages
pkgs.ncdu
pkgs.nmon
2024-02-25 09:31:59 +01:00
pkgs.pciutils # lspci
pkgs.usbutils # lsusb
pkgs.tree
pkgs.unzip
2024-02-02 13:45:05 +01:00
pkgs.vim
pkgs.wget
2024-02-02 13:45:05 +01:00
];
2023-12-29 09:55:35 +01:00
};
2022-01-12 22:08:22 +01:00
# Disable the root user
users.users.root.hashedPassword = "!";
2023-06-07 23:55:58 +02:00
# Define a user account. Don't forget to set a password with `passwd`.
2023-05-29 12:26:02 +02:00
users.users.${config.az-username} = {
2021-11-23 22:17:41 +01:00
isNormalUser = true;
initialPassword = "password";
2024-02-02 13:45:05 +01:00
extraGroups = [
"wheel"
"networkmanager"
];
2022-01-10 21:57:50 +01:00
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCR+JXNHSAEQamn2QiaKV0vejCPy6OmzOePXoaQF6CEknXyvBO4j7+qpgZ5RAhe7ups8xZrEpBKdtxRMf7OdQQEXg1PLlfWZSJTC8EGu1TbMltbwwHizgsK/15LkDhJ0Gk/GFz9O9GvGqjizik8Kvvqz8XWY0tEtYs5Riq8bB5D5Ctwl10iultqnIQkdaX0bNa/2X57XKeutWdbqhuSC/C7awC1aVDIdfy1BNT3weHhQhFVAeAlH7Fy4rx3gYPclICfzu27lulLeXKJj9F+NdeY84zEy7E8IkE7eqdo1zfdJJpXSIh3FqekWen5njzWJsXqZCa2Ynk1poK/Rv/ti+ySE+4XicyXp0VJM8fDz6iUI0S/pjumHwzpoN9CeNe5PDK3Y7iQzSlO9REvkj/+v7r2s6XKslk9B7hTKunvH5JgHlIeYymzXb4r2LggNrP/1KUgNk1Ztu+s1c5onXYfBNul1iQOFU3+kgTk8Oh/UFK3FA0dYeWrOLA02TdH2S7U6yE= andreas@gwyn"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDxBun0BYQaz/WjiP+g5+Hs9/JZnWAuLTpTVYgx/9shJwKS5Zu9K3I115DYOro/lpu0AMeeJca5We2AICcxYcM0lIZvsJqfOnFOHFjgmHxHc6IuzrUPM7msoLneF5lxfJ8ko2/LcFq8EtGlzjkllRpFpp2FtxDviD1lr4mJda4cOuQES4ujH3HP5Shpwa96oqnDENWCL+XPFe+Ur+88tuKTQ2MIX5Iqhs2sMIwsMI1o8HjBi4sMd+kd7qb232XcwWTlP3iIWvq/0D3OxZ6J6uSNyC4UCl781lupLOKrC6ml58RUrYP8nrF0a53+i0hgLuDiCWhj0vkY7W9nJW1no425 andreas@python"
2022-02-21 11:39:17 +01:00
2023-10-22 18:12:56 +02:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHcFlnVRZEjvblLMbQX0W644Rf6oRz9ibUv1uHIZyqNQ andreas@ipad"
2022-01-10 21:57:50 +01:00
];
2021-11-23 22:17:41 +01:00
};
2021-11-30 20:25:33 +01:00
nix = {
2023-11-25 16:09:08 +01:00
daemonCPUSchedPolicy = "idle";
2023-05-29 15:20:49 +02:00
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
2022-02-16 22:19:13 +01:00
registry = {
2023-05-29 15:20:49 +02:00
nixpkgs.flake = inputs.nixpkgs;
nix-config.flake = inputs.self;
};
2022-12-01 22:43:09 +01:00
package = pkgs.nix;
settings = {
warn-dirty = false;
auto-optimise-store = true;
2024-02-02 13:45:05 +01:00
experimental-features = [
"nix-command"
"flakes"
2024-03-01 11:39:58 +01:00
"repl-flake"
2024-02-02 13:45:05 +01:00
];
trusted-users = [
"root"
"@wheel"
];
2024-02-04 14:15:54 +01:00
substituters = [ "https://nix-community.cachix.org" ];
trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
2022-12-06 22:15:56 +01:00
min-free = 1000000000;
max-free = 10000000000;
connect-timeout = 5;
fallback = true;
2022-12-01 22:43:09 +01:00
};
2021-11-30 20:25:33 +01:00
# enable garbage collection
gc = {
automatic = true;
dates = "16:00";
options = "--delete-older-than 30d";
2021-11-30 20:25:33 +01:00
};
2024-03-06 16:49:19 +01:00
optimise = {
automatic = true;
dates = [ "17:00" ];
};
2021-11-23 22:17:41 +01:00
};
2021-11-30 20:25:33 +01:00
2024-02-02 13:45:05 +01:00
security.sudo = {
wheelNeedsPassword = false;
};
2023-05-29 12:26:02 +02:00
2023-07-06 10:06:54 +02:00
system.activationScripts.diff = {
supportsDryActivation = true;
text = ''
2023-07-07 13:35:15 +02:00
if [[ -e /run/current-system ]]; then
2023-07-07 13:37:19 +02:00
${pkgs.nix}/bin/nix store diff-closures /run/current-system "$systemConfig"
2023-07-07 13:35:15 +02:00
fi
2023-07-06 10:06:54 +02:00
'';
};
2022-01-16 17:20:10 +01:00
2021-11-23 22:17:41 +01:00
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
2024-02-04 13:58:16 +01:00
system.stateVersion = "23.11";
2021-11-23 22:17:41 +01:00
}