From adb0a2581666c7d21126c808113cb4d051ce9357 Mon Sep 17 00:00:00 2001 From: Jake Ginesin Date: Wed, 27 Aug 2025 20:04:34 -0400 Subject: [PATCH] generation 503 25.11.20250714.62e0f05 --- extras/kube-master.nix | 3 ++ flake.nix | 54 ++++++------------- home/programs/firefox/default.nix | 8 +++ home/scripts/rebuild-nocommit.sh | 25 +++++++++ hosts/{server => server1}/configuration.nix | 2 +- hosts/server2/configuration.nix | 36 +++++++++++++ .../{server-gpu => server3}/configuration.nix | 2 +- 7 files changed, 90 insertions(+), 40 deletions(-) create mode 100644 home/scripts/rebuild-nocommit.sh rename hosts/{server => server1}/configuration.nix (92%) create mode 100644 hosts/server2/configuration.nix rename hosts/{server-gpu => server3}/configuration.nix (92%) diff --git a/extras/kube-master.nix b/extras/kube-master.nix index 13af296..aa9e7ba 100644 --- a/extras/kube-master.nix +++ b/extras/kube-master.nix @@ -17,6 +17,9 @@ in { kompose kubectl kubernetes + openssl + cfssl + certmgr ]; services.kubernetes = { diff --git a/flake.nix b/flake.nix index 36184cf..98df1c3 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -16,7 +17,6 @@ nixpkgs-clisp.url = "github:NixOS/nixpkgs/da320e5472f021b96a883f71fc525ca0e4815273"; }; - outputs = { self, nixpkgs, @@ -26,59 +26,37 @@ nixpkgs-clisp, } @ inputs: let system = "x86_64-linux"; + + # hostnames + hosts = ["thonkpad" "rq" "yoga" "server1" "server2" "server3"]; + baseModule = {lib, ...}: { imports = [ home-manager.nixosModules.default agenix.nixosModules.default ]; - system.configurationRevision = lib.mkIf (self ? rev) self.rev; - nixpkgs.overlays = [ emacs-overlay.overlay (final: _prev: { clisp = nixpkgs-clisp.legacyPackages.${system}.clisp; }) ]; - environment.systemPackages = [ agenix.packages.${system}.default ]; }; + + mkHost = name: { + name = name; + value = nixpkgs.lib.nixosSystem { + modules = [ + baseModule + ./hosts/${name}/configuration.nix + ]; + }; + }; in { - nixosConfigurations.thonkpad = nixpkgs.lib.nixosSystem { - modules = [ - baseModule - ./hosts/thonkpad/configuration.nix - ]; - }; - - nixosConfigurations.server = nixpkgs.lib.nixosSystem { - modules = [ - baseModule - ./hosts/server/configuration.nix - ]; - }; - - nixosConfigurations.server-gpu = nixpkgs.lib.nixosSystem { - modules = [ - baseModule - ./hosts/server-gpu/configuration.nix - ]; - }; - - nixosConfigurations.rq = nixpkgs.lib.nixosSystem { - modules = [ - baseModule - ./hosts/rq/configuration.nix - ]; - }; - - nixosConfigurations.yoga = nixpkgs.lib.nixosSystem { - modules = [ - baseModule - ./hosts/yoga/configuration.nix - ]; - }; + nixosConfigurations = builtins.listToAttrs (map mkHost hosts); }; } diff --git a/home/programs/firefox/default.nix b/home/programs/firefox/default.nix index bb9886a..bd784a9 100644 --- a/home/programs/firefox/default.nix +++ b/home/programs/firefox/default.nix @@ -150,6 +150,14 @@ in { name = "grfp"; url = "https://www.research.gov/grfp/Login.do"; # your tax dollars fund my phd loser. pay big sam up. } + { + name = "cmueats"; + url = "https://cmueats.com/"; + } + { + name = "cmucourses"; + url = "https://cmucourses.com/"; + } ]; } { diff --git a/home/scripts/rebuild-nocommit.sh b/home/scripts/rebuild-nocommit.sh new file mode 100644 index 0000000..ff36010 --- /dev/null +++ b/home/scripts/rebuild-nocommit.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# blatently adapted from: https://gist.github.com/0atman/1a5133b842f929ba4c1e195ee67599d5 + +# set -e + +# cd to your config dir +pushd /home/synchronous/nix-cfg + +# early return if no changes are given +git --git-dir /home/synchronous/nix-cfg/.git add . +if git --git-dir /home/synchronous/nix-cfg/.git diff-index --quiet HEAD; then + echo "No changes detected, exiting." + popd + exit 0 +fi + +# Autoformat your nix files +alejandra . &>/dev/null \ + || ( alejandra . ; echo "formatting failed!" && exit 1) + +prev=$(hostname) + +sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /home/synchronous/nix-cfg/flake.nix#"$prev" 2>&1 | tee /tmp/nixos-switch.log + +notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available diff --git a/hosts/server/configuration.nix b/hosts/server1/configuration.nix similarity index 92% rename from hosts/server/configuration.nix rename to hosts/server1/configuration.nix index 52a44bc..1b2cc47 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server1/configuration.nix @@ -12,7 +12,7 @@ ]; config = { - networking.hostName = "server"; # Define your hostname. + networking.hostName = "server1"; # Define your hostname. res = "2560x1440"; home-manager = { diff --git a/hosts/server2/configuration.nix b/hosts/server2/configuration.nix new file mode 100644 index 0000000..f5bb200 --- /dev/null +++ b/hosts/server2/configuration.nix @@ -0,0 +1,36 @@ +{ + config, + pkgs, + lib, + ... +}: { + imports = [ + ./hardware-configuration.nix + ../../system/system.nix + ../meta.nix + ../../extras/ssh.nix + ]; + + config = { + networking.hostName = "server2"; # Define your hostname. + res = "2560x1440"; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "backup"; + users.synchronous.imports = [../../home/home.nix]; + }; + + # Bootloader. + # boot.loader.grub.enable = true; + # boot.loader.grub.device = "/dev/nvme0n1"; + # boot.loader.grub.useOSProber = true; + # boot.loader.grub.version = 2; + # services.logind.lidSwitchExternalPower = "ignore"; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub.enable = false; + }; +} diff --git a/hosts/server-gpu/configuration.nix b/hosts/server3/configuration.nix similarity index 92% rename from hosts/server-gpu/configuration.nix rename to hosts/server3/configuration.nix index fa7ffd7..bf74656 100644 --- a/hosts/server-gpu/configuration.nix +++ b/hosts/server3/configuration.nix @@ -13,7 +13,7 @@ ]; config = { - networking.hostName = "server-gpu"; # Define your hostname. + networking.hostName = "server3-gpu"; # Define your hostname. res = "2560x1440"; home-manager = {