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.nix79
2 files changed, 131 insertions, 15 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
index 416e2f2..ba853e2 100644
--- a/hosts/oixos/default.nix
+++ b/hosts/oixos/default.nix
@@ -15,32 +15,61 @@
inputs.disko.nixosModules.disko
./disko.nix
./hardware-configuration.nix
+ ./cgit.nix
];
- boot.loader.grub = {
- efiSupport = true;
- efiInstallAsRemovable = true;
+ 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;
- # };
+ settings = {
+ PermitRootLogin = "prohibit-password";
+ PasswordAuthentication = false;
+ };
};
- # users.users.beeb5k = {
- # isNormalUser = true;
- # extraGroups = [ "wheel" ];
- #
- # openssh.authorizedKeys.keys = [
- # "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTMc0gNGM6vI8s9CrW+fYlW4ppRTKRCELOve3Izj1VD beeb5k"
- # ];
- # };
+ users.users.beeb5k = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" ];
+
+ openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTMc0gNGM6vI8s9CrW+fYlW4ppRTKRCELOve3Izj1VD beeb5k"
+ ];
+ };
services.cloud-init.enable = true;
@@ -50,11 +79,31 @@
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;
+
}