]> Untitled Git - monorepo.git/commitdiff
Finish automation of spontaneity cloud deployments
authorPreston Pan <ret2pop@gmail.com>
Wed, 5 Feb 2025 11:38:52 +0000 (03:38 -0800)
committerPreston Pan <ret2pop@gmail.com>
Wed, 5 Feb 2025 11:38:52 +0000 (03:38 -0800)
22 files changed:
agenda.org
config/emacs.el
config/emacs.org
config/nix.org
nix/flake.nix
nix/modules/configuration.nix
nix/modules/default.nix
nix/modules/home/default.nix
nix/modules/home/emacs.nix
nix/modules/home/firefox.nix
nix/modules/home/gammastep.nix
nix/modules/home/git.nix
nix/modules/home/kitty.nix
nix/modules/home/mako.nix
nix/modules/home/mpv.nix
nix/modules/home/user.nix
nix/modules/home/wofi.nix
nix/modules/home/yt-dlp.nix
nix/modules/vda-simple.nix
nix/systems/spontaneity/default.nix
nix/systems/spontaneity/hardware-configuration.nix [new file with mode: 0644]
nix/systems/spontaneity/home.nix

index 4a60f8dfa1e7a74a2748975988c375ce000ead5f..66484a31e0fb8806b7644071ab814b02519351b2 100644 (file)
@@ -25,6 +25,10 @@ systems and also should be relatively abstractable (i.e. identifiers tied to me
 removed from the flake).
 *** TODO [#B] VPS
 My VPS needs to be a NixOS configuration.
+**** DONE Automation
+I need to automate deployment of my NixOS VPS.
+**** TODO Migration
+Migrate all my services to NixOS.
 *** DONE [#A] NixOS Modules
 :LOGBOOK:
 CLOCK: [2025-01-11 Sat 17:03]--[2025-01-11 Sat 19:35] =>  2:32
index 76c9eeedf281b5ffe1056d2132051356ca9973ba..d3b251de784aed463aba7667cfe19490980370ba 100644 (file)
@@ -6,6 +6,7 @@
   :custom
   ;; Startup errors
   (warning-minimum-level :emergency "Supress emacs warnings")
+  (confirm-kill-processes nil "Don't ask to quit")
   (debug-ignored-errors (cons 'remote-file-error debug-ignored-errors) "Remove annoying error from debug errors")
 
   ;; Mouse wheel
   (make-backup-files nil "Don't make backups")
   (display-fill-column-indicator-column 150 "Draw a line at 100 characters")
   (line-spacing 2 "Default line spacing")
-
-  ;; Editor comments
   (c-doc-comment-style '((c-mode . doxygen)
                         (c++-mode . doxygen)))
+
   :hook ((text-mode . auto-fill-mode)
         (text-mode . visual-line-mode)
         (prog-mode . auto-fill-mode)
   (require 'llm-ollama)
   (setopt ellama-provider (make-llm-ollama
             :host "localhost"
-            :chat-model "deepseek-r1:14b")))
+            :chat-model "phi4:latest")))
 
 (use-package elfeed
   :custom
index 6a9b698ec49a473a274679505b659bef57a16ed3..8dff6916dae378f20e70581d59407680f4ee2bd3 100644 (file)
@@ -27,6 +27,7 @@ Emacs is self documenting, after all!
     :custom
     ;; Startup errors
     (warning-minimum-level :emergency "Supress emacs warnings")
+    (confirm-kill-processes nil "Don't ask to quit")
     (debug-ignored-errors (cons 'remote-file-error debug-ignored-errors) "Remove annoying error from debug errors")
 
     ;; Mouse wheel
@@ -537,7 +538,7 @@ competitive LLM that doesn't cost money.
     (require 'llm-ollama)
     (setopt ellama-provider (make-llm-ollama
             :host "localhost"
-            :chat-model "deepseek-r1:14b")))
+            :chat-model "phi4:latest")))
 #+end_src
 ** RSS Feed
 I use really simple syndication (RSS) in order to read news. As a result, I use
index 1ecec87cbd205a5b30cd0c929dbc223529a9aa3f..bfd413dca8ee520f505297bbeec22f45993c1e6c 100644 (file)
@@ -99,6 +99,7 @@ so that adding new configurations that add modifications is made simple.
                sops-nix.nixosModules.sops
                { nixpkgs.overlays = [ nur.overlays.default ]; }
                { home-manager.extraSpecialArgs = attrs; }
+            ./systems/spontaneity/hardware-configuration.nix
             ./systems/spontaneity/default.nix
           ];
            };
@@ -209,6 +210,7 @@ under ~default.nix~ in the ~systems~ folder.
                    home.enable = lib.mkEnableOption "Enables home user";
                    server.enable = lib.mkEnableOption "Enables server services";
           ttyonly.enable = lib.mkEnableOption "TTY only, no xserver";
+          grub.enable = lib.mkEnableOption "Enables grub instead of systemd-boot";
            };
       };
     };
@@ -219,6 +221,9 @@ under ~default.nix~ in the ~systems~ folder.
            man-pages
            man-pages-posix
       ]);
+      boot.loader.grub = lib.mkIf config.monorepo.profiles.grub.enable {
+        enable = true;
+      };
 
       monorepo = {
            profiles = {
@@ -584,8 +589,8 @@ because they enhance security.
       };
 
       loader = {
-           systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.secureBoot.enable);
-           efi.canTouchEfiVariables = true;
+           systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.grub.enable);
+           efi.canTouchEfiVariables = lib.mkDefault (! config.monorepo.profiles.grub.enable);
       };
 
       kernelModules = [
@@ -911,41 +916,33 @@ For my nvme drives.
 *** VDA
 For my virtual machines.
 #+begin_src nix :tangle ../nix/modules/vda-simple.nix
-{
-  disko.devices = {
-    disk = {
-      my-disk = {
-        device = "/dev/vda";
-        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 = {
+        main = {
+          device = "/dev/vda";
+          type = "disk";
+          content = {
+            type = "gpt";
+            partitions = {
+              boot = {
+                size = "1M";
+                type = "EF02";
               };
-            };
-            root = {
-              size = "100%";
-              priority = 2;
-              content = {
-                type = "filesystem";
-                format = "ext4";
-                mountpoint = "/";
+              root = {
+                size = "100%";
+                content = {
+                  type = "filesystem";
+                  format = "ext4";
+                  mountpoint = "/";
+                };
               };
             };
           };
         };
       };
     };
-  };
-}
+  }
 #+end_src
 ** Home
 *** Default Home Profile
@@ -978,172 +975,174 @@ I have many imports that we'll go through next.
 
     options = {
       monorepo.profiles = {
-       enable = lib.mkEnableOption "Enables home manager desktop configuration";
-       # Programs
-       lang-c.enable = lib.mkEnableOption "Enables C language support";
-       lang-sh.enable = lib.mkEnableOption "Enables sh language support";
-       lang-rust.enable = lib.mkEnableOption "Enables Rust language support";
-       lang-python.enable = lib.mkEnableOption "Enables python language support";
-       lang-sol.enable = lib.mkEnableOption "Enables solidity language support";
-       lang-openscad.enable = lib.mkEnableOption "Enables openscad language support";
-       lang-js.enable = lib.mkEnableOption "Enables javascript language support";
-       lang-nix.enable = lib.mkEnableOption "Enables nix language support";
-       lang-coq.enable = lib.mkEnableOption "Enables coq language support";
-
-       crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets";
-       art.enable = lib.mkEnableOption "Enables various art programs";
-       music.enable = lib.mkEnableOption "Enables mpd";
-       workstation.enable = lib.mkEnableOption "Enables workstation packages (music production and others)";
-       cuda.enable = lib.mkEnableOption "Enables CUDA user package builds";
-
-       hyprland = {
-               enable = lib.mkEnableOption "Enables hyprland";
-               monitors = lib.mkOption {
-                       type = lib.types.listOf lib.types.str;
-                       default = [
-                         "HDMI-A-1"
-                         "eDP-1"
-                         "DP-2"
-                         "DP-3"
-                         "LVDS-1"
-          "DP-4"
-                       ];
-                       example = [];
-                       description = "Hyprland monitors";
-               };
-       };
-       email = {
-               email = lib.mkOption {
-                       type = lib.types.str;
-                       default = "ret2pop@gmail.com";
-                       example = "john@example.com";
-                       description = "Email address and imaps/smtps account";
-               };
-               imapsServer = lib.mkOption {
-                       type = lib.types.str;
-                       default = "imap.gmail.com";
-                       example = "imap.example.com";
-                       description = "imaps server address";
-               };
-               smtpsServer = lib.mkOption {
-                       type = lib.types.str;
-                       default = "smtp.gmail.com";
-                       example = "smtp.example.com";
-                       description = "smtp server address";
-               };
-               enable = lib.mkEnableOption "Enables email";
-       };
+           enable = lib.mkEnableOption "Enables home manager desktop configuration";
+           # Programs
+        graphics.enable = lib.mkEnableOption "Enables graphical programs for user";
+           lang-c.enable = lib.mkEnableOption "Enables C language support";
+           lang-sh.enable = lib.mkEnableOption "Enables sh language support";
+           lang-rust.enable = lib.mkEnableOption "Enables Rust language support";
+           lang-python.enable = lib.mkEnableOption "Enables python language support";
+           lang-sol.enable = lib.mkEnableOption "Enables solidity language support";
+           lang-openscad.enable = lib.mkEnableOption "Enables openscad language support";
+           lang-js.enable = lib.mkEnableOption "Enables javascript language support";
+           lang-nix.enable = lib.mkEnableOption "Enables nix language support";
+           lang-coq.enable = lib.mkEnableOption "Enables coq language support";
+
+           crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets";
+           art.enable = lib.mkEnableOption "Enables various art programs";
+           music.enable = lib.mkEnableOption "Enables mpd";
+           workstation.enable = lib.mkEnableOption "Enables workstation packages (music production and others)";
+           cuda.enable = lib.mkEnableOption "Enables CUDA user package builds";
+
+           hyprland = {
+                   enable = lib.mkEnableOption "Enables hyprland";
+                   monitors = lib.mkOption {
+                           type = lib.types.listOf lib.types.str;
+                           default = [
+                             "HDMI-A-1"
+                             "eDP-1"
+                             "DP-2"
+                             "DP-3"
+                             "LVDS-1"
+              "DP-4"
+                           ];
+                           example = [];
+                           description = "Hyprland monitors";
+                   };
+           };
+           email = {
+                   email = lib.mkOption {
+                           type = lib.types.str;
+                           default = "ret2pop@gmail.com";
+                           example = "john@example.com";
+                           description = "Email address and imaps/smtps account";
+                   };
+                   imapsServer = lib.mkOption {
+                           type = lib.types.str;
+                           default = "imap.gmail.com";
+                           example = "imap.example.com";
+                           description = "imaps server address";
+                   };
+                   smtpsServer = lib.mkOption {
+                           type = lib.types.str;
+                           default = "smtp.gmail.com";
+                           example = "smtp.example.com";
+                           description = "smtp server address";
+                   };
+                   enable = lib.mkEnableOption "Enables email";
+           };
       };
     };
 
     config = {
       home.packages = (if config.monorepo.profiles.email.enable then [ pkgs.mu ] else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-c.enable then (with pkgs; [
-                                               autobuild
-                                               clang
-                                               gdb
-                                               gnumake
-                                               bear
-                                               clang-tools
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-js.enable then (with pkgs; [
-                                               nodejs
-                                               bun
-                                               yarn
-                                               typescript
-                                               vscode-langservers-extracted
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-rust.enable then (with pkgs; [
-                                               cargo
-                                               rust-analyzer
-                                               rustfmt
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-python.enable then (with pkgs; [
-                                               poetry
-                                               python3
-                                               python312Packages.jedi
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-sol.enable then (with pkgs; [
-                                               solc
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-openscad.enable then (with pkgs; [
-                                               openscad
-                                               openscad-lsp
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-sh.enable then (with pkgs; [
-                                               bash-language-server
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-coq.enable then (with pkgs; [
-                                               coq
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-nix.enable then (with pkgs; [
-                                               nil
-                                               nixd
-                                               nixfmt-rfc-style
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.crypto.enable then (with pkgs; [
-                                               bitcoin
-                                               electrum
-                                               monero-cli
-                                               monero-gui
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.art.enable then (with pkgs; [
-                                               inkscape
-                                               krita
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.music.enable then (with pkgs; [
-                                               mpc-cli
-                                               sox
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.workstation.enable then (with pkgs; [
-                       alsa-utils
-                       alsa-scarlett-gui
-                                   ardour
-                                   audacity
-                                         blender
-                       fluidsynth
-                       qjackctl
-                       qsynth
-                       qpwgraph
-                       imagemagick
-                       inkscape
-                       kdenlive
-                       kicad
-                                             ]) else []);
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-c.enable then (with pkgs; [
+                                                         autobuild
+                                                         clang
+                                                         gdb
+                                                         gnumake
+                                                         bear
+                                                         clang-tools
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-js.enable then (with pkgs; [
+                                                         nodejs
+                                                         bun
+                                                         yarn
+                                                         typescript
+                                                         vscode-langservers-extracted
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-rust.enable then (with pkgs; [
+                                                         cargo
+                                                         rust-analyzer
+                                                         rustfmt
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-python.enable then (with pkgs; [
+                                                         poetry
+                                                         python3
+                                                         python312Packages.jedi
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-sol.enable then (with pkgs; [
+                                                         solc
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-openscad.enable then (with pkgs; [
+                                                         openscad
+                                                         openscad-lsp
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-sh.enable then (with pkgs; [
+                                                         bash-language-server
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-coq.enable then (with pkgs; [
+                                                         coq
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-nix.enable then (with pkgs; [
+                                                         nil
+                                                         nixd
+                                                         nixfmt-rfc-style
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.crypto.enable then (with pkgs; [
+                                                         bitcoin
+                                                         electrum
+                                                         monero-cli
+                                                         monero-gui
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.art.enable then (with pkgs; [
+                                                         inkscape
+                                                         krita
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.music.enable then (with pkgs; [
+                                                         mpc-cli
+                                                         sox
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.workstation.enable then (with pkgs; [
+                                       alsa-utils
+                                       alsa-scarlett-gui
+                                             ardour
+                                             audacity
+                                                   blender
+                                       fluidsynth
+                                       qjackctl
+                                       qsynth
+                                       qpwgraph
+                                       imagemagick
+                                       inkscape
+                                       kdenlive
+                                       kicad
+                                                 ]) else []);
 
       monorepo.profiles = {
-       enable = lib.mkDefault true;
-       music.enable = lib.mkDefault true;
-       hyprland.enable = lib.mkDefault true;
-       email.enable = lib.mkDefault true;
-
-       # Programming
-       lang-c.enable = lib.mkDefault true;
-       lang-rust.enable = lib.mkDefault true;
-       lang-python.enable = lib.mkDefault true;
-       lang-sol.enable = lib.mkDefault true;
-       lang-sh.enable = lib.mkDefault true;
-       lang-openscad.enable = lib.mkDefault true;
-       lang-js.enable = lib.mkDefault true;
-       lang-nix.enable = lib.mkDefault true;
-       lang-coq.enable = lib.mkDefault true;
-
-       crypto.enable = lib.mkDefault true;
-       art.enable = lib.mkDefault true;
-       workstation.enable = lib.mkDefault true;
+           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);
+
+           # 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);
+
+           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);
       };
     };
   }
@@ -1155,7 +1154,7 @@ be straightforward.
   { lib, config, pkgs, ... }:
   {
     programs.firefox = {
-      enable = true;
+      enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
       policies = {
         EnableTrackingProtection = true;
         OfferToSaveLogins = false;
@@ -1448,7 +1447,7 @@ as an org file which gets automatically tangled to an emacs-lisp file.
   {
     programs.emacs = 
       {
-        enable = true;
+        enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
         package = pkgs.emacs29-pgtk;
         extraConfig = ''
         (setq debug-on-error t)
@@ -1542,7 +1541,7 @@ the timezone.
 { lib, config, ... }:
 {
   services.gammastep = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     provider = "manual";
     latitude = 49.282730;
     longitude = -123.120735;
@@ -1567,7 +1566,7 @@ Make sure those are set correctly. I've set it to sign by default.
 { lib, config, ... }:
 {
   programs.git = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     userName = config.monorepo.vars.fullName;
     userEmail = config.monorepo.profiles.email.email;
     signing = {
@@ -1734,7 +1733,7 @@ I've set my terminal, kitty, to use catppuccin colors.
 { lib, config, ... }:
 {
   programs.kitty = {
-    enable = lib.mkDefault config.monorepo.profiles.hyprland.enable;
+    enable = lib.mkDefault (config.monorepo.profiles.hyprland.enable && config.monorepo.profiles.graphics.enable);
     settings = {
       enable_audio_bell = false;
       font_family = "Iosevka Nerd Font";
@@ -1792,7 +1791,7 @@ are all set from the get-go!
 { lib, config, sounds, ... }:
 {
   services.mako = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     backgroundColor = "#11111bf8";
     textColor = "#cdd6f4";
     borderColor = "#89b4faff";
@@ -1916,7 +1915,7 @@ here:
 { lib, config, ... }:
 {
   programs.mpv = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     config = {
       profile = "gpu-hq";
       force-window = true;
@@ -2236,7 +2235,7 @@ This is a run launcher for wayland. I also use it for my powermenu.
 { lib, config, ... }:
 {
   programs.wofi = {
-    enable = true; 
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     settings = {
       location = "bottom-right";
       allow_markup = true;
@@ -2428,7 +2427,7 @@ A classic program that allows you to download from youtube. Also has integration
 { lib, config, ... }:
 {
   programs.yt-dlp = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     settings = {
       embed-thumbnail = true;
       embed-subs = true;
@@ -2516,7 +2515,7 @@ for these configurations.
       homeDirectory = "/home/${config.monorepo.vars.userName}";
       stateVersion = "24.11";
 
-      packages = with pkgs; [
+      packages = with pkgs; (if config.monorepo.profiles.graphics.enable then [
         # wikipedia
         kiwix kiwix-tools
 
@@ -2542,11 +2541,7 @@ for these configurations.
         torsocks tor-browser
 
         # fonts
-        noto-fonts
-        noto-fonts-cjk-sans
-        noto-fonts-emoji
-        fira-code
-        font-awesome_6
+        noto-fonts noto-fonts-cjk-sans noto-fonts-emoji fira-code font-awesome_6
         (aspellWithDicts
           (dicts: with dicts; [ en en-computers en-science ]))
         (nerdfonts.override { fonts = [ "Iosevka" ]; })
@@ -2559,7 +2554,25 @@ for these configurations.
         pfetch
         libnotify
         htop
-      ];
+        (writeShellScriptBin "remote-build"
+          ''
+  #!/bin/bash
+  nixos-rebuild --target-host "$1" switch --flake .#spontaneity
+  ''
+        )
+        (writeShellScriptBin "install-vps"
+          ''
+  #!/bin/bash
+  nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ./systems/spontaneity/hardware-configuration.nix --flake .#spontaneity --target-host "$1"
+          '')
+      ] else [
+        pfetch
+
+        # net
+        curl
+        torsocks
+        rsync
+      ]);
     };
 
     services = {
@@ -2576,7 +2589,7 @@ for these configurations.
     programs.bash.enable = true;
 
     gtk = {
-      enable = true;
+      enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
       theme = null;
       iconTheme = null;
     };
@@ -2674,6 +2687,7 @@ Spontaneity is my VPS instance.
       profiles = {
         server.enable = true;
         ttyonly.enable = true;
+        grub.enable = true;
       };
       vars.hostName = "spontaneity";
     };
@@ -2686,6 +2700,7 @@ Spontaneity is my VPS instance.
     imports = [
       ../../modules/home/default.nix
     ];
+    config.monorepo.profiles.enable = false;
   }
 #+end_src
 ** Installer
index 39606b4e9746928a4443f37c7f20c1f3e0ea3a27..4c703cdbe5e1655a62565ada2d8a138c7d1e3ab2 100644 (file)
@@ -79,6 +79,7 @@
                sops-nix.nixosModules.sops
                { nixpkgs.overlays = [ nur.overlays.default ]; }
                { home-manager.extraSpecialArgs = attrs; }
+          ./systems/spontaneity/hardware-configuration.nix
           ./systems/spontaneity/default.nix
         ];
            };
index 62b02f69aec67c22cd60d3ad6ef15072b7299098..36a17020dd1e7d7b57e1d355a97d65a6ea1f894b 100644 (file)
@@ -71,8 +71,8 @@
     };
 
     loader = {
-           systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.secureBoot.enable);
-           efi.canTouchEfiVariables = true;
+           systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.grub.enable);
+           efi.canTouchEfiVariables = lib.mkDefault (! config.monorepo.profiles.grub.enable);
     };
 
     kernelModules = [
index f520d3b890659c8c37e12016d6fb92b0d6daddce..50e5a1bac1bef9f389f1d906013f3bf5d36de381 100644 (file)
@@ -16,6 +16,7 @@
                    home.enable = lib.mkEnableOption "Enables home user";
                    server.enable = lib.mkEnableOption "Enables server services";
         ttyonly.enable = lib.mkEnableOption "TTY only, no xserver";
+        grub.enable = lib.mkEnableOption "Enables grub instead of systemd-boot";
            };
     };
   };
@@ -26,6 +27,9 @@
            man-pages
            man-pages-posix
     ]);
+    boot.loader.grub = lib.mkIf config.monorepo.profiles.grub.enable {
+      enable = true;
+    };
 
     monorepo = {
            profiles = {
index edefc9ef45a562941e9e982d123bd9818dc774f7..45b0890d02ee929dc5b488b892dc920bc3ea871f 100644 (file)
 
   options = {
     monorepo.profiles = {
-       enable = lib.mkEnableOption "Enables home manager desktop configuration";
-       # Programs
-       lang-c.enable = lib.mkEnableOption "Enables C language support";
-       lang-sh.enable = lib.mkEnableOption "Enables sh language support";
-       lang-rust.enable = lib.mkEnableOption "Enables Rust language support";
-       lang-python.enable = lib.mkEnableOption "Enables python language support";
-       lang-sol.enable = lib.mkEnableOption "Enables solidity language support";
-       lang-openscad.enable = lib.mkEnableOption "Enables openscad language support";
-       lang-js.enable = lib.mkEnableOption "Enables javascript language support";
-       lang-nix.enable = lib.mkEnableOption "Enables nix language support";
-       lang-coq.enable = lib.mkEnableOption "Enables coq language support";
+           enable = lib.mkEnableOption "Enables home manager desktop configuration";
+           # Programs
+      graphics.enable = lib.mkEnableOption "Enables graphical programs for user";
+           lang-c.enable = lib.mkEnableOption "Enables C language support";
+           lang-sh.enable = lib.mkEnableOption "Enables sh language support";
+           lang-rust.enable = lib.mkEnableOption "Enables Rust language support";
+           lang-python.enable = lib.mkEnableOption "Enables python language support";
+           lang-sol.enable = lib.mkEnableOption "Enables solidity language support";
+           lang-openscad.enable = lib.mkEnableOption "Enables openscad language support";
+           lang-js.enable = lib.mkEnableOption "Enables javascript language support";
+           lang-nix.enable = lib.mkEnableOption "Enables nix language support";
+           lang-coq.enable = lib.mkEnableOption "Enables coq language support";
 
-       crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets";
-       art.enable = lib.mkEnableOption "Enables various art programs";
-       music.enable = lib.mkEnableOption "Enables mpd";
-       workstation.enable = lib.mkEnableOption "Enables workstation packages (music production and others)";
-       cuda.enable = lib.mkEnableOption "Enables CUDA user package builds";
+           crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets";
+           art.enable = lib.mkEnableOption "Enables various art programs";
+           music.enable = lib.mkEnableOption "Enables mpd";
+           workstation.enable = lib.mkEnableOption "Enables workstation packages (music production and others)";
+           cuda.enable = lib.mkEnableOption "Enables CUDA user package builds";
 
-       hyprland = {
-               enable = lib.mkEnableOption "Enables hyprland";
-               monitors = lib.mkOption {
-                       type = lib.types.listOf lib.types.str;
-                       default = [
-                         "HDMI-A-1"
-                         "eDP-1"
-                         "DP-2"
-                         "DP-3"
-                         "LVDS-1"
-        "DP-4"
-                       ];
-                       example = [];
-                       description = "Hyprland monitors";
-               };
-       };
-       email = {
-               email = lib.mkOption {
-                       type = lib.types.str;
-                       default = "ret2pop@gmail.com";
-                       example = "john@example.com";
-                       description = "Email address and imaps/smtps account";
-               };
-               imapsServer = lib.mkOption {
-                       type = lib.types.str;
-                       default = "imap.gmail.com";
-                       example = "imap.example.com";
-                       description = "imaps server address";
-               };
-               smtpsServer = lib.mkOption {
-                       type = lib.types.str;
-                       default = "smtp.gmail.com";
-                       example = "smtp.example.com";
-                       description = "smtp server address";
-               };
-               enable = lib.mkEnableOption "Enables email";
-       };
+           hyprland = {
+                   enable = lib.mkEnableOption "Enables hyprland";
+                   monitors = lib.mkOption {
+                           type = lib.types.listOf lib.types.str;
+                           default = [
+                             "HDMI-A-1"
+                             "eDP-1"
+                             "DP-2"
+                             "DP-3"
+                             "LVDS-1"
+            "DP-4"
+                           ];
+                           example = [];
+                           description = "Hyprland monitors";
+                   };
+           };
+           email = {
+                   email = lib.mkOption {
+                           type = lib.types.str;
+                           default = "ret2pop@gmail.com";
+                           example = "john@example.com";
+                           description = "Email address and imaps/smtps account";
+                   };
+                   imapsServer = lib.mkOption {
+                           type = lib.types.str;
+                           default = "imap.gmail.com";
+                           example = "imap.example.com";
+                           description = "imaps server address";
+                   };
+                   smtpsServer = lib.mkOption {
+                           type = lib.types.str;
+                           default = "smtp.gmail.com";
+                           example = "smtp.example.com";
+                           description = "smtp server address";
+                   };
+                   enable = lib.mkEnableOption "Enables email";
+           };
     };
   };
 
   config = {
     home.packages = (if config.monorepo.profiles.email.enable then [ pkgs.mu ] else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-c.enable then (with pkgs; [
-                                               autobuild
-                                               clang
-                                               gdb
-                                               gnumake
-                                               bear
-                                               clang-tools
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-js.enable then (with pkgs; [
-                                               nodejs
-                                               bun
-                                               yarn
-                                               typescript
-                                               vscode-langservers-extracted
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-rust.enable then (with pkgs; [
-                                               cargo
-                                               rust-analyzer
-                                               rustfmt
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-python.enable then (with pkgs; [
-                                               poetry
-                                               python3
-                                               python312Packages.jedi
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-sol.enable then (with pkgs; [
-                                               solc
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-openscad.enable then (with pkgs; [
-                                               openscad
-                                               openscad-lsp
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-sh.enable then (with pkgs; [
-                                               bash-language-server
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-coq.enable then (with pkgs; [
-                                               coq
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.lang-nix.enable then (with pkgs; [
-                                               nil
-                                               nixd
-                                               nixfmt-rfc-style
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.crypto.enable then (with pkgs; [
-                                               bitcoin
-                                               electrum
-                                               monero-cli
-                                               monero-gui
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.art.enable then (with pkgs; [
-                                               inkscape
-                                               krita
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.music.enable then (with pkgs; [
-                                               mpc-cli
-                                               sox
-                                             ]) else [])
-                                             ++
-                                             (if config.monorepo.profiles.workstation.enable then (with pkgs; [
-                       alsa-utils
-                       alsa-scarlett-gui
-                                   ardour
-                                   audacity
-                                         blender
-                       fluidsynth
-                       qjackctl
-                       qsynth
-                       qpwgraph
-                       imagemagick
-                       inkscape
-                       kdenlive
-                       kicad
-                                             ]) else []);
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-c.enable then (with pkgs; [
+                                                         autobuild
+                                                         clang
+                                                         gdb
+                                                         gnumake
+                                                         bear
+                                                         clang-tools
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-js.enable then (with pkgs; [
+                                                         nodejs
+                                                         bun
+                                                         yarn
+                                                         typescript
+                                                         vscode-langservers-extracted
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-rust.enable then (with pkgs; [
+                                                         cargo
+                                                         rust-analyzer
+                                                         rustfmt
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-python.enable then (with pkgs; [
+                                                         poetry
+                                                         python3
+                                                         python312Packages.jedi
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-sol.enable then (with pkgs; [
+                                                         solc
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-openscad.enable then (with pkgs; [
+                                                         openscad
+                                                         openscad-lsp
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-sh.enable then (with pkgs; [
+                                                         bash-language-server
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-coq.enable then (with pkgs; [
+                                                         coq
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.lang-nix.enable then (with pkgs; [
+                                                         nil
+                                                         nixd
+                                                         nixfmt-rfc-style
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.crypto.enable then (with pkgs; [
+                                                         bitcoin
+                                                         electrum
+                                                         monero-cli
+                                                         monero-gui
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.art.enable then (with pkgs; [
+                                                         inkscape
+                                                         krita
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.music.enable then (with pkgs; [
+                                                         mpc-cli
+                                                         sox
+                                                 ]) else [])
+                                                 ++
+                                                 (if config.monorepo.profiles.workstation.enable then (with pkgs; [
+                                       alsa-utils
+                                       alsa-scarlett-gui
+                                             ardour
+                                             audacity
+                                                   blender
+                                       fluidsynth
+                                       qjackctl
+                                       qsynth
+                                       qpwgraph
+                                       imagemagick
+                                       inkscape
+                                       kdenlive
+                                       kicad
+                                                 ]) else []);
 
     monorepo.profiles = {
-       enable = lib.mkDefault true;
-       music.enable = lib.mkDefault true;
-       hyprland.enable = lib.mkDefault true;
-       email.enable = lib.mkDefault true;
+           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);
 
-       # Programming
-       lang-c.enable = lib.mkDefault true;
-       lang-rust.enable = lib.mkDefault true;
-       lang-python.enable = lib.mkDefault true;
-       lang-sol.enable = lib.mkDefault true;
-       lang-sh.enable = lib.mkDefault true;
-       lang-openscad.enable = lib.mkDefault true;
-       lang-js.enable = lib.mkDefault true;
-       lang-nix.enable = lib.mkDefault true;
-       lang-coq.enable = lib.mkDefault true;
+           # 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);
 
-       crypto.enable = lib.mkDefault true;
-       art.enable = lib.mkDefault true;
-       workstation.enable = lib.mkDefault true;
+           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);
     };
   };
 }
index 5e3d6aa5cfa7c6917be761683bb6aa18483d8f2a..5f39e8719454a60dcc51c780e690f62676b574dc 100644 (file)
@@ -2,7 +2,7 @@
 {
   programs.emacs = 
     {
-      enable = true;
+      enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
       package = pkgs.emacs29-pgtk;
       extraConfig = ''
       (setq debug-on-error t)
index 118e150227dd09fce55dc68aec77c645a9b36ec2..986fccfc674734d84da4b60d09fc5f45ce967f33 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, pkgs, ... }:
 {
   programs.firefox = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     policies = {
       EnableTrackingProtection = true;
       OfferToSaveLogins = false;
index ae9d111db47ba9918c96626c9ff771f35870e192..208dda7a5384fb57ce8bcdd69a528d667eca01ba 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, ... }:
 {
   services.gammastep = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     provider = "manual";
     latitude = 49.282730;
     longitude = -123.120735;
index d019ddb63182bae3476c84c2cfbef8e90e90b0a1..9c15aace3f40dd8f163e9fd1047e8d77a1a17cf8 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, ... }:
 {
   programs.git = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     userName = config.monorepo.vars.fullName;
     userEmail = config.monorepo.profiles.email.email;
     signing = {
index 973581a34cc41132077cd3730a2ef1f8d1f3b4c2..b99736e5ea11da36f2a04c769a61a0c37ce8d8b0 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, ... }:
 {
   programs.kitty = {
-    enable = lib.mkDefault config.monorepo.profiles.hyprland.enable;
+    enable = lib.mkDefault (config.monorepo.profiles.hyprland.enable && config.monorepo.profiles.graphics.enable);
     settings = {
       enable_audio_bell = false;
       font_family = "Iosevka Nerd Font";
index eb70eee7c81fb02bb6105e7da2191d102fa713eb..d9a46101582f50934760e01931fab7a0d70ae5b8 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, sounds, ... }:
 {
   services.mako = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     backgroundColor = "#11111bf8";
     textColor = "#cdd6f4";
     borderColor = "#89b4faff";
index 42f56877d0029fe468465a007ef2207f58b344d2..6dd7f4d904b3fd9300414d2640ba2c648a20710e 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, ... }:
 {
   programs.mpv = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     config = {
       profile = "gpu-hq";
       force-window = true;
index 7c470aa2132f6eab75c3678b36cd48e885a3475e..882041baee515a85e9912d2a096f7b83b6f3e967 100644 (file)
@@ -23,7 +23,7 @@
     homeDirectory = "/home/${config.monorepo.vars.userName}";
     stateVersion = "24.11";
 
-    packages = with pkgs; [
+    packages = with pkgs; (if config.monorepo.profiles.graphics.enable then [
       # wikipedia
       kiwix kiwix-tools
 
       torsocks tor-browser
 
       # fonts
-      noto-fonts
-      noto-fonts-cjk-sans
-      noto-fonts-emoji
-      fira-code
-      font-awesome_6
+      noto-fonts noto-fonts-cjk-sans noto-fonts-emoji fira-code font-awesome_6
       (aspellWithDicts
         (dicts: with dicts; [ en en-computers en-science ]))
       (nerdfonts.override { fonts = [ "Iosevka" ]; })
       pfetch
       libnotify
       htop
-    ];
+      (writeShellScriptBin "install_vps"
+        ''
+#!/bin/bash
+nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ./systems/spontaneity/hardware-configuration.nix --flake .#spontaneity --target-host "$1"
+        ''
+      )
+    ] else [
+      pfetch
+
+      # net
+      curl
+      torsocks
+      rsync
+    ]);
   };
 
   services = {
@@ -83,7 +92,7 @@
   programs.bash.enable = true;
 
   gtk = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     theme = null;
     iconTheme = null;
   };
index f6c41799fac876b2aa12569009040194bac98165..ec2e3bc86ae9e998244aa936b4c11fb135ce3474 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, ... }:
 {
   programs.wofi = {
-    enable = true; 
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     settings = {
       location = "bottom-right";
       allow_markup = true;
index 5ed35f5ca7abb15b4ebc733a401caf85aa0c0f92..b9dd8e01d9ee50447807ff9d7ad9a6b82fcd0b41 100644 (file)
@@ -1,7 +1,7 @@
 { lib, config, ... }:
 {
   programs.yt-dlp = {
-    enable = true;
+    enable = lib.mkDefault config.monorepo.profiles.graphics.enable;
     settings = {
       embed-thumbnail = true;
       embed-subs = true;
index f18b1c3e3a395f38338daab38eb3478646d366ac..32fa28d068cdcb658be0ccfabd6eb5a01ac0b7e9 100644 (file)
@@ -1,26 +1,18 @@
 {
   disko.devices = {
     disk = {
-      my-disk = {
+      main = {
         device = "/dev/vda";
         type = "disk";
         content = {
           type = "gpt";
           partitions = {
-            ESP = {
-              type = "EF00";
-              size = "500M";
-              priority = 1;
-              content = {
-                type = "filesystem";
-                format = "vfat";
-                mountpoint = "/boot";
-                mountOptions = [ "umask=0077" ];
-              };
+            boot = {
+              size = "1M";
+              type = "EF02";
             };
             root = {
               size = "100%";
-              priority = 2;
               content = {
                 type = "filesystem";
                 format = "ext4";
index 5f798553961032ab008179ef02465adae3d2b3c9..ae79429ddb439b3e1cfd7807d46e66eddc0c4e95 100644 (file)
@@ -10,6 +10,7 @@
     profiles = {
       server.enable = true;
       ttyonly.enable = true;
+      grub.enable = true;
     };
     vars.hostName = "spontaneity";
   };
diff --git a/nix/systems/spontaneity/hardware-configuration.nix b/nix/systems/spontaneity/hardware-configuration.nix
new file mode 100644 (file)
index 0000000..050ed23
--- /dev/null
@@ -0,0 +1,23 @@
+# 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 = [ ];
+
+  boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
+  boot.initrd.kernelModules = [ ];
+  boot.kernelModules = [ ];
+  boot.extraModulePackages = [ ];
+
+  # 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.<interface>.useDHCP`.
+  networking.useDHCP = lib.mkDefault true;
+  # networking.interfaces.ens3.useDHCP = lib.mkDefault true;
+
+  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+  virtualisation.hypervGuest.enable = true;
+}
index 276ba5241017a19471ebd5420fb060e8c7d360bb..cc93b5dbc7865e18d427093091a830b341f8c13d 100644 (file)
@@ -3,4 +3,5 @@
   imports = [
     ../../modules/home/default.nix
   ];
+  config.monorepo.profiles.enable = false;
 }