summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
Diffstat (limited to 'hosts')
-rw-r--r--hosts/oixos/cgit.nix67
-rw-r--r--hosts/oixos/default.nix109
-rw-r--r--hosts/oixos/disko.nix36
-rw-r--r--hosts/oixos/hardware-configuration.nix28
4 files changed, 240 insertions, 0 deletions
diff --git a/hosts/oixos/cgit.nix b/hosts/oixos/cgit.nix
new file mode 100644
index 0000000..825f614
--- /dev/null
+++ b/hosts/oixos/cgit.nix
@@ -0,0 +1,67 @@
+{ pkgs, ... }:
+let
+ cgitPkg = pkgs.cgit;
+in
+{
+ users.groups.git = { };
+ users.users.git = {
+ isSystemUser = true;
+ group = "git";
+ home = "/var/lib/git";
+ createHome = true;
+ shell = "${pkgs.git}/bin/git-shell";
+ };
+
+ environment.etc."cgitrc".text = ''
+ root-title=beeb5k git repos
+ root-desc=Personal Code Repositories
+ scan-path=/var/lib/git
+ enable-http-clone=1
+ clone-prefix=https://git.beeb5k.space
+
+ css=/cgit-css/cgit.css
+ logo=/cgit-css/cgit.png
+ favicon=/favicon.ico
+
+ readme=:README.md
+ readme=:README.txt
+ readme=:README
+ '';
+
+ services.fcgiwrap.instances.cgit = {
+ process = {
+ user = "git";
+ group = "git";
+ };
+ socket = {
+ type = "unix";
+ address = "/run/fcgiwrap-cgit.sock";
+ user = "git";
+ group = "caddy";
+ mode = "0660";
+ };
+ };
+
+ services.caddy = {
+ enable = true;
+
+ virtualHosts."git.beeb5k.space".extraConfig = ''
+ # Article: location /cgit-css/ { alias /usr/share/cgit/; }
+ handle_path /cgit-css/* {
+ root * ${pkgs.cgit}/cgit
+ file_server
+ }
+
+ # Article: location / { fastcgi_pass ... fastcgi_param SCRIPT_FILENAME ... }
+ handle {
+ reverse_proxy unix//run/fcgiwrap-cgit.sock {
+ transport fastcgi {
+ env DOCUMENT_ROOT ${pkgs.cgit}/cgit
+ env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi
+ env CGIT_CONFIG /etc/cgitrc
+ }
+ }
+ }
+ '';
+ };
+}
diff --git a/hosts/oixos/default.nix b/hosts/oixos/default.nix
new file mode 100644
index 0000000..ba853e2
--- /dev/null
+++ b/hosts/oixos/default.nix
@@ -0,0 +1,109 @@
+{
+ systemState,
+ user,
+ hostname,
+}:
+{
+ pkgs,
+ config,
+ inputs,
+ lib,
+ ...
+}:
+{
+ imports = [
+ inputs.disko.nixosModules.disko
+ ./disko.nix
+ ./hardware-configuration.nix
+ ./cgit.nix
+ ];
+
+ nix.settings = {
+ trusted-users = [ "@wheel" ];
+ experimental-features = [
+ "nix-command"
+ "flakes"
+ ];
+ auto-optimise-store = true;
+ };
+
+ services.chrony.enable = true;
+
+ time.timeZone = "UTC";
+ i18n.defaultLocale = "en_US.UTF-8";
+
+ boot.loader.systemd-boot = {
+ enable = true;
+ editor = false;
+ };
+ boot.loader.timeout = 0;
+ boot.loader.efi.canTouchEfiVariables = false;
+
+ # boot.loader.grub = {
+ # efiSupport = true;
+ # efiInstallAsRemovable = true;
+ # };
+
+ networking.hostName = hostname;
+ networking.firewall.enable = true;
+ networking.firewall.allowedTCPPorts = [
+ 80
+ 443
+ ];
+ networking.firewall.allowedUDPPorts = [ ];
+
+ networking.useDHCP = true;
+
+ services.openssh = {
+ enable = true;
+ settings = {
+ PermitRootLogin = "prohibit-password";
+ PasswordAuthentication = false;
+ };
+ };
+
+ users.users.beeb5k = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" ];
+
+ openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTMc0gNGM6vI8s9CrW+fYlW4ppRTKRCELOve3Izj1VD beeb5k"
+ ];
+ };
+
+ services.cloud-init.enable = true;
+
+ users.users.root.openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTMc0gNGM6vI8s9CrW+fYlW4ppRTKRCELOve3Izj1VD beeb5k"
+ ];
+
+ environment.systemPackages = with pkgs; [
+ git
+ fastfetch
+ ];
+
+ # security.sudo.wheelNeedsPassword = false;
+
+ programs.bash.promptInit = ''
+ if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
+ # Removed the '1;' prefix to disable bold
+ PROMPT_COLOR="31m"
+ ((UID)) && PROMPT_COLOR="32m"
+
+ if [ -n "$INSIDE_EMACS" ]; then
+ PS1="\[\033[$PROMPT_COLOR\]\u@\h:\w\\$\[\033[0m\] "
+ else
+ PS1="\[\e[94m\]\u@\h \[\e[32m\]\w \[\e[39m\]\$ \[\e[0m\]"
+ fi
+
+ if test "$TERM" = "xterm"; then
+ PS1="\[\033]2;\h:\u:\w\007\]$PS1"
+ fi
+ fi
+ '';
+
+ nixpkgs.hostPlatform = "aarch64-linux";
+
+ system.stateVersion = systemState;
+
+}
diff --git a/hosts/oixos/disko.nix b/hosts/oixos/disko.nix
new file mode 100644
index 0000000..e77f368
--- /dev/null
+++ b/hosts/oixos/disko.nix
@@ -0,0 +1,36 @@
+{
+ disko.devices = {
+ disk.main = {
+ type = "disk";
+ device = "/dev/sda";
+
+ content = {
+ type = "gpt";
+
+ partitions = {
+ ESP = {
+ size = "1G";
+ type = "EF00";
+
+ content = {
+ type = "filesystem";
+ format = "vfat";
+ mountpoint = "/boot";
+ mountOptions = [ "umask=0077" ];
+ };
+ };
+
+ root = {
+ size = "100%";
+
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/";
+ };
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/hosts/oixos/hardware-configuration.nix b/hosts/oixos/hardware-configuration.nix
new file mode 100644
index 0000000..bddf5a4
--- /dev/null
+++ b/hosts/oixos/hardware-configuration.nix
@@ -0,0 +1,28 @@
+# 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 = [
+ "xhci_pci"
+ "virtio_pci"
+ "virtio_scsi"
+ "usbhid"
+ ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ ];
+ boot.extraModulePackages = [ ];
+
+ nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
+}