chore: reconfigure nix cloud

This commit is contained in:
Thiago Sposito 2026-01-30 15:25:37 -03:00
parent d5db6daa8c
commit 20e8bd96bd
Signed by: thiago
GPG key ID: 3065EA73A976D430
3 changed files with 73 additions and 71 deletions

View file

@ -1,16 +1,11 @@
{
config,
inputs,
lib,
pkgs,
...
}:
{ ... }:
{
imports = [
./hardware-configuration.nix
./networking.nix
./forgejo.nix
];
boot.loader.grub = {
enable = true;
efiSupport = true; # Enable EFI features
@ -18,69 +13,37 @@
};
boot.tmp.cleanOnBoot = true;
nix = {
registry = (lib.mapAttrs (_: flake: { inherit flake; })) (
(lib.filterAttrs (_: lib.isType "flake")) inputs
);
nixPath = [ "/etc/nix/path" ];
settings = {
download-buffer-size = "512M";
experimental-features = "nix-command flakes";
auto-optimise-store = true;
};
};
environment = {
shells = with pkgs; [ bash ];
etc = lib.mapAttrs' (name: value: {
name = "nix/path/${name}";
value.source = value.flake;
}) config.nix.registry;
systemPackages = with pkgs; [
git
sops
wget
];
};
zramSwap.enable = true;
programs = {
gnupg = {
agent = {
enableSSHSupport = true;
enable = true;
pinentryPackage = pkgs.pinentry-tty;
};
};
};
networking.hostName = "srv1065175";
networking.domain = "hstgr.cloud";
services.openssh.enable = true;
users.users = {
root.openssh.authorizedKeys.keyFiles = [
(builtins.fetchurl {
url = "https://meta.sr.ht/~sposito.keys";
name = "sposito-srht-keys";
sha256 = "1a0qcpbdkmdhnhhqvcmf6rq7zmjap6kxiwrcmmgs0fbhrlcyhkmi";
})
];
nimbus.isNormalUser = true;
nimbus.openssh.authorizedKeys.keys = [
(builtins.fetchurl {
url = "https://meta.sr.ht/~sposito.keys";
name = "sposito-srht-keys";
sha256 = "1a0qcpbdkmdhnhhqvcmf6rq7zmjap6kxiwrcmmgs0fbhrlcyhkmi";
})
users.users.root.openssh.authorizedKeys.keys = [
''ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCjC5EuxC6un3StoRkn1X1Mv09Mx1icGfN5fnlWRfqFPtiwAusJA+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E5AAAAICRAJaRuXqVeAs/Y5CeTbyc9lSbyvchkVqiML/yl6wbh thiago@Nixbook''
];
users.users.nimbus = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
security.sudo.extraRules = [
{
users = [ "nimbus" ];
commands = [
{
command = "ALL";
options = [ "NOPASSWD" ];
}
];
}
];
system.stateVersion = "23.11";
boot.kernelParams = [
"console=tty1"
"console=ttyS0,115200"
];
time.timeZone = "America/Sao_Paulo";
}

View file

@ -0,0 +1,41 @@
{ lib, config, ... }:
let
cfg = config.services.forgejo;
srv = cfg.settings.server;
domain = "git.sposi.to";
in
{
security.acme = {
acceptTerms = true;
defaults.email = "thiago@sposi.to";
};
services.nginx = {
enable = true;
virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
extraConfig = ''
client_max_body_size 512M;
'';
locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}";
};
};
services.forgejo = {
enable = true;
database.type = "sqlite3";
lfs.enable = true;
settings = {
server = {
DOMAIN = domain;
ROOT_URL = "https://${domain}/";
HTTP_PORT = 3000;
};
service.DISABLE_REGISTRATION = true;
};
};
services.forgejo.settings.server.SSH_PORT = lib.mkDefault (lib.head (config.services.openssh.ports or [ 22 ]));
}

View file

@ -1,9 +1,15 @@
{ modulesPath, lib, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.kernelModules = [ "nvme" ];
boot.loader.grub.device = "nodev";
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"xen_blkfront"
"vmw_pvscsi"
];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = {
device = "/dev/sda1";
fsType = "ext4";
@ -12,13 +18,5 @@
device = "/dev/sda15";
fsType = "vfat";
};
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"vmw_pvscsi"
"xen_blkfront"
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}