From e3121725d10190f9eea978b794e9780634e5f13e Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 3 Apr 2024 16:02:50 -0500 Subject: [PATCH 01/13] Fix prefix length on Hosea --- hosts/hosea/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/hosea/default.nix b/hosts/hosea/default.nix index 5531e5b..eacbe5c 100644 --- a/hosts/hosea/default.nix +++ b/hosts/hosea/default.nix @@ -37,7 +37,7 @@ in useDHCP = false; ipv4.addresses = [{ address = lanIpAddress; - prefixLength = 24; + prefixLength = 16; }]; }; }; From 67b466b9f97117bf8c56fea99ffaa7deb55c7dea Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 3 Apr 2024 16:06:00 -0500 Subject: [PATCH 02/13] Finish fleshing out Hosea network --- hosts/hosea/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hosts/hosea/default.nix b/hosts/hosea/default.nix index eacbe5c..c6deb75 100644 --- a/hosts/hosea/default.nix +++ b/hosts/hosea/default.nix @@ -31,6 +31,8 @@ in networking = { hostName = "hosea"; + nameservers = [ "10.42.1.5" ]; + defaultGateway = "10.42.1.1"; interfaces = { "${wanInterface}".useDHCP = true; "${lanInterface}" = { From 338efa36aceb127197b607f05413b90cbdeb8e6c Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Thu, 4 Apr 2024 13:53:17 -0500 Subject: [PATCH 03/13] QEmu Working, again... --- hosts/myself/container-runner.nix | 15 +++++ hosts/myself/git.nix | 75 ++++++++++------------ secrets/gitlab/myself-qemu-runner-reg.age | Bin 1740 -> 1734 bytes 3 files changed, 48 insertions(+), 42 deletions(-) diff --git a/hosts/myself/container-runner.nix b/hosts/myself/container-runner.nix index 75226f5..440d547 100644 --- a/hosts/myself/container-runner.nix +++ b/hosts/myself/container-runner.nix @@ -50,6 +50,12 @@ lib.attrsets.recursiveUpdate { nixpkgs.config.allowUnfree = true; + users.users.gitlab-runner = { + isSystemUser = true; + group = "kvm"; + extraGroups = [ "kvm" ]; + }; + services = { gitlab-runner = { enable = true; @@ -78,6 +84,15 @@ lib.attrsets.recursiveUpdate { "network-online.target" "systemd-resolved.service" ]; + serviceConfig = { + DevicePolicy = lib.mkForce "auto"; + PrivateDevices = false; + ProtectKernelModules = false; + DevicesAllow = [ "/dev/kvm" "/dev/mem" ]; + DynamicUser = lib.mkForce false; + User = "root"; + Group = "kvm"; + }; }; system.stateVersion = lib.mkForce "24.05"; diff --git a/hosts/myself/git.nix b/hosts/myself/git.nix index 8eaa9e9..2e8c634 100644 --- a/hosts/myself/git.nix +++ b/hosts/myself/git.nix @@ -39,55 +39,20 @@ in { }; systemd.services = { - "container@gitlab-runner-qemu" = { - # Now moved to a separate machine - conflicts = [ - "container@gitlab-runner-vbox.service" - ]; + "gitlab-runner" = { serviceConfig = { DevicePolicy = lib.mkForce "auto"; + DevicesAllow = [ "/dev/kvm" "/dev/mem" ]; + EnvironmentFile = config.age.secrets.docker-auth.path; ExecStopPost = [ "${pkgs.kmod}/bin/rmmod kvm_amd kvm" ]; ExecStartPre = [ - "${pkgs.kmod}/bin/modprobe kvm" - "${pkgs.kmod}/bin/modprobe kvm_amd" + "+${pkgs.kmod}/bin/modprobe kvm" + "+${pkgs.kmod}/bin/modprobe kvm_amd" ]; + PrivateDevices = false; + ProtectKernelModules = false; }; }; - gitlab-runner.serviceConfig.EnvironmentFile = config.age.secrets.docker-auth.path; - }; - - ##################################################################################### - #################### QEmu Runner #################################################### - ##################################################################################### - containers.gitlab-runner-qemu = container { - autoStart = true; - bindMounts = { - "/dev/kvm" = { - hostPath = "/dev/kvm"; - isReadOnly = false; - }; - "/dev/mem" = { - hostPath = "/dev/mem"; - isReadOnly = false; - }; - }; - extraFlags = [ - "--property=DeviceAllow=/dev/kvm" - ]; - hostAddress = "192.168.201.1"; - localAddress = "192.168.201.2"; - config = ((import ./container-runner.nix) { - inherit inputs overlays; - name = "qemu"; - packages = with pkgs; [ qemu_full qemu_kvm ]; - extra = { - virtualisation.libvirtd = { - enable = true; - onBoot = "ignore"; - package = pkgs.libvirt-greg; - }; - }; - }); }; ##################################################################################### @@ -108,6 +73,7 @@ in { ##################################################################################### age.secrets.runner-reg.file = ../../secrets/gitlab/myself-podman-runner-reg.age; age.secrets.docker-auth.file = ../../secrets/gitlab/docker-auth.age; + age.secrets.runner-qemu.file = ../../secrets/gitlab/myself-qemu-runner-reg.age; services.gitlab-runner = { enable = true; settings = { @@ -144,10 +110,35 @@ in { "/cache" ]; }; + qemu = { + executor = "shell"; + limit = 5; + registrationConfigFile = config.age.secrets.runner-qemu.path; + environmentVariables = { + EFI_DIR = "${pkgs.OVMF.fd}/FV/"; + }; + }; }; }; virtualisation = { docker.enable = true; oci-containers.backend = "docker"; }; + environment.systemPackages = with pkgs; [ + curl + gawk + git + p7zip + packer + pup + (python3.withPackages (p: with p; [ pip pyyaml virtualenv ]) ) + qemu_full + qemu_kvm + shellcheck + unzip + xonsh + xorriso + vagrant + wget + ]; } diff --git a/secrets/gitlab/myself-qemu-runner-reg.age b/secrets/gitlab/myself-qemu-runner-reg.age index 31bd19330ff2b1e5b39781483b64097fa7db09b0..cd270e6e3988d6455eec323e3364ee4efbc97b92 100644 GIT binary patch literal 1734 zcmZY8`>)f683thJU>lKE6}C=lH>OnDg(*FAVkbFC3$#ug+i`5ib{xkJOyDHG#j)e~ z631C#bY1B|t;S)%K$?0{Z_}V-Omt`yr5AD8r7A@#qFUF|vlfKJSj!ITXbT+1&!_*u z_vqF8ezK-aD0bV89N*~MKkB<0FigcJR>wV0pHMnrCX>p?`%%f_!?lO$K-Vzk$momL7?GH|EC5fwBPu|Xwd(Vn45o|};) z+*fqo68Zjo&8k|As>MA6Pq^e*o)q%{m=>d?73y-%H3qeY-e$Z+Az78n0N9}PddwAY z&q7m#EYS|3ry+(P=k!v|VH{J!lSsYTHz~rzi@h{8Uy}%fYlU$%i`5Wb6S7T_s%u!@ zBn@q7VRVA&rbhW{z$R!$mJ2PQD8-a43cETUl%Rs*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<}&cz?X^g|DuKFZa%T;ctI^ z^U{`&ud!!-`Lw)g*&m<$K+JyamfLSR@b4@4zX=|D>-0;z=eNGi(|0}hnPnvL@U8D) zJHK_-+h1QbI&xv4uGzg;Q_d3~Hm)$+xBlkt(~k^RMThqPhraJHJoC!l@pA{B$ZWor z%bmEk{lm)ftN9h5|LITe*{-hGb{q4>%?7dU(cx_`zWdNT&(A!P{g?CORm)d@?$ayx zed(h;!M;zP=E)1)|2p4z<p<@@V!U=y!Xp@NJDW@Tr=J()n<3WyYVGYynp1>vd$*1zWS{1tZoVy NP7kcc+Mgdd@qbctdYk|N From 0eb4fafd4403a4769d21792bac34ecc2480c0b0c Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Fri, 5 Apr 2024 10:59:30 -0500 Subject: [PATCH 04/13] Move EFI var --- home/hosts/jude/default.nix | 2 ++ home/xonsh.nix | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home/hosts/jude/default.nix b/home/hosts/jude/default.nix index eefc406..39c1645 100644 --- a/home/hosts/jude/default.nix +++ b/home/hosts/jude/default.nix @@ -11,4 +11,6 @@ greg.gui = true; greg.sway = false; greg.gnome = false; + + programs.xonsh.sessionVariables.EFI_DIR = "${pkgs.OVMF.fd}/FV/"; } diff --git a/home/xonsh.nix b/home/xonsh.nix index 25c5c6f..411ef8e 100644 --- a/home/xonsh.nix +++ b/home/xonsh.nix @@ -29,8 +29,6 @@ GOPATH = "${config.home.homeDirectory}/src/go"; GOBIN = "${config.home.homeDirectory}/src/bin"; - - EFI_DIR = lib.mkIf pkgs.stdenv.isLinux "${pkgs.OVMF.fd}/FV/"; }; aliases = { From 1bb1c981b04f8e65f604cfbd43c3fc684b057235 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 9 Apr 2024 16:27:27 -0500 Subject: [PATCH 05/13] Add Postgres upgrade script --- hosts/myself/matrix.nix | 2 ++ modules/nixos/db.nix | 1 + overlays/default.nix | 1 + overlays/upgrade-pg-cluster.nix | 24 ++++++++++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 overlays/upgrade-pg-cluster.nix diff --git a/hosts/myself/matrix.nix b/hosts/myself/matrix.nix index bc0b4c5..8dc250d 100644 --- a/hosts/myself/matrix.nix +++ b/hosts/myself/matrix.nix @@ -5,6 +5,8 @@ let conn = "postgresql:///dendrite?sslmode=disable&host=/run/postgresql"; in { + environment.systemPackages = with pkgs; [ upgrade-pg-cluster ]; + greg.containers.matrix = { tailscale = true; subnet = "204"; diff --git a/modules/nixos/db.nix b/modules/nixos/db.nix index 60c4d56..ec551d1 100644 --- a/modules/nixos/db.nix +++ b/modules/nixos/db.nix @@ -18,6 +18,7 @@ in { services = { postgresql = { enable = true; + package = pkgs.postgresql_15; checkConfig = true; ensureDatabases = dbs; ensureUsers = map (db: { name = db; ensureDBOwnership = true; }) dbs; diff --git a/overlays/default.nix b/overlays/default.nix index 0a660f9..648d8cf 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -60,6 +60,7 @@ in rec { setup-ssh = prev.callPackage ./setup-ssh { pkgs = final.pkgs; }; + upgrade-pg-cluster = prev.callPackage ./upgrade-pg-cluster.nix {}; # Overrides of packages brew = prev.callPackage ./homebrew.nix {}; diff --git a/overlays/upgrade-pg-cluster.nix b/overlays/upgrade-pg-cluster.nix new file mode 100644 index 0000000..a22e36e --- /dev/null +++ b/overlays/upgrade-pg-cluster.nix @@ -0,0 +1,24 @@ +{ postgresql_15, postgresql_14, writeScriptBin, ... }: + +let + newPostgres = postgresql_15; + oldPostgres = postgresql_14; +in writeScriptBin "upgrade-pg-cluster" '' + set -eux + systemctl stop postgresql + + export NEWDATA="/var/lib/postgresql/${newPostgres.psqlSchema}" + export NEWBIN="${newPostgres}/bin" + + export OLDDATA="/var/lib/postgresql/${oldPostgres.psqlSchema}" + export OLDBIN="${oldPostgres}/bin" + + install -d -m 0700 -o postgres -g postgres "$NEWDATA" + cd "$NEWDATA" + sudo -u postgres "$NEWBIN/initdb" -D "$NEWDATA" + + sudo -u postgres "$NEWBIN/pg_upgrade" \ + --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \ + --old-bindir "$OLDBIN" --new-bindir "$NEWBIN" \ + "$@" +'' From ab4cc0db9af523dbe10ce16a89986cb4c2308555 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Apr 2024 13:00:34 -0500 Subject: [PATCH 06/13] Add golang to jude --- hosts/jude/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/jude/default.nix b/hosts/jude/default.nix index e6103d0..ce86564 100644 --- a/hosts/jude/default.nix +++ b/hosts/jude/default.nix @@ -51,6 +51,7 @@ distrobox expect gimp + go gparted gnucash graphviz From 6fdd262c03bc3557e6cc23fc6fdde1f28c2f6d41 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 10 Apr 2024 16:42:46 -0500 Subject: [PATCH 07/13] Add note for Ceph module --- modules/nixos/ceph.nix | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 modules/nixos/ceph.nix diff --git a/modules/nixos/ceph.nix b/modules/nixos/ceph.nix new file mode 100644 index 0000000..95a14e0 --- /dev/null +++ b/modules/nixos/ceph.nix @@ -0,0 +1,2 @@ +# This is a good source for a Ceph dealio +# https://gist.github.com/nh2/13425a1f18b4c1ce82edb63c10b163c9 From f787fc93fa6a0b8cd04577365fe4eab6f6f66b94 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 16 Apr 2024 08:34:06 -0500 Subject: [PATCH 08/13] Add Jeremiah --- home/hosts/jeremiah/default.nix | 4 + home/ssh/authorized_keys | 1 + hosts/default.nix | 1 + hosts/jeremiah/default.nix | 97 +++++++++++++++++++++++ hosts/jeremiah/hardware-configuration.nix | 39 +++++++++ secrets/secrets.nix | 2 + 6 files changed, 144 insertions(+) create mode 100644 home/hosts/jeremiah/default.nix create mode 100644 hosts/jeremiah/default.nix create mode 100644 hosts/jeremiah/hardware-configuration.nix diff --git a/home/hosts/jeremiah/default.nix b/home/hosts/jeremiah/default.nix new file mode 100644 index 0000000..dbaa756 --- /dev/null +++ b/home/hosts/jeremiah/default.nix @@ -0,0 +1,4 @@ +{ pkgs, config, ... }: + +{ +} diff --git a/home/ssh/authorized_keys b/home/ssh/authorized_keys index 767fc22..4f434cd 100644 --- a/home/ssh/authorized_keys +++ b/home/ssh/authorized_keys @@ -4,3 +4,4 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMYzms+KIe5/bYF3uCyFjA5e1AgMPLIA3c4k417coqBe ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINnRc/kBhxcjpUtiRQY+BXnSObdp0jFL1395wAQxJip7 greg@jude ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAl6DJVrPSujvJSAEA5Q8tRrzfJs/c6DMwqwQEUFffIR greg@myself ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGrqJQvDspLi1vXQRJ/Z5kN/F8jCBHvaXjo+5zLuIYjR greg@hosea +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIYIiecdyM9c7tXgR96983K3wqiJeQRMbrzGIF8Wy6uO greg@jeremiah diff --git a/hosts/default.nix b/hosts/default.nix index 0ccbccd..edb844c 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -43,6 +43,7 @@ in { icdm-root = unstable { name = "icdm-root"; }; linode = machine { name = "linode"; }; hosea = unstable { name = "hosea"; }; + jeremiah = unstable { name = "jeremiah"; }; myself = unstable { name = "myself"; }; iso = machine { name = "iso"; }; iso-beta = unstable { name = "iso"; }; diff --git a/hosts/jeremiah/default.nix b/hosts/jeremiah/default.nix new file mode 100644 index 0000000..68b3282 --- /dev/null +++ b/hosts/jeremiah/default.nix @@ -0,0 +1,97 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "jeremiah"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.greg = { + isNormalUser = true; + description = "Greg Hellings"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + git + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? + +} diff --git a/hosts/jeremiah/hardware-configuration.nix b/hosts/jeremiah/hardware-configuration.nix new file mode 100644 index 0000000..fcd7de1 --- /dev/null +++ b/hosts/jeremiah/hardware-configuration.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "uas" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ffc167f5-d9e4-4b11-a5f1-f7da0550ad24"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3047-870E"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp67s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp68s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo2.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 99d64bd..ac70882 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -17,6 +17,7 @@ let user_linode = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINAX6pNx5mbwIa8X+GzktyNijfYmJUpgROFpRxSW9js0 greg@linode"; user_myself = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAl6DJVrPSujvJSAEA5Q8tRrzfJs/c6DMwqwQEUFffIR greg@myself"; user_hosea = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGrqJQvDspLi1vXQRJ/Z5kN/F8jCBHvaXjo+5zLuIYjR greg@hosea"; + user_jeremiah = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIYIiecdyM9c7tXgR96983K3wqiJeQRMbrzGIF8Wy6uO greg@jeremiah"; users = [ user_genesis_virt @@ -25,6 +26,7 @@ let user_linode user_myself user_hosea + user_jeremiah ]; everyone = systems ++ users; From 1a1769ef3d2a939c8bc30f207d3cf2cd88a66549 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 16 Apr 2024 08:34:16 -0500 Subject: [PATCH 09/13] Enhance injection code --- overlays/inject.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/overlays/inject.nix b/overlays/inject.nix index 6837e6f..9fa9be6 100644 --- a/overlays/inject.nix +++ b/overlays/inject.nix @@ -20,6 +20,15 @@ mkdir -p "/etc/nixos/hosts/''${hostname}" cp /etc/nixos.bk/configuration.nix "/etc/nixos/hosts/''${hostname}/default.nix" cp /etc/nixos.bk/hardware-configuration.nix "/etc/nixos/hosts/''${hostname}/hardware-configuration.nix" +# Prepare home-manager portion for setup +mkdir -p "/etc/nixos/home/hosts/''${hostname}" +cat < EOF > "/etc/nixos/home/hosts/''${hostname}/default.nix" +{ pkgs, config, ... }: + +{ +} +EOF + # Prepares it for injecting the use case into the flake usage cp /etc/nixos.bk/hardware-configuration.nix /etc/nixos chown -R greg nixos From ba837e6eb1856e5b9e1ecde694e67116094dd48f Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 16 Apr 2024 08:54:46 -0500 Subject: [PATCH 10/13] Jeremiah first-round simplification --- hosts/jeremiah/default.nix | 81 ++------------------------------------ 1 file changed, 3 insertions(+), 78 deletions(-) diff --git a/hosts/jeremiah/default.nix b/hosts/jeremiah/default.nix index 68b3282..0b465a7 100644 --- a/hosts/jeremiah/default.nix +++ b/hosts/jeremiah/default.nix @@ -15,83 +15,8 @@ boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "jeremiah"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "America/Chicago"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; + greg = { + home = true; + tailscale.enable = true; }; - - # Configure keymap in X11 - services.xserver = { - layout = "us"; - xkbVariant = ""; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.greg = { - isNormalUser = true; - description = "Greg Hellings"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - }; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - git - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget - ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? - } From 7aed11aff2b96eea23753e719b35cf2c2e4d1946 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 16 Apr 2024 08:55:08 -0500 Subject: [PATCH 11/13] More inject improvements --- overlays/inject.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/overlays/inject.nix b/overlays/inject.nix index 9fa9be6..e18fc20 100644 --- a/overlays/inject.nix +++ b/overlays/inject.nix @@ -17,7 +17,25 @@ ${git}/bin/git clone http://github.com/greg-hellings/nixos-config nixos mkdir -p "/etc/nixos/hosts/''${hostname}" # Prepares everything for the flake usage -cp /etc/nixos.bk/configuration.nix "/etc/nixos/hosts/''${hostname}/default.nix" +#cp /etc/nixos.bk/configuration.nix "/etc/nixos/hosts/''${hostname}/default.nix" +cat < EOF > "/etc/nixos/hosts/''${hostname}/default.nix +{ pkgs, config, ... }: + +{ + imports = [ ./hardware-configuration.nix ]; + + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + networking.hostName = "''${hostname}"; + greg = { + home = true; + tailscale.enable = true; + }; +} +EOF cp /etc/nixos.bk/hardware-configuration.nix "/etc/nixos/hosts/''${hostname}/hardware-configuration.nix" # Prepare home-manager portion for setup From 861588f217ff551b29cf9b431d98de3aee0a15f4 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 16 Apr 2024 09:05:02 -0500 Subject: [PATCH 12/13] Fix inject syntax --- overlays/inject.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/overlays/inject.nix b/overlays/inject.nix index e18fc20..04f648e 100644 --- a/overlays/inject.nix +++ b/overlays/inject.nix @@ -18,7 +18,7 @@ mkdir -p "/etc/nixos/hosts/''${hostname}" # Prepares everything for the flake usage #cp /etc/nixos.bk/configuration.nix "/etc/nixos/hosts/''${hostname}/default.nix" -cat < EOF > "/etc/nixos/hosts/''${hostname}/default.nix +cat << EOF > "/etc/nixos/hosts/''${hostname}/default.nix" { pkgs, config, ... }: { @@ -40,7 +40,7 @@ cp /etc/nixos.bk/hardware-configuration.nix "/etc/nixos/hosts/''${hostname}/hard # Prepare home-manager portion for setup mkdir -p "/etc/nixos/home/hosts/''${hostname}" -cat < EOF > "/etc/nixos/home/hosts/''${hostname}/default.nix" +cat << EOF > "/etc/nixos/home/hosts/''${hostname}/default.nix" { pkgs, config, ... }: { @@ -51,6 +51,6 @@ EOF cp /etc/nixos.bk/hardware-configuration.nix /etc/nixos chown -R greg nixos -echo "Now you should be able to just run 'nixos-rebuild switch' to enable the flake functionality" -echo "After that and adding the entry to the flake, run 'nixos-rebuild boot --flake '.#''${hostname}' and reboot" +echo "Now you should be able to just run `nixos-rebuild switch` to enable the flake functionality" +echo "After that and adding the entry to the flake, run `nixos-rebuild boot --flake '.#''${hostname}'` and reboot" '' From 3e9773176134daf263944996761d3190023290b4 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 17 Apr 2024 23:09:20 -0500 Subject: [PATCH 13/13] Update networking.nix Add more names --- hosts/genesis/networking.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/genesis/networking.nix b/hosts/genesis/networking.nix index 2aabbb8..043de16 100644 --- a/hosts/genesis/networking.nix +++ b/hosts/genesis/networking.nix @@ -182,8 +182,8 @@ in { "98:da:c4:77:7f:4d,192.168.66.102" "8c:85:80:1c:f9:d1,192.168.66.104" "98:da:c4:77:82:7b,192.168.66.105" - "0c:80:63:41:74:73,192.168.66.106" - "98:da:c4:20:ea:db,192.168.66.107" # HS220 switch + "0c:80:63:41:74:73,192.168.66.106" # Front hall light switch + "98:da:c4:20:ea:db,192.168.66.107" # Parlor light switch "8c:49:62:aa:58:60,192.168.66.108" # Roku, HiHandsome "92:3e:11:c7:c5:be,192.168.66.109" "d8:0d:17:19:60:62,192.168.66.112"