From 67c2e702057b8fa2f770f343cf1a600d24df47dc Mon Sep 17 00:00:00 2001 From: kat Date: Fri, 16 Sep 2022 10:41:11 -0700 Subject: [PATCH] ops: tewi init --- darwin/systems/sumireko.nix | 89 +++++++++++++++--------------- home/default.nix | 10 +++- home/vim/init.lua | 2 +- home/work/packages.nix | 4 ++ modules/darwin/applications.nix | 13 +++++ nixos/systems/tewi.nix | 71 ++++++++++++++++++++++++ overlays/local/default.nix | 2 +- overlays/local/wezterm/default.nix | 2 + services/tvheadend.nix | 9 ++- tf | 2 +- 10 files changed, 154 insertions(+), 50 deletions(-) create mode 100644 home/work/packages.nix create mode 100644 modules/darwin/applications.nix create mode 100644 nixos/systems/tewi.nix diff --git a/darwin/systems/sumireko.nix b/darwin/systems/sumireko.nix index 983096e5..64c285e0 100644 --- a/darwin/systems/sumireko.nix +++ b/darwin/systems/sumireko.nix @@ -1,9 +1,9 @@ { config, pkgs, lib, inputs, meta, ... }: { imports = with meta; [ hardware.aarch64-darwin - darwin.base - darwin.kat - home.emacs + darwin.base + darwin.kat + home.work ]; security.pam.enableSudoTouchIdAuth = true; @@ -26,27 +26,27 @@ nix = { envVars = { - "SSH_AUTH_SOCK" = "/Users/kat/.gnupg/S.gpg-agent.ssh"; + "SSH_AUTH_SOCK" = "/Users/kat/.gnupg/S.gpg-agent.ssh"; }; buildMachines = [ - { - hostName = "renko-build"; - sshUser = "root"; - system = "x86_64-linux"; - maxJobs = 100; - speedFactor = 1; - supportedFeatures = [ "benchmark" "big-parallel" "kvm" ]; - mandatoryFeatures = [ ]; - } - { - hostName = "daiyousei-build"; - sshUser = "root"; - system = "aarch64-linux"; - maxJobs = 100; - speedFactor = 1; - supportedFeatures = [ "benchmark" "big-parallel" "kvm" ]; - mandatoryFeatures = [ ]; - } + { + hostName = "renko-build"; + sshUser = "root"; + system = "x86_64-linux"; + maxJobs = 100; + speedFactor = 1; + supportedFeatures = [ "benchmark" "big-parallel" "kvm" ]; + mandatoryFeatures = [ ]; + } + { + hostName = "daiyousei-build"; + sshUser = "root"; + system = "aarch64-linux"; + maxJobs = 100; + speedFactor = 1; + supportedFeatures = [ "benchmark" "big-parallel" "kvm" ]; + mandatoryFeatures = [ ]; + } ]; distributedBuilds = true; }; @@ -54,29 +54,30 @@ homebrew = { brewPrefix = "/opt/homebrew/bin"; casks = [ - "element" - "visual-studio-code" - "firefox" - "telegram" - "discord" "utm" - "mullvadvpn" - "bitwarden" - "gimp" - "cyberduck" - ]; - masApps = { - Tailscale = 1475387142; - }; + "mullvadvpn" + "android-studio" + "bitwarden" + "telegram" + "deluge" + "element" + "discord" + "firefox" + "gimp" + "cyberduck" + "docker" + "google-chrome" + "android-studio" + "linear-linear" + "pycharm-ce" + "parsec" + "nextcloud" + "slack" + ]; + masApps = { + Tailscale = 1475387142; }; - - environment.systemPackages = with pkgs; [ - terraform - yt-dlp - k2tf - awscli - jq - ]; + }; system.stateVersion = 4; -} + } diff --git a/home/default.nix b/home/default.nix index df8daa60..259cfa6c 100644 --- a/home/default.nix +++ b/home/default.nix @@ -43,6 +43,14 @@ in gtk qt ]; - }; + }; + work = { + imports = with dirImports; [ + work + wezterm + emacs + ]; + }; + services = serviceImports; } diff --git a/home/vim/init.lua b/home/vim/init.lua index 54a2c2be..f98387ac 100644 --- a/home/vim/init.lua +++ b/home/vim/init.lua @@ -84,7 +84,7 @@ opt.hlsearch = true -- Highlight matches with last sea ----------------------------------------------------------- -- Tabs, indent ----------------------------------------------------------- -opt.expandtab = false -- Use spaces instead of tabs +opt.expandtab = true -- Use spaces instead of tabs opt.shiftwidth = 2 -- Shift 2 spaces when tab opt.tabstop = 2 -- 1 tab == 2 spaces opt.smartindent = true -- Autoindent new lines diff --git a/home/work/packages.nix b/home/work/packages.nix new file mode 100644 index 00000000..68ddea43 --- /dev/null +++ b/home/work/packages.nix @@ -0,0 +1,4 @@ +{ config, pkgs, ... }: { + home.packages = with pkgs; [ + ]; +} diff --git a/modules/darwin/applications.nix b/modules/darwin/applications.nix new file mode 100644 index 00000000..d6d69fdf --- /dev/null +++ b/modules/darwin/applications.nix @@ -0,0 +1,13 @@ +{config, pkgs, ... }: { + system.activationScripts.applications.text = pkgs.lib.mkForce ( + '' + echo "setting up ~/Applications..." >&2 + rm -rf ~/Applications/Nix\ Apps + mkdir -p ~/Applications/Nix\ Apps + for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do + src="$(/usr/bin/stat -f%Y "$app")" + cp -r "$src" ~/Applications/Nix\ Apps + done + '' + ); +} diff --git a/nixos/systems/tewi.nix b/nixos/systems/tewi.nix new file mode 100644 index 00000000..c11e2c64 --- /dev/null +++ b/nixos/systems/tewi.nix @@ -0,0 +1,71 @@ +{ meta, config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + + ]; + + deploy.tf = { + resources.tewi = { + provider = "null"; + type = "resource"; + connection = { + port = lib.head config.services.openssh.ports; + host = config.network.addresses.private.nixos.ipv4.address; + }; + }; + }; + + networking = { + useDHCP = false; + interfaces = { + eno1 = { + useDHCP = true; + }; + }; + }; + + network = { + addresses = { + private = { + enable = true; + nixos = { + ipv4.address = "10.1.1.38"; + }; + }; + }; + }; + + boot = { + loader = { + systemd-boot = { + enable = true; + }; + efi = { + canTouchEfiVariables = true; + }; + }; + initrd = { + availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + }; + kernelModules = [ "kvm-intel" ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/6c5d82b1-5d11-4c72-96c6-5f90e6ce57f5"; + fsType = "ext4"; + }; + "/boot" = { + device = "/dev/disk/by-uuid/85DC-72FA"; + fsType = "vfat"; + }; + }; + + swapDevices = lib.singleton ({ + device = "/dev/disk/by-uuid/137605d3-5e3f-47c8-8070-6783ce651932"; + }); + + system.stateVersion = "21.05"; +} diff --git a/overlays/local/default.nix b/overlays/local/default.nix index e7848271..e22ac4b3 100644 --- a/overlays/local/default.nix +++ b/overlays/local/default.nix @@ -12,6 +12,6 @@ final: prev: { gensokyoZone = final.callPackage ./gensokyoZone { }; oomox = final.callPackage ./oomox.nix { }; wezterm = final.callPackage ./wezterm { - inherit (final.darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation; + inherit (final.darwin.apple_sdk.frameworks) Cocoa CoreGraphics Foundation UserNotifications; }; } diff --git a/overlays/local/wezterm/default.nix b/overlays/local/wezterm/default.nix index 3a4ce5a9..e623d003 100644 --- a/overlays/local/wezterm/default.nix +++ b/overlays/local/wezterm/default.nix @@ -21,6 +21,7 @@ , CoreGraphics , Cocoa , Foundation +, UserNotifications , libiconv , nixosTests , runCommand @@ -69,6 +70,7 @@ rustPlatform.buildRustPackage rec { ] ++ lib.optionals stdenv.isDarwin [ Cocoa CoreGraphics + UserNotifications Foundation libiconv ]; diff --git a/services/tvheadend.nix b/services/tvheadend.nix index 28513ffb..7e873e2d 100644 --- a/services/tvheadend.nix +++ b/services/tvheadend.nix @@ -7,9 +7,14 @@ users.users.tvheadend.group = "tvheadend"; users.groups.tvheadend = {}; - network.firewall.public = { + network.firewall = { + private = { tcp.ports = [ 9981 9982 ]; - }; + }; + public = { + tcp.ports = [ 9981 9982 ]; + }; + }; systemd.services.antennas = { wantedBy = [ "plex.service" ]; diff --git a/tf b/tf index f16be2a9..68e0630d 160000 --- a/tf +++ b/tf @@ -1 +1 @@ -Subproject commit f16be2a91179d35803e30d3f4a8233156a8faa3f +Subproject commit 68e0630db630afab4152e4a3ae8a6837675c016f