From d4896b353eed0ab37cf8a2591fe1f5369c37883f Mon Sep 17 00:00:00 2001 From: tzlil Date: Thu, 16 Feb 2023 16:40:26 +0200 Subject: stuff --- hosts/vm/cfg.nix | 6 ++++-- hosts/vps/cfg.nix | 2 ++ hosts/vps/git.nix | 40 ++++++++++++++++++++++++++++++++++++++++ hosts/vps/matrix.nix | 23 +++++++++++++++++++++++ hosts/vps/website.nix | 14 ++++++++------ mixins/cli.nix | 7 +++++++ mixins/greet.nix | 2 +- mixins/multimedia.nix | 17 +++++++++++++++++ mixins/sway.nix | 2 +- profiles/gentoo.nix | 9 +++++++++ run.sh | 14 +++++++++++++- 11 files changed, 125 insertions(+), 11 deletions(-) create mode 100644 hosts/vps/git.nix create mode 100644 hosts/vps/matrix.nix create mode 100644 mixins/multimedia.nix diff --git a/hosts/vm/cfg.nix b/hosts/vm/cfg.nix index 4af1667..f9907e4 100644 --- a/hosts/vm/cfg.nix +++ b/hosts/vm/cfg.nix @@ -1,4 +1,4 @@ -{config, lib, pkgs, ...}: { +{config, lib, pkgs, modulesPath, ...}: { imports = [ ../../profiles/core.nix ../../profiles/user.nix @@ -9,6 +9,7 @@ ../../mixins/greet.nix # ../../mixins/hyprland.nix ../../mixins/sway.nix + (modulesPath + "/profiles/qemu-guest.nix") ]; config = { @@ -28,6 +29,7 @@ boot = { initrd = { supportedFilesystems = ["btrfs"]; + availableKernelModules = [ "ata_piix" "uhci_hcd" "floppy" "sd_mod" "sr_mod" ]; }; kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; kernelParams = [ @@ -72,6 +74,6 @@ algorithm = "zstd"; }; - # greeter.initialSession = "sh -c sway"; + greeter.initialSession = "env WLR_RENDERER=pixman sh -c ${pkgs.sway}/bin/sway"; }; } \ No newline at end of file diff --git a/hosts/vps/cfg.nix b/hosts/vps/cfg.nix index 3e220c3..a8159ea 100644 --- a/hosts/vps/cfg.nix +++ b/hosts/vps/cfg.nix @@ -5,6 +5,8 @@ ../../profiles/ssh.nix ../../mixins/tailscale.nix ../../mixins/cli.nix + ./website.nix + ./git.nix ]; config = { diff --git a/hosts/vps/git.nix b/hosts/vps/git.nix new file mode 100644 index 0000000..3ad26c0 --- /dev/null +++ b/hosts/vps/git.nix @@ -0,0 +1,40 @@ +{ pkgs, config, ... }: + +{ + config = { + users.users.git = { + isSystemUser = true; + description = "git"; + home = "/home/git"; + shell = "${pkgs.git}/bin/git-shell"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDyzrs9sbstv3KFK5FV8qYlSknnEy8Cn+qch4dJLmHA" + ]; + }; + services = { + fcgiwrap.enable = true; + caddy = { + virtualHosts."http://localhost".extraConfig = '' + reverse_proxy localhost:5678 { + transport fastcgi { + env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi + env CGIT_CONFIG ${pkgs.writeText "cgitrc" (lib.generators.toKeyValue { } { + clone-url = (lib.concatStringsSep " " [ + "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" + "ssh://git@git.example.com:$CGIT_REPO_URL" + ]); + enable-log-filecount = 1; + enable-log-linecount = 1; + enable-git-config = 1; + root-title = "git.example.com"; + root-desc = "Tzlil's Git Repositories"; + scan-path = "/home/git"; + })} + } + } + ''; + } + }; + environment.persistence."/nix/persist".directories = [ "/home/git" ]; + }; +} \ No newline at end of file diff --git a/hosts/vps/matrix.nix b/hosts/vps/matrix.nix new file mode 100644 index 0000000..cb13326 --- /dev/null +++ b/hosts/vps/matrix.nix @@ -0,0 +1,23 @@ +{ pkgs, config, ... }: + +{ + config = { + services.matrix-synapse = { + enable = true; + settings.server_name = config.networking.domain; + settings.listeners = [ + { port = 8008; + bind_addresses = [ "::1" ]; + type = "http"; + tls = false; + x_forwarded = true; + resources = [ { + names = [ "client" "federation" ]; + compress = true; + } ]; + } + ]; + }; + networking.firewall.allowedTCPPorts = [80 443]; + }; +} \ No newline at end of file diff --git a/hosts/vps/website.nix b/hosts/vps/website.nix index 156e5da..9dc9fc7 100644 --- a/hosts/vps/website.nix +++ b/hosts/vps/website.nix @@ -4,12 +4,14 @@ config = { services.caddy = { enable = true; - virtualHosts."https://tzlil.club".extraConfig = '' - try_files ${pkgs.writeText "index.html" '' - hello world - ''} / - ''; + # virtualHosts = { + # "http://localhost".extraConfig = '' + # try_files ${pkgs.writeText "index.html" '' + # hello world + # ''} / + # ''; + # }; }; - networking.firewall.allowedTCPPorts = [443]; + networking.firewall.allowedTCPPorts = [80 443]; }; } \ No newline at end of file diff --git a/mixins/cli.nix b/mixins/cli.nix index 61153d3..0d82ed1 100644 --- a/mixins/cli.nix +++ b/mixins/cli.nix @@ -15,6 +15,8 @@ rsync curl ripgrep + bat + croc ]; }; programs = { @@ -24,11 +26,16 @@ userEmail = "tzlils@protonmail.com"; enable = true; }; + direnv = { + enable = true; + nix-direnv.enable = true; + }; fish = { enable = true; shellAliases = { gc = "git clone"; l = "ls -alh"; + b = "bat"; }; functions = { sb.body = "nixos-rebuild build --flake git+ssh://pc/home/tzlil/newflake --use-remote-sudo"; diff --git a/mixins/greet.nix b/mixins/greet.nix index e345d91..0006eaf 100644 --- a/mixins/greet.nix +++ b/mixins/greet.nix @@ -9,7 +9,7 @@ users.users.greeter.packages = [pkgs.sway]; greet = "${pkgs.greetd.wlgreet}/bin/wlgreet"; - sway-kiosk = command: "${pkgs.sway}/bin/sway --unsupported-gpu --config ${pkgs.writeText "kiosk.config" '' + sway-kiosk = command: "env WLR_RENDERER=pixman ${pkgs.sway}/bin/sway --unsupported-gpu --config ${pkgs.writeText "kiosk.config" '' output * bg #000000 solid_color exec "${command}; ${pkgs.sway}/bin/swaymsg exit" ''}"; diff --git a/mixins/multimedia.nix b/mixins/multimedia.nix new file mode 100644 index 0000000..a814213 --- /dev/null +++ b/mixins/multimedia.nix @@ -0,0 +1,17 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + config = { + home-manager.users.tzlil = {...}: { + fonts.fontconfig.enable = true; + + home.packages = with pkgs; [ + mpv + zathura + ffmpeg + gimp + transmission + ]; + }; + }; +} \ No newline at end of file diff --git a/mixins/sway.nix b/mixins/sway.nix index 7ff601a..7b99b2c 100644 --- a/mixins/sway.nix +++ b/mixins/sway.nix @@ -236,7 +236,7 @@ in { hide_edge_borders smart smart_borders on - output * bg ~/tmp/graveyard.png fill + # output * bg ~/tmp/graveyard.png fill diff --git a/profiles/gentoo.nix b/profiles/gentoo.nix index 6747ba6..9755fd8 100644 --- a/profiles/gentoo.nix +++ b/profiles/gentoo.nix @@ -3,6 +3,15 @@ { imports = []; config = { + nix.binaryCaches = [ + "https://cache.nixos.org/" + "https://cache.allvm.org/" + ]; + + nix.binaryCachePublicKeys = [ + "gravity.cs.illinois.edu-1:yymmNS/WMf0iTj2NnD0nrVV8cBOXM9ivAkEdO1Lro3U=" + ]; + nativeStdenv = prev.stdenvAdapters.withCFlags [ "-O3" "-pipe" "-march=native" ] (prev.overrideCC prev.llvmPackages_latest.stdenv (prev.wrapCCWith rec { diff --git a/run.sh b/run.sh index c1f601b..984e4cc 100755 --- a/run.sh +++ b/run.sh @@ -1,2 +1,14 @@ #!/bin/sh -qemu-kvm -enable-kvm -m 4G -cpu host -smp 2 -hda nixos-test.img -bios OVMF.fd -vga virtio -display gtk,gl=on,show-cursor=on -usb -device usb-mouse +qemu-system-x86_64 \ + -enable-kvm \ + -m 4G \ + -cpu host \ + -smp 2 \ + -hda nixos-test.img \ + -bios OVMF.fd \ + -display gtk,gl=on,show-cursor=on \ + -vga none \ + -device virtio-gpu-pci \ + -audiodev pa,id=snd0 \ + -usb \ + -device usb-mouse -- cgit 1.4.1