nixos_forgejo/configuration.nix

134 lines
3.9 KiB
Nix
Raw Normal View History

2024-01-24 11:26:26 +01:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`).
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
2024-01-24 12:12:44 +01:00
# Enable Flakes and the new command-line tool
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Set default editor to vim
environment.variables.EDITOR = "vim";
2024-01-24 12:27:08 +01:00
# Use UEFI
boot.loader.systemd-boot.enable = true;
2024-01-24 11:26:26 +01:00
# Use the GRUB 2 boot loader.
2024-01-24 12:12:44 +01:00
#boot.loader.grub.enable = true;
#boot.loader.grub.device = "/dev/sda";
2024-01-24 11:26:26 +01:00
2024-02-14 02:42:19 +01:00
networking.hostName = "forgejo"; # Define your hostname.
2024-01-24 11:26:26 +01:00
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Define groups because apparently we gotta do that
# users.groups.onedriveaccess = {};
# users.groups.onedriveaccess.gid = 3000;
# Define a user account. Don't forget to set a password with passwd.
users.users.lyn = {
isNormalUser = true;
extraGroups = [ "wheel"];
openssh.authorizedKeys.keys = [
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC7NUaBJOYgMnT2uUUUSB7gKaqqbgxXDghBkRqSGuZrAZzZYHlHH7nM6Re7+yOYMSoJGLaB4iaUDLSBBnyA6pLI= nixos_gitea@secretive.MacBook-Pro-(2).local"
];
packages = with pkgs; [
];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
2024-01-24 12:12:44 +01:00
git
2024-01-24 11:26:26 +01:00
vim
wget
2024-02-16 01:01:21 +01:00
curl
borgbackup
2024-01-24 11:26:26 +01:00
];
# Create folders
# systemd.tmpfiles.rules = [
# "d /mnt/onedrive/Timemachine 0772 lyn onedriveaccess"
#];
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
X11Forwarding = true;
PermitRootLogin = "no";
PasswordAuthentication = false;
};
openFirewall = true;
};
#Forgejo
services.forgejo = {
enable = true;
settings.server = {
ROOT_URL = "https://git.shibe.pro";
DOMAIN = "git.shibe.pro";
HTTP_PORT = 48540;
OFFLINE_MODE = true; # disable gravatar, CDN
2024-02-16 04:22:38 +01:00
};
settings.actions = {
ENABLED = true;
};
settings.service.DISABLE_REGISTRATION = true;
database = {
user = "forgejo";
passwordFile = "/etc/nixos/forgejo-dbpassword";
name = "forgejodb";
type = "mysql";
};
};
# Allow forgejo user to adjust authorized_keys dynamically
services.openssh.extraConfig = ''
Match User forgejo
AuthorizedKeysFile ${config.users.users.forgejo.home}/.ssh/authorized_keys
'';
#enable qemu-guestagent
2024-01-24 12:52:09 +01:00
services.qemuGuest.enable = true;
2024-01-24 11:26:26 +01:00
# Disable password checking for wheel group users so we can solely rely on ssh keys
security.sudo.wheelNeedsPassword = false;
# Firewall stuff:
networking.firewall.enable = true;
networking.firewall.allowPing = true;
2024-01-24 11:26:26 +01:00
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [48540 ];
2024-01-24 11:26:26 +01:00
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# 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. It's 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).
system.stateVersion = "23.05"; # Did you read the comment?
}