From: Preston Pan Date: Sun, 7 Sep 2025 07:37:22 +0000 (-0700) Subject: big update; fix vps and streamline some stuff X-Git-Url: https://ret2pop.net/gitweb/monorepo.git?a=commitdiff_plain;h=8f4f46e59ad0b7c5662a417d10f3074f17c962c3;p=monorepo.git big update; fix vps and streamline some stuff --- diff --git a/about.org b/about.org index 92bc99e..833abfd 100644 --- a/about.org +++ b/about.org @@ -52,8 +52,3 @@ This is for all my public keys that are important. Note: for cryptocurrency publ public scanner to get my public keys. - This is [[file:public-key.asc][my gpg public key for ret2pop]]. - This is [[file:id_ed25519.pub][my ssh key]]. - -* Feeds -RSS (and Atom feeds) are ways of keeping up-to-date in a minimal and universal way. -- [[https://git.nullring.xyz/ret2pop-website.git/?format=atom][Website Cgit repo atom feed]] - diff --git a/config/nix.org b/config/nix.org index eafb10e..e34d1f5 100644 --- a/config/nix.org +++ b/config/nix.org @@ -55,6 +55,13 @@ so that adding new configurations that add modifications is made simple. outputs = { self, nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, nix-topology, nixos-dns, deep-research, ... }@attrs: let + hostnames = [ + "affinity" + "continuity" + "installer" + "spontaneity" + # add hostnames here + ]; system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; generate = nixos-dns.utils.generate nixpkgs.legacyPackages."${system}"; @@ -62,8 +69,7 @@ so that adding new configurations that add modifications is made simple. inherit (self) nixosConfigurations; extraConfig = import ./dns/default.nix; }; - mkConfigs = map (hostname: { - name = "${hostname}"; + mkConfigs = map (hostname: {name = "${hostname}"; value = nixpkgs.lib.nixosSystem { inherit system; specialArgs = attrs; @@ -74,7 +80,7 @@ so that adding new configurations that add modifications is made simple. ] else [ { environment.systemPackages = with nixpkgs.lib; [ - deep-research.packages.${system}.deep-research + deep-research.packages."${system}".deep-research ]; } nix-topology.nixosModules.default @@ -85,7 +91,7 @@ so that adding new configurations that add modifications is made simple. nixos-dns.nixosModules.dns { nixpkgs.overlays = [ nur.overlays.default ]; - home-manager.extraSpecialArgs = attrs; + home-manager.extraSpecialArgs = attrs // { systemHostName = "${hostname}"; }; networking.hostName = "${hostname}"; } (./. + "/systems/${hostname}/default.nix") @@ -94,12 +100,7 @@ so that adding new configurations that add modifications is made simple. }); in { # add new systems here - nixosConfigurations = builtins.listToAttrs (mkConfigs [ - "affinity" - "continuity" - "installer" - "spontaneity" - ]); + nixosConfigurations = builtins.listToAttrs (mkConfigs hostnames); topology."${system}" = import nix-topology { pkgs = import nixpkgs { @@ -347,9 +348,9 @@ Still, it is suitable for using Krita. { lib, config, pkgs, ... }: { services.xserver = { - enable = lib.mkDefault true; + enable = (! config.monorepo.profiles.ttyonly.enable); displayManager = { - startx.enable = true; + startx.enable = (! config.monorepo.profiles.ttyonly.enable); }; windowManager = { @@ -933,7 +934,7 @@ because they enhance security. loader = { systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.grub.enable); - efi.canTouchEfiVariables = lib.mkDefault (! config.monorepo.profiles.grub.enable); + efi.canTouchEfiVariables = lib.mkForce (! config.monorepo.profiles.grub.enable); }; kernelModules = [ @@ -1128,7 +1129,7 @@ because they enhance security. auditd.enable = true; audit.enable = true; - chromiumSuidSandbox.enable = true; + chromiumSuidSandbox.enable = (! config.monorepo.profiles.ttyonly.enable); sudo.enable = true; }; @@ -1242,41 +1243,41 @@ This is the disko configuration for my continuity system. It features a boot and on disk /dev/sda. All my SATA disks have this location by default, but if you want to use nvme, you will have to import that configuration in your ~systems/xxx/default.nix~. #+begin_src nix :tangle ../nix/disko/sda-simple.nix -{ - disko.devices = { - disk = { - my-disk = { - device = "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - type = "EF00"; - size = "500M"; - priority = 1; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; + { + disko.devices = { + disk = { + my-disk = { + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "500M"; + priority = 1; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; }; - }; - root = { - size = "100%"; - priority = 2; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; + root = { + size = "100%"; + priority = 2; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; }; }; }; }; }; }; - }; -} + } #+end_src *** NVME For my nvme drives. @@ -1334,6 +1335,7 @@ For my virtual machines. type = "EF02"; }; root = { + label = "disk-main-root"; size = "100%"; content = { type = "filesystem"; @@ -1530,26 +1532,26 @@ I have many imports that we'll go through next. monorepo.profiles = { enable = lib.mkDefault true; - music.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - hyprland.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - email.enable = lib.mkDefault (true && config.monorepo.profiles.enable); + music.enable = lib.mkDefault config.monorepo.profiles.enable; + hyprland.enable = lib.mkDefault config.monorepo.profiles.enable; + email.enable = lib.mkDefault config.monorepo.profiles.enable; # Programming - graphics.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-c.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-rust.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-python.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-sol.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-sh.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-openscad.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-js.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-nix.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-coq.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-haskell.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - - crypto.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - art.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - workstation.enable = lib.mkDefault (true && config.monorepo.profiles.enable); + graphics.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-c.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-rust.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-python.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-sol.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-sh.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-openscad.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-js.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-nix.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-coq.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-haskell.enable = lib.mkDefault config.monorepo.profiles.enable; + + crypto.enable = lib.mkDefault config.monorepo.profiles.enable; + art.enable = lib.mkDefault config.monorepo.profiles.enable; + workstation.enable = lib.mkDefault config.monorepo.profiles.enable; }; }; } @@ -1829,19 +1831,20 @@ be straightforward. *** Fcitx This is a virtual keyboard program for writing in multiple languages. I use this sometimes. #+begin_src nix :tangle ../nix/modules/home/fcitx.nix -{ pkgs, ... }: -{ - i18n.inputMethod = { - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-gtk - fcitx5-chinese-addons - fcitx5-configtool - fcitx5-mozc - fcitx5-rime - ]; - }; -} + { config, pkgs, lib, ... }: + { + i18n.inputMethod = { + type = "fcitx5"; + enable = lib.mkDefault config.monorepo.profiles.graphics.enable; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-chinese-addons + fcitx5-configtool + fcitx5-mozc + fcitx5-rime + ]; + }; + } #+end_src Note that I configure fcitx with chinese and some japanese input enabled. *** Emacs @@ -2892,7 +2895,7 @@ A classic program that allows you to download from youtube. Also has integration My zsh config has some useful aliases that one should read through. Otherwise it is pretty standard. #+begin_src nix :tangle ../nix/modules/home/zsh.nix - { lib, config, pkgs, ... }: + { lib, config, pkgs, systemHostName, ... }: { programs.zsh = { enable = true; @@ -2919,8 +2922,7 @@ standard. g = "git"; v = "vim"; py = "python3"; - rb = "sudo nixos-rebuild switch --flake .#continuity"; - rba = "sudo nixos-rebuild switch --flake .#affinity"; + rb = "sudo nixos-rebuild switch --flake .#${systemHostName}"; nfu = "cd ~/monorepo/nix && git add . && git commit -m \"new flake lock\" && nix flake update"; usync = "rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${config.monorepo.vars.remoteHost}:/var/www/ret2pop-website/"; usite @@ -3069,7 +3071,6 @@ for these configurations. }; fonts.fontconfig.enable = true; - nixpkgs.config.cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; } #+end_src * Systems @@ -3167,6 +3168,8 @@ Spontaneity is my VPS instance. grub.enable = true; }; }; + + boot.loader.grub.device = "nodev"; networking = { firewall.allowedTCPPorts = [ 80 @@ -3196,6 +3199,7 @@ Spontaneity is my VPS instance. "mail.${config.monorepo.vars.remoteHost}" = {}; "nullring.xyz" = {}; + "git.nullring.xyz" = {}; "matrix.nullring.xyz" = {}; "talk.nullring.xyz" = {}; "mail.nullring.xyz" = {}; @@ -3227,6 +3231,7 @@ work deterministically. { diskoCommitHash = "a5c4f2ab72e3d1ab43e3e65aa421c6f2bd2e12a1"; monorepoCommitHash = "af3c15c43c65fd77aab441f4c657aeaa74cc67d5"; + monorepoUrl = "https://github.com/ret2pop/monorepo"; } #+end_src *** ISO Default Profile @@ -3284,12 +3289,21 @@ This contains the installation script I use to install my systems. exit 1 fi - if [ -z "$SYSTEM" ]; then - SYSTEM=continuity + gum style --border normal --margin "1" --padding "1 2" "Choose a system to install or select `new` in order to create a new system." + + SYSTEM="$(gum choose "$(find "$HOME/monorepo/nix/systems" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | grep -v -E 'installer'; printf "New")")" + + if [[ "$SYSTEM" == "New" ]]; then + gum style --border normal --margin "1" --padding "1 2" "Choose a system name" + SYSTEM="$(gum input --placeholder "system name")" fi - if [ -z "$DRIVE" ]; then - DRIVE=sda-simple + gum style --border normal --margin "1" --padding "1 2" "Select a drive file or create a new drive file." + DRIVE="$(gum choose "$(find "$HOME/monorepo/nix/disko" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | printf "New")")" + + if [[ "$DRIVE" == "New" ]]; then + gum style --border normal --margin "1" --padding "1 2" "Choose a name to call your drive file." + SYSTEM="$(gum input --placeholder "drive file name (ex: my_sda.nix)")" fi ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installation..." || nmtui @@ -3297,9 +3311,10 @@ This contains the installation script I use to install my systems. cd "$HOME" if [ ! -d "$HOME/monorepo/" ]; then - git clone https://git.nullring.xyz/monorepo.git - cd monorepo + git clone ${commits.monorepoUrl} + cd "$HOME/monorepo" git checkout "${commits.monorepoCommitHash}" + cd "$HOME" fi @@ -3311,7 +3326,7 @@ This contains the installation script I use to install my systems. { imports = [ ../../modules/default.nix - ../../disko/$DRIVE.nix + ../../disko/$DRIVE ../home.nix ]; } @@ -3321,17 +3336,21 @@ This contains the installation script I use to install my systems. gum input --placeholder "Press Enter to continue" >/dev/null vim "$HOME/monorepo/nix/systems/$SYSTEM/default.nix" - sed -i "/mkConfigs \[/,/\]/ s/^\(\s*\)\]/\1 \"$SYSTEM\"\n\1]/" "$HOME/monorepo/nix/flake.nix" - fi + sed -i "/hostnames = \[/,/];/ { /];/i \ \"your-hostname-$SYSTEM\" }" "$HOME/monorepo/nix/flake.nix" - if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE.nix" ]; then - cp "$HOME/monorepo/nix/disko/sda-simple.nix" "$HOME/monorepo/nix/disko/$DRIVE.nix" - gum style --border normal --margin "1" --padding "1 2" "Edit the drive file with your preferred partitioning scheme." - gum input --placeholder "Press Enter to continue" >/dev/null - vim "$HOME/monorepo/nix/disko/$DRIVE.nix" + if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE" ]; then + cp "$HOME/monorepo/nix/disko/sda-simple.nix" "$HOME/monorepo/nix/disko/$DRIVE" + gum style --border normal --margin "1" --padding "1 2" "Edit the drive file with your preferred partitioning scheme." + gum input --placeholder "Press Enter to continue" >/dev/null + vim "$HOME/monorepo/nix/disko/$DRIVE" + fi + cd "$HOME/monorepo" && git add . && cd "$HOME" fi - cd "$HOME/monorepo" && git add . && cd "$HOME" + if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE" ]; then + echo "error: you should create a new system if you use a drive file that is not in the repo." + exit 1 + fi gum style --border normal --margin "1" --padding "1 2" "Formatting the drive is destructive!" if gum confirm "Are you sure you want to continue?"; then @@ -3341,7 +3360,7 @@ This contains the installation script I use to install my systems. exit 1 fi - sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/disko/$DRIVE.nix" + sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/disko/$DRIVE" cd /mnt sudo nixos-install --flake "$HOME/monorepo/nix#$SYSTEM" diff --git a/index.org b/index.org index 08798b2..7d3ef8a 100644 --- a/index.org +++ b/index.org @@ -52,7 +52,7 @@ can therefore publish them. So I did! Configurations include: - Qutebrowser …and many more! * [[https://git.nullring.xyz][Projects]] -My programming projects can be found on my git server; other projects that do not directly pertain +My programming projects can be found on my [[https://ret2pop.net/gitweb][git server]]; other projects that do not directly pertain to my projects on git or need a more in-depth explanation are explained further in my blog. I also have a [[https://github.com/ret2pop][github]] for those interested. * [[https://youtube.com/@ret2pop][Music and Media]] diff --git a/nix/disko/vda-simple.nix b/nix/disko/vda-simple.nix index 32fa28d..3ae1d34 100644 --- a/nix/disko/vda-simple.nix +++ b/nix/disko/vda-simple.nix @@ -12,6 +12,7 @@ type = "EF02"; }; root = { + label = "disk-main-root"; size = "100%"; content = { type = "filesystem"; diff --git a/nix/flake.nix b/nix/flake.nix index 4b08aa9..021bcce 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -35,6 +35,13 @@ outputs = { self, nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, nix-topology, nixos-dns, deep-research, ... }@attrs: let + hostnames = [ + "affinity" + "continuity" + "installer" + "spontaneity" + # add hostnames here + ]; system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; generate = nixos-dns.utils.generate nixpkgs.legacyPackages."${system}"; @@ -42,8 +49,7 @@ inherit (self) nixosConfigurations; extraConfig = import ./dns/default.nix; }; - mkConfigs = map (hostname: { - name = "${hostname}"; + mkConfigs = map (hostname: {name = "${hostname}"; value = nixpkgs.lib.nixosSystem { inherit system; specialArgs = attrs; @@ -54,7 +60,7 @@ ] else [ { environment.systemPackages = with nixpkgs.lib; [ - deep-research.packages.${system}.deep-research + deep-research.packages."${system}".deep-research ]; } nix-topology.nixosModules.default @@ -65,7 +71,7 @@ nixos-dns.nixosModules.dns { nixpkgs.overlays = [ nur.overlays.default ]; - home-manager.extraSpecialArgs = attrs; + home-manager.extraSpecialArgs = attrs // { systemHostName = "${hostname}"; }; networking.hostName = "${hostname}"; } (./. + "/systems/${hostname}/default.nix") @@ -74,12 +80,7 @@ }); in { # add new systems here - nixosConfigurations = builtins.listToAttrs (mkConfigs [ - "affinity" - "continuity" - "installer" - "spontaneity" - ]); + nixosConfigurations = builtins.listToAttrs (mkConfigs hostnames); topology."${system}" = import nix-topology { pkgs = import nixpkgs { diff --git a/nix/modules/configuration.nix b/nix/modules/configuration.nix index 5439682..caeb1f7 100644 --- a/nix/modules/configuration.nix +++ b/nix/modules/configuration.nix @@ -78,7 +78,7 @@ loader = { systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.grub.enable); - efi.canTouchEfiVariables = lib.mkDefault (! config.monorepo.profiles.grub.enable); + efi.canTouchEfiVariables = lib.mkForce (! config.monorepo.profiles.grub.enable); }; kernelModules = [ @@ -273,7 +273,7 @@ auditd.enable = true; audit.enable = true; - chromiumSuidSandbox.enable = true; + chromiumSuidSandbox.enable = (! config.monorepo.profiles.ttyonly.enable); sudo.enable = true; }; diff --git a/nix/modules/home/default.nix b/nix/modules/home/default.nix index 614373b..52174a9 100644 --- a/nix/modules/home/default.nix +++ b/nix/modules/home/default.nix @@ -175,26 +175,26 @@ monorepo.profiles = { enable = lib.mkDefault true; - music.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - hyprland.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - email.enable = lib.mkDefault (true && config.monorepo.profiles.enable); + music.enable = lib.mkDefault config.monorepo.profiles.enable; + hyprland.enable = lib.mkDefault config.monorepo.profiles.enable; + email.enable = lib.mkDefault config.monorepo.profiles.enable; # Programming - graphics.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-c.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-rust.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-python.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-sol.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-sh.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-openscad.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-js.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-nix.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-coq.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - lang-haskell.enable = lib.mkDefault (true && config.monorepo.profiles.enable); + graphics.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-c.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-rust.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-python.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-sol.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-sh.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-openscad.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-js.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-nix.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-coq.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-haskell.enable = lib.mkDefault config.monorepo.profiles.enable; - crypto.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - art.enable = lib.mkDefault (true && config.monorepo.profiles.enable); - workstation.enable = lib.mkDefault (true && config.monorepo.profiles.enable); + crypto.enable = lib.mkDefault config.monorepo.profiles.enable; + art.enable = lib.mkDefault config.monorepo.profiles.enable; + workstation.enable = lib.mkDefault config.monorepo.profiles.enable; }; }; } diff --git a/nix/modules/home/fcitx.nix b/nix/modules/home/fcitx.nix index 05dd8f7..bedfdf2 100644 --- a/nix/modules/home/fcitx.nix +++ b/nix/modules/home/fcitx.nix @@ -1,7 +1,8 @@ -{ pkgs, ... }: +{ config, pkgs, lib, ... }: { i18n.inputMethod = { - enabled = "fcitx5"; + type = "fcitx5"; + enable = lib.mkDefault config.monorepo.profiles.graphics.enable; fcitx5.addons = with pkgs; [ fcitx5-gtk fcitx5-chinese-addons diff --git a/nix/modules/home/user.nix b/nix/modules/home/user.nix index 0864baf..1e88b75 100644 --- a/nix/modules/home/user.nix +++ b/nix/modules/home/user.nix @@ -104,5 +104,4 @@ nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos- }; fonts.fontconfig.enable = true; - nixpkgs.config.cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; } diff --git a/nix/modules/home/zsh.nix b/nix/modules/home/zsh.nix index 31c7680..9f848bc 100644 --- a/nix/modules/home/zsh.nix +++ b/nix/modules/home/zsh.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, ... }: +{ lib, config, pkgs, systemHostName, ... }: { programs.zsh = { enable = true; @@ -25,8 +25,7 @@ g = "git"; v = "vim"; py = "python3"; - rb = "sudo nixos-rebuild switch --flake .#continuity"; - rba = "sudo nixos-rebuild switch --flake .#affinity"; + rb = "sudo nixos-rebuild switch --flake .#${systemHostName}"; nfu = "cd ~/monorepo/nix && git add . && git commit -m \"new flake lock\" && nix flake update"; usync = "rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${config.monorepo.vars.remoteHost}:/var/www/ret2pop-website/"; usite diff --git a/nix/modules/xserver.nix b/nix/modules/xserver.nix index aab138d..0d5b29c 100644 --- a/nix/modules/xserver.nix +++ b/nix/modules/xserver.nix @@ -1,9 +1,9 @@ { lib, config, pkgs, ... }: { services.xserver = { - enable = lib.mkDefault true; + enable = (! config.monorepo.profiles.ttyonly.enable); displayManager = { - startx.enable = true; + startx.enable = (! config.monorepo.profiles.ttyonly.enable); }; windowManager = { diff --git a/nix/systems/installer/commits.nix b/nix/systems/installer/commits.nix index cf5d66c..bf865a3 100644 --- a/nix/systems/installer/commits.nix +++ b/nix/systems/installer/commits.nix @@ -1,4 +1,5 @@ { diskoCommitHash = "a5c4f2ab72e3d1ab43e3e65aa421c6f2bd2e12a1"; monorepoCommitHash = "af3c15c43c65fd77aab441f4c657aeaa74cc67d5"; + monorepoUrl = "https://github.com/ret2pop/monorepo"; } diff --git a/nix/systems/installer/default.nix b/nix/systems/installer/default.nix index 5541ecb..75f0b81 100644 --- a/nix/systems/installer/default.nix +++ b/nix/systems/installer/default.nix @@ -50,12 +50,21 @@ if [ "$(id -u)" -eq 0 ]; then exit 1 fi -if [ -z "$SYSTEM" ]; then - SYSTEM=continuity +gum style --border normal --margin "1" --padding "1 2" "Choose a system to install or select `new` in order to create a new system." + +SYSTEM="$(gum choose "$(find "$HOME/monorepo/nix/systems" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | grep -v -E 'installer'; printf "New")")" + +if [[ "$SYSTEM" == "New" ]]; then + gum style --border normal --margin "1" --padding "1 2" "Choose a system name" + SYSTEM="$(gum input --placeholder "system name")" fi -if [ -z "$DRIVE" ]; then - DRIVE=sda-simple +gum style --border normal --margin "1" --padding "1 2" "Select a drive file or create a new drive file." +DRIVE="$(gum choose "$(find "$HOME/monorepo/nix/disko" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | printf "New")")" + +if [[ "$DRIVE" == "New" ]]; then + gum style --border normal --margin "1" --padding "1 2" "Choose a name to call your drive file." + SYSTEM="$(gum input --placeholder "drive file name (ex: my_sda.nix)")" fi ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installation..." || nmtui @@ -63,9 +72,10 @@ ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installa cd "$HOME" if [ ! -d "$HOME/monorepo/" ]; then - git clone https://git.nullring.xyz/monorepo.git - cd monorepo + git clone ${commits.monorepoUrl} + cd "$HOME/monorepo" git checkout "${commits.monorepoCommitHash}" + cd "$HOME" fi @@ -77,7 +87,7 @@ if [ ! -d "$HOME/monorepo/nix/systems/$SYSTEM" ]; then { imports = [ ../../modules/default.nix - ../../disko/$DRIVE.nix + ../../disko/$DRIVE ../home.nix ]; } @@ -87,17 +97,21 @@ EOF gum input --placeholder "Press Enter to continue" >/dev/null vim "$HOME/monorepo/nix/systems/$SYSTEM/default.nix" - sed -i "/mkConfigs \[/,/\]/ s/^\(\s*\)\]/\1 \"$SYSTEM\"\n\1]/" "$HOME/monorepo/nix/flake.nix" -fi + sed -i "/hostnames = \[/,/];/ { /];/i \ \"your-hostname-$SYSTEM\" }" "$HOME/monorepo/nix/flake.nix" -if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE.nix" ]; then - cp "$HOME/monorepo/nix/disko/sda-simple.nix" "$HOME/monorepo/nix/disko/$DRIVE.nix" - gum style --border normal --margin "1" --padding "1 2" "Edit the drive file with your preferred partitioning scheme." - gum input --placeholder "Press Enter to continue" >/dev/null - vim "$HOME/monorepo/nix/disko/$DRIVE.nix" + if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE" ]; then + cp "$HOME/monorepo/nix/disko/sda-simple.nix" "$HOME/monorepo/nix/disko/$DRIVE" + gum style --border normal --margin "1" --padding "1 2" "Edit the drive file with your preferred partitioning scheme." + gum input --placeholder "Press Enter to continue" >/dev/null + vim "$HOME/monorepo/nix/disko/$DRIVE" + fi + cd "$HOME/monorepo" && git add . && cd "$HOME" fi -cd "$HOME/monorepo" && git add . && cd "$HOME" +if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE" ]; then + echo "error: you should create a new system if you use a drive file that is not in the repo." + exit 1 +fi gum style --border normal --margin "1" --padding "1 2" "Formatting the drive is destructive!" if gum confirm "Are you sure you want to continue?"; then @@ -107,7 +121,7 @@ else exit 1 fi -sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/disko/$DRIVE.nix" +sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/disko/$DRIVE" cd /mnt sudo nixos-install --flake "$HOME/monorepo/nix#$SYSTEM" diff --git a/nix/systems/spontaneity/default.nix b/nix/systems/spontaneity/default.nix index 776149d..3aa0a39 100644 --- a/nix/systems/spontaneity/default.nix +++ b/nix/systems/spontaneity/default.nix @@ -15,6 +15,8 @@ grub.enable = true; }; }; + + boot.loader.grub.device = "nodev"; networking = { firewall.allowedTCPPorts = [ 80 @@ -44,6 +46,7 @@ "mail.${config.monorepo.vars.remoteHost}" = {}; "nullring.xyz" = {}; + "git.nullring.xyz" = {}; "matrix.nullring.xyz" = {}; "talk.nullring.xyz" = {}; "mail.nullring.xyz" = {};