From 1f817cd366fd2f2031170fed0efc97e061688847 Mon Sep 17 00:00:00 2001 From: tom Date: Fri, 2 Aug 2024 23:24:37 +0200 Subject: [PATCH] init --- configuration.nix | 173 +++++++++++++++++++++++++++++++++++++ hardware-configuration.nix | 37 ++++++++ 2 files changed, 210 insertions(+) create mode 100644 configuration.nix create mode 100644 hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..dae820c --- /dev/null +++ b/configuration.nix @@ -0,0 +1,173 @@ +# 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 = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "gitea"; # Define your hostname. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Zurich"; + + system.autoUpgrade = { + enable = true; + allowReboot = true; + rebootWindow = { + lower = "01:00"; + upper = "03:00"; + }; + }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "ch"; + variant = ""; + }; + + # Configure console keymap + console.keyMap = "sg"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.tte = { + isNormalUser = true; + description = "tte"; + extraGroups = [ "networkmanager" "wheel" "docker" ]; + packages = with pkgs; []; + }; + + users.users.gitea.extraGroups = [ "docker" ]; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim + wget + tmux + curl + ethtool + git + gitea + nginx + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + #services.gitea.enable = true; + services.nginx.enable = true; + + services.gitea = { + enable = true; + appName = "Gh0st's git"; + settings = { +# other = { + "git.timeout" = { +# "DEFAULT = 360" + MIGRATE = 6000; +# "MIRROR = 300" +# "CLONE = 300" +# "PULL = 300" +# "GC = 60" + }; +# }; + }; + settings.server = { + DOMAIN = "git.blubb.fish"; + ROOT_URL = "https://git.blubb.fish"; + SSH_PORT = 2222; + DISABLE_SSH = true; + }; + }; + + services.nginx.virtualHosts."git.blubb.fish" = { + addSSL = true; + sslCertificate = /cert/git.blubb.fish/cert.pem; + sslCertificateKey = /cert/git.blubb.fish/key.pem; + sslTrustedCertificate = /cert/git.blubb.fish/fullchain.pem; + locations."/".proxyPass = "http://127.0.0.1:3000/"; + }; + + virtualisation.docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + + virtualisation.oci-containers.containers = { + act_runner_01 = { + image = "gitea/act_runner"; + environment = { + GITEA_INSTANCE_URL = "http://10.0.0.24:3000"; + GITEA_RUNNER_REGISTRATION_TOKEN = "GPf0fQ10T56S5UMb8Mrr7674V1VWjOQaDDuo1CRQ"; + GITEA_RUNNER_NAME = "runner01"; + GITEA_RUNNER_LABELS = "ubuntu-latest"; + }; + volumes = [ + "/root/docker/runner01/data:/data" + "/var/run/docker.sock:/var/run/docker.sock" + ]; + }; + act_runner_02 = { + image = "gitea/act_runner"; + environment = { + GITEA_INSTANCE_URL = "http://10.0.0.24:3000"; + GITEA_RUNNER_REGISTRATION_TOKEN = "GPf0fQ10T56S5UMb8Mrr7674V1VWjOQaDDuo1CRQ"; + GITEA_RUNNER_NAME = "runner02"; + GITEA_RUNNER_LABELS = "ubuntu-latest"; + }; + volumes = [ + "/root/docker/runner02/data:/data" + "/var/run/docker.sock:/var/run/docker.sock" + ]; + }; + }; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 22 443 3000 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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 = "24.05"; # Did you read the comment? + +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..edee4f3 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,37 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d8c04794-960c-4ea5-84c9-afc64b7330fc"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F8ED-1102"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}