home/nixos/base.nix
2024-06-09 20:24:55 +02:00

100 lines
2.4 KiB
Nix

{
system, pkgs, nixpkgs-flake, hostname,
use-efi ? false, efi-mountpoint ? "/boot",
use-grub ? false, grub-device ? "/dev/sda",
}:
{
nixpkgs.config.allowUnfree = true; # lol
nix.gc = {
automatic = true;
dates = "03:00";
};
nix.registry = {
templates = {
from = { type = "indirect"; id = "templates"; };
to = { type = "git"; url = "https://githug.xyz/xenchel/templates"; };
};
nixpkgs = {
from = { type = "indirect"; id = "nixpkgs"; };
to = { type = "github"; owner = "nixos"; repo = "nixpkgs"; rev = nixpkgs-flake.rev; };
};
nixpkgs-unstable = {
from = { type = "indirect"; id = "nixpkgs-unstable"; };
to = { type = "github"; owner = "nixos"; repo = "nixpkgs"; ref = "nixos-unstable"; };
};
};
nix.nixPath = [ "nixpkgs=${pkgs.path}" ];
networking.hostName = hostname;
boot.loader = if use-efi
then {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
efi.efiSysMountPoint = efi-mountpoint;
} else if use-grub then {
grub.enable = true;
grub.devce = grub-device;
} else throw "Please use either use-efi or use-grub = true";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Stockholm";
services.logind.lidSwitch = "ignore";
services.logind.lidSwitchDocked = "ignore";
services.openssh = {
enable = true;
ports = [ 24 ]; # TODO: Set up honeypot on port 22
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
programs.mosh.enable = true;
# TODO: Options for more users
users.users.coral = { # hi # hi
isNormalUser = true;
extraGroups = [ "wheel" "docker" ];
shell = pkgs.zsh;
};
users.users.guest = {
isNormalUser = true;
extraGroups = [ ];
home = "/home/guest";
shell = pkgs.zsh;
};
security.sudo.wheelNeedsPassword = false;
environment.systemPackages = with pkgs; [
binutils
coreutils
home-manager
git # for home-manager
];
programs.zsh.enable = true;
programs.java = { enable = true; package = pkgs.jdk11; };
virtualisation.docker.enable = true;
networking.resolvconf.enable = true;
networking.nameservers = [ "8.8.8.8" ];
networking.resolvconf.dnsExtensionMechanism = false; # edns seems to be fucky with this enabled
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
system.stateVersion = "22.11"; # Did you read the comment?
}