From 566dc1e8f6e619f590f017a810a8a55d9a90a25c Mon Sep 17 00:00:00 2001 From: tzlil Date: Thu, 9 Feb 2023 14:03:19 +0200 Subject: add website (caddy) config, add mpd, add pc config, remove 9p mount from run.sh, improve greet mixin --- hosts/pc/cfg.nix | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ hosts/vm/cfg.nix | 8 ++--- hosts/vps/cfg.nix | 4 +-- hosts/vps/website.nix | 15 +++++++++ mixins/greet.nix | 2 +- mixins/mpd.nix | 11 ++++++ run.sh | 2 +- 7 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 hosts/pc/cfg.nix create mode 100644 hosts/vps/website.nix create mode 100644 mixins/mpd.nix diff --git a/hosts/pc/cfg.nix b/hosts/pc/cfg.nix new file mode 100644 index 0000000..10267b5 --- /dev/null +++ b/hosts/pc/cfg.nix @@ -0,0 +1,93 @@ +{config, lib, pkgs, ...}: { + imports = [ + ../../profiles/core.nix + ../../profiles/user.nix + ../../profiles/ssh.nix + ../../profiles/graphical.nix + ../../mixins/tailscale.nix + ../../mixins/cli.nix + ../../mixins/greet.nix + # ../../mixins/hyprland.nix + ../../mixins/sway.nix + ]; + + config = { + _module.args.nixinate = { + host = "pc"; + sshUser = "tzlil"; + buildOn = "remote"; # valid args are "local" or "remote" + substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s" + hermetic = false; + }; + networking.hostName = "pc"; + + + boot = { + initrd = { + supportedFilesystems = ["btrfs"]; + availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; + }; + kernelModules = [ "kvm-amd" ]; + kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + kernelParams = [ + "console=ttyS0" + "init_on_free=1" + "page_poison=1" + "page_alloc.shuffle=1" + "slab_nomerge" + "vsyscall=none" + ]; + cleanTmpDir = true; + loader = { + systemd-boot = { + enable = true; + }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + }; + }; + + time.timeZone = lib.mkDefault "Israel"; + + fileSystems = { + "/" = + { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + "/nix" = + { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + "/home" = + { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + "/swap" = + { device = "/dev/disk/by-uuid/3fe7d38b-bb95-41ca-afce-1b0b89cbcd8b"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; + }; + "/boot" = + { device = "/dev/disk/by-uuid/D999-2D99"; + fsType = "vfat"; + }; + }; + + zramSwap = { + enable = true; + algorithm = "zstd"; + }; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.video.hidpi.enable = lib.mkDefault true; + # greeter.initialSession = "sh -c hyprland"; + }; +} \ No newline at end of file diff --git a/hosts/vm/cfg.nix b/hosts/vm/cfg.nix index 4084ef9..4af1667 100644 --- a/hosts/vm/cfg.nix +++ b/hosts/vm/cfg.nix @@ -3,12 +3,12 @@ ../../profiles/core.nix ../../profiles/user.nix ../../profiles/ssh.nix - # ../../profiles/graphical.nix + ../../profiles/graphical.nix ../../mixins/tailscale.nix ../../mixins/cli.nix - # ../../mixins/greet.nix + ../../mixins/greet.nix # ../../mixins/hyprland.nix - # ../../mixins/sway.nix + ../../mixins/sway.nix ]; config = { @@ -72,6 +72,6 @@ algorithm = "zstd"; }; - # greeter.initialSession = "sh -c hyprland"; + # greeter.initialSession = "sh -c sway"; }; } \ No newline at end of file diff --git a/hosts/vps/cfg.nix b/hosts/vps/cfg.nix index 25da42b..3e220c3 100644 --- a/hosts/vps/cfg.nix +++ b/hosts/vps/cfg.nix @@ -9,8 +9,8 @@ config = { _module.args.nixinate = { - host = "100.67.217.90"; - sshUser = "nixos"; + host = "vps"; + sshUser = "tzlil"; buildOn = "remote"; # valid args are "local" or "remote" substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s" hermetic = false; diff --git a/hosts/vps/website.nix b/hosts/vps/website.nix new file mode 100644 index 0000000..156e5da --- /dev/null +++ b/hosts/vps/website.nix @@ -0,0 +1,15 @@ +{ pkgs, config, ... }: + +{ + config = { + services.caddy = { + enable = true; + virtualHosts."https://tzlil.club".extraConfig = '' + try_files ${pkgs.writeText "index.html" '' + hello world + ''} / + ''; + }; + networking.firewall.allowedTCPPorts = [443]; + }; +} \ No newline at end of file diff --git a/mixins/greet.nix b/mixins/greet.nix index 755b7f8..e345d91 100644 --- a/mixins/greet.nix +++ b/mixins/greet.nix @@ -16,7 +16,7 @@ in { options.greeter.initialSession = lib.mkOption { type = lib.types.str; - default = "sh -c sway"; + default = "sh -c ${pkgs.sway}/bin/sway"; }; config = { diff --git a/mixins/mpd.nix b/mixins/mpd.nix new file mode 100644 index 0000000..3730802 --- /dev/null +++ b/mixins/mpd.nix @@ -0,0 +1,11 @@ +{ pkgs, config, ... }: + +{ + home-manager.users.tzlil = {pkgs, ...}@hm: { + services = { + mpd.enable = true; + mpdris2.enable = true; + }; + programs.ncmpcpp.enable = true; + }; +} \ No newline at end of file diff --git a/run.sh b/run.sh index 7e89e0d..c1f601b 100755 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ #!/bin/sh -qemu-kvm -enable-kvm -m 4G -cpu host -smp 2 -hda nixos-test.img -virtfs local,path=/home/tzlil/newflake,mount_tag=host0,security_model=passthrough,id=host0 -bios OVMF.fd -vga virtio -display gtk,gl=on,show-cursor=on -usb -device usb-mouse +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 -- cgit 1.4.1