From 46e8b0c5e914c0283a08b0f08aa3cc7c381f47b8 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 28 Jan 2025 13:07:16 -0800 Subject: add kiwix; yasnippet macros; a couple new entries; update website --- config/nix.org | 900 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 454 insertions(+), 446 deletions(-) (limited to 'config/nix.org') diff --git a/config/nix.org b/config/nix.org index cac6245..4ff5a08 100644 --- a/config/nix.org +++ b/config/nix.org @@ -1128,268 +1128,273 @@ I have many imports that we'll go through next. I conditionally enable metamask based on the cryptocurrency option. Everything else here should be straightforward. #+begin_src nix :tangle ../nix/modules/home/firefox.nix -{ lib, config, pkgs, ... }: -{ - programs.firefox = { - enable = true; - policies = { - EnableTrackingProtection = true; - OfferToSaveLogins = false; - }; - package = pkgs.firefox-wayland; - profiles = { - default = { - id = 0; - name = "default"; - isDefault = true; - - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - tree-style-tab - firefox-color - vimium - ] - ++ (lib.optional - config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.metamask); - - settings = { - media = { - memory_cache_max_size = 65536; - cache_readahead_limit = 7200; - cache_resume_threshold = 3600; - peerconnection.ice = { - proxy_only_if_behind_proxy = true; - default_address_only = true; - }; - }; - - gfx = { - content.skia-font-cache-size = 20; - canvas.accelerated = { - cache-items = 4096; - cache-size = 512; + { lib, config, pkgs, ... }: + { + programs.firefox = { + enable = true; + policies = { + EnableTrackingProtection = true; + OfferToSaveLogins = false; + }; + package = pkgs.firefox-wayland; + profiles = { + default = { + id = 0; + name = "default"; + isDefault = true; + + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + tree-style-tab + firefox-color + vimium + ] + ++ (lib.optional + config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.metamask); + + settings = { + media = { + memory_cache_max_size = 65536; + cache_readahead_limit = 7200; + cache_resume_threshold = 3600; + peerconnection.ice = { + proxy_only_if_behind_proxy = true; + default_address_only = true; + }; }; - }; - network = { - http = { - max-connections = 1800; - max-persistent-connections-per-server = 10; - max-urgent-start-excessive-connections-per-host = 5; - referer.XOriginTrimmingPolicy = 2; + gfx = { + content.skia-font-cache-size = 20; + canvas.accelerated = { + cache-items = 4096; + cache-size = 512; + }; }; - buffer.cache = { - size = 262144; - count = 128; - }; + network = { + http = { + max-connections = 1800; + max-persistent-connections-per-server = 10; + max-urgent-start-excessive-connections-per-host = 5; + referer.XOriginTrimmingPolicy = 2; + }; - dns = { - max_high_priority_threads = 8; - disablePrefetch = true; - }; + buffer.cache = { + size = 262144; + count = 128; + }; - pacing.requests.enabled = false; - dnsCacheExpiration = 3600; - ssl_tokens_cache_capacity = 10240; - prefetch-next = false; - predictor.enabled = false; - cookie.sameSite.noneRequiresSecure = true; - IDN_show_punycode = true; - auth.subresource-http-auth-allow = 1; - captive-portal-service.enabled = false; - connectivity-service.enabled = false; - }; + dns = { + max_high_priority_threads = 8; + disablePrefetch = true; + }; - browser = { - download = { - always_ask_before_handling_new_types = true; - manager.addToRecentDocs = false; - open_pdf_attachments_inline = true; - start_downloads_in_tmp_dir = true; + pacing.requests.enabled = false; + dnsCacheExpiration = 3600; + ssl_tokens_cache_capacity = 10240; + prefetch-next = false; + predictor.enabled = false; + cookie.sameSite.noneRequiresSecure = true; + IDN_show_punycode = true; + auth.subresource-http-auth-allow = 1; + captive-portal-service.enabled = false; + connectivity-service.enabled = false; }; - urlbar = { - suggest.quicksuggest.sponsored = false; - suggest.quicksuggest.nonsponsored = false; - suggest.calculator = true; - update2.engineAliasRefresh = true; - unitConversion.enabled = true; - trending.featureGate = false; - }; + browser = { + download = { + always_ask_before_handling_new_types = true; + manager.addToRecentDocs = false; + open_pdf_attachments_inline = true; + start_downloads_in_tmp_dir = true; + }; - search = { - separatePrivateDefault.ui.enabled = true; - suggest.enabled = false; - }; + urlbar = { + suggest.quicksuggest.sponsored = false; + suggest.quicksuggest.nonsponsored = false; + suggest.calculator = true; + update2.engineAliasRefresh = true; + unitConversion.enabled = true; + trending.featureGate = false; + }; - newtabpage.activity-stream = { - feeds = { - topsites = false; - section.topstories = false; + search = { + separatePrivateDefault.ui.enabled = true; + suggest.enabled = false; + }; + + newtabpage.activity-stream = { + feeds = { + topsites = false; + section.topstories = false; + telemetry = false; + }; + asrouter.userprefs.cfr = { + addons = false; + features = false; + }; telemetry = false; }; - asrouter.userprefs.cfr = { - addons = false; - features = false; + + privatebrowsing = { + vpnpromourl = ""; + forceMediaMemoryCache = true; }; - telemetry = false; - }; - privatebrowsing = { - vpnpromourl = ""; - forceMediaMemoryCache = true; - }; + display = { + focus_ring_on_anything = true; + focus_ring_style = 0; + focus_ring_width = 0; + }; - display = { - focus_ring_on_anything = true; - focus_ring_style = 0; - focus_ring_width = 0; + cache.jsbc_compression_level = 3; + helperApps.deleteTempFileOnExit = true; + uitour.enabled = false; + sessionstore.interval = 60000; + formfill.enable = false; + xul.error_pages.expert_bad_cert = true; + contentblocking.category = "strict"; + ping-centre.telemetry = false; + discovery.enabled = false; + shell.checkDefaultBrowser = false; + preferences.moreFromMozilla = false; + tabs.tabmanager.enabled = false; + aboutConfig.showWarning = false; + aboutwelcome.enabled = false; + bookmarks.openInTabClosesMenu = false; + menu.showViewImageInfo = true; + compactmode.show = true; + safebrowsing.downloads.remote.enabled = false; + tabs.crashReporting.sendReport = false; + crashReports.unsubmittedCheck.autoSubmit2 = false; + privateWindowSeparation.enabled = false; }; - cache.jsbc_compression_level = 3; - helperApps.deleteTempFileOnExit = true; - uitour.enabled = false; - sessionstore.interval = 60000; - formfill.enable = false; - xul.error_pages.expert_bad_cert = true; - contentblocking.category = "strict"; - ping-centre.telemetry = false; - discovery.enabled = false; - shell.checkDefaultBrowser = false; - preferences.moreFromMozilla = false; - tabs.tabmanager.enabled = false; - aboutConfig.showWarning = false; - aboutwelcome.enabled = false; - bookmarks.openInTabClosesMenu = false; - menu.showViewImageInfo = true; - compactmode.show = true; - safebrowsing.downloads.remote.enabled = false; - tabs.crashReporting.sendReport = false; - crashReports.unsubmittedCheck.autoSubmit2 = false; - privateWindowSeparation.enabled = false; - }; - - security = { - mixed_content = { - block_display_content = true; - upgrade_display_content = true; - }; - insecure_connection_text = { - enabled = true; - pbmode.enabled = true; + security = { + mixed_content = { + block_display_content = true; + upgrade_display_content = true; + }; + insecure_connection_text = { + enabled = true; + pbmode.enabled = true; + }; + OCSP.enabled = 0; + remote_settings.crlite_filters.enabled = true; + pki.crlite_mode = 2; + ssl.treat_unsafe_negotiation_as_broken = true; + tls.enable_0rtt_data = false; }; - OCSP.enabled = 0; - remote_settings.crlite_filters.enabled = true; - pki.crlite_mode = 2; - ssl.treat_unsafe_negotiation_as_broken = true; - tls.enable_0rtt_data = false; - }; - toolkit = { - telemetry = { - unified = false; - enabled = false; - server = "data:,"; - archive.enabled = false; - newProfilePing.enabled = false; - shutdownPingSender.enabled = false; - updatePing.enabled = false; - bhrPing.enabled = false; - firstShutdownPing.enabled = false; - coverage.opt-out = true; - }; - coverage = { - opt-out = true; - endpoint.base = ""; + toolkit = { + telemetry = { + unified = false; + enabled = false; + server = "data:,"; + archive.enabled = false; + newProfilePing.enabled = false; + shutdownPingSender.enabled = false; + updatePing.enabled = false; + bhrPing.enabled = false; + firstShutdownPing.enabled = false; + coverage.opt-out = true; + }; + coverage = { + opt-out = true; + endpoint.base = ""; + }; + legacyUserProfileCustomizations.stylesheets = true; }; - legacyUserProfileCustomizations.stylesheets = true; - }; - dom = { - security = { - https_first = true; - https_first_schemeless = true; - sanitizer.enabled = true; + dom = { + security = { + https_first = true; + https_first_schemeless = true; + sanitizer.enabled = true; + }; + enable_web_task_scheduling = true; }; - enable_web_task_scheduling = true; - }; - layout = { - css = { - grid-template-masonry-value.enabled = true; - has-selector.enabled = true; - prefers-color-scheme.content-override = 2; + layout = { + css = { + grid-template-masonry-value.enabled = true; + has-selector.enabled = true; + prefers-color-scheme.content-override = 2; + }; + word_select.eat_space_to_next_word = false; }; - word_select.eat_space_to_next_word = false; - }; - urlclassifier = { - trackingSkipURLs = "*.reddit.com, *.twitter.com, *.twimg.com, *.tiktok.com"; - features.socialtracking.skipURLs = "*.instagram.com, *.twitter.com, *.twimg.com"; - }; + urlclassifier = { + trackingSkipURLs = "*.reddit.com, *.twitter.com, *.twimg.com, *.tiktok.com"; + features.socialtracking.skipURLs = "*.instagram.com, *.twitter.com, *.twimg.com"; + }; - privacy = { - globalprivacycontrol.enabled = true; - history.custom = true; - userContext.ui.enabled = true; - }; + privacy = { + globalprivacycontrol.enabled = true; + history.custom = true; + userContext.ui.enabled = true; + trackingprotection = { + enabled = true; + pbmode.enabled = true; + socialtracking.enabled = true; + }; + }; - full-screen-api = { - transition-duration = { - enter = "0 0"; - leave = "0 0"; + full-screen-api = { + transition-duration = { + enter = "0 0"; + leave = "0 0"; + }; + warning = { + delay = -1; + timeout = 0; + }; }; - warning = { - delay = -1; - timeout = 0; + + permissions.default = { + desktop-notification = 2; + geo = 2; }; - }; - permissions.default = { - desktop-notification = 2; - geo = 2; - }; + signon = { + formlessCapture.enabled = false; + privateBrowsingCapture.enabled = false; + }; - signon = { - formlessCapture.enabled = false; - privateBrowsingCapture.enabled = false; - }; + datareporting = { + policy.dataSubmissionEnabled = false; + healthreport.uploadEnabled = false; + }; - datareporting = { - policy.dataSubmissionEnabled = false; - healthreport.uploadEnabled = false; - }; + extensions = { + pocket.enabled = false; + getAddons.showPane = false; + htmlaboutaddons.recommendations.enabled = false; + postDownloadThirdPartyPrompt = false; + }; - extensions = { - pocket.enabled = false; - getAddons.showPane = false; - htmlaboutaddons.recommendations.enabled = false; - postDownloadThirdPartyPrompt = false; - }; + app = { + shield.optoutstudies.enabled = false; + normandy.enabled = false; + normandy.api_url = ""; + }; - app = { - shield.optoutstudies.enabled = false; - normandy.enabled = false; - normandy.api_url = ""; + image.mem.decode_bytes_at_a_time = 32768; + editor.truncate_user_pastes = false; + pdfjs.enableScripting = false; + geo.provider.network.url = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"; + permissions.manager.defaultsUrl = ""; + webchannel.allowObject.urlWhitelist = ""; + breakpad.reportURL = ""; + captivedetect.canonicalURL = ""; + cookiebanners.service.mode = 1; + findbar.highlightAll = true; + content.notify.interval = 100000; }; - - image.mem.decode_bytes_at_a_time = 32768; - editor.truncate_user_pastes = false; - pdfjs.enableScripting = false; - geo.provider.network.url = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"; - permissions.manager.defaultsUrl = ""; - webchannel.allowObject.urlWhitelist = ""; - breakpad.reportURL = ""; - captivedetect.canonicalURL = ""; - cookiebanners.service.mode = 1; - findbar.highlightAll = true; - content.notify.interval = 100000; }; }; }; - }; -} + } #+end_src *** Fcitx This is a virtual keyboard program for writing in multiple languages. I use this sometimes. @@ -1415,94 +1420,95 @@ compilation, and because I can fetch their exact versions. Note that I have a st configuration here that tells emacs to load my real configuration at ~~/monorepo/config/emacs.org~ as an org file which gets automatically tangled to an emacs-lisp file. #+begin_src nix :tangle ../nix/modules/home/emacs.nix -{ lib, config, pkgs, ... }: -{ - programs.emacs = - { - enable = true; - package = pkgs.emacs29-pgtk; - extraConfig = '' - (setq debug-on-error t) - (org-babel-load-file - (expand-file-name "~/monorepo/config/emacs.org"))''; - extraPackages = epkgs: [ - epkgs.all-the-icons - epkgs.auctex - epkgs.catppuccin-theme - epkgs.chatgpt-shell - epkgs.company - epkgs.company-solidity - epkgs.counsel - epkgs.dashboard - epkgs.doom-modeline - epkgs.elfeed - epkgs.elfeed-org - epkgs.elfeed-tube - epkgs.elfeed-tube-mpv - epkgs.ellama - epkgs.elpher - epkgs.ement - epkgs.emmet-mode - epkgs.emms - epkgs.enwc - epkgs.evil - epkgs.evil-collection - epkgs.evil-commentary - epkgs.evil-org - epkgs.f - epkgs.flycheck - epkgs.general - epkgs.gptel - epkgs.gruvbox-theme - epkgs.htmlize - epkgs.irony-eldoc - epkgs.ivy - epkgs.ivy-pass - epkgs.latex-preview-pane - epkgs.lsp-ivy - epkgs.lsp-mode - epkgs.lyrics-fetcher - epkgs.magit - epkgs.magit-delta - epkgs.mu4e - epkgs.nix-mode - epkgs.org-fragtog - epkgs.org-journal - epkgs.org-roam - epkgs.org-roam-ui - epkgs.org-superstar - epkgs.page-break-lines - epkgs.password-store - epkgs.pdf-tools - epkgs.pinentry - epkgs.platformio-mode - epkgs.projectile - epkgs.rustic - epkgs.scad-mode - epkgs.simple-httpd - epkgs.solidity-flycheck - epkgs.solidity-mode - epkgs.sudo-edit - epkgs.treemacs - epkgs.treemacs-evil - epkgs.treemacs-magit - epkgs.treemacs-projectile - epkgs.treesit-auto - epkgs.typescript-mode - epkgs.unicode-fonts - epkgs.use-package - epkgs.vterm - epkgs.web-mode - epkgs.websocket - epkgs.which-key - epkgs.writegood-mode - epkgs.writeroom-mode - epkgs.yaml-mode - epkgs.yasnippet - epkgs.yasnippet-snippets - ]; - }; -} + { lib, config, pkgs, ... }: + { + programs.emacs = + { + enable = true; + package = pkgs.emacs29-pgtk; + extraConfig = '' + (setq debug-on-error t) + (org-babel-load-file + (expand-file-name "~/monorepo/config/emacs.org"))''; + extraPackages = epkgs: [ + epkgs.all-the-icons + epkgs.auctex + epkgs.catppuccin-theme + epkgs.chatgpt-shell + epkgs.company + epkgs.company-solidity + epkgs.counsel + epkgs.dashboard + epkgs.doom-modeline + epkgs.elfeed + epkgs.elfeed-org + epkgs.elfeed-tube + epkgs.elfeed-tube-mpv + epkgs.ellama + epkgs.elpher + epkgs.ement + epkgs.emmet-mode + epkgs.emms + epkgs.enwc + epkgs.evil + epkgs.evil-collection + epkgs.evil-commentary + epkgs.evil-org + epkgs.f + epkgs.flycheck + epkgs.general + epkgs.gptel + epkgs.gruvbox-theme + epkgs.htmlize + epkgs.irony-eldoc + epkgs.ivy + epkgs.ivy-pass + epkgs.kiwix + epkgs.latex-preview-pane + epkgs.lsp-ivy + epkgs.lsp-mode + epkgs.lyrics-fetcher + epkgs.magit + epkgs.magit-delta + epkgs.mu4e + epkgs.nix-mode + epkgs.org-fragtog + epkgs.org-journal + epkgs.org-roam + epkgs.org-roam-ui + epkgs.org-superstar + epkgs.page-break-lines + epkgs.password-store + epkgs.pdf-tools + epkgs.pinentry + epkgs.platformio-mode + epkgs.projectile + epkgs.rustic + epkgs.scad-mode + epkgs.simple-httpd + epkgs.solidity-flycheck + epkgs.solidity-mode + epkgs.sudo-edit + epkgs.treemacs + epkgs.treemacs-evil + epkgs.treemacs-magit + epkgs.treemacs-projectile + epkgs.treesit-auto + epkgs.typescript-mode + epkgs.unicode-fonts + epkgs.use-package + epkgs.vterm + epkgs.web-mode + epkgs.websocket + epkgs.which-key + epkgs.writegood-mode + epkgs.writeroom-mode + epkgs.yaml-mode + epkgs.yasnippet + epkgs.yasnippet-snippets + ]; + }; + } #+end_src *** Gammastep This is a program like redshift for making your screen emit more red and less blue light. Here @@ -2459,92 +2465,94 @@ This configuration is the backbone configuration for the default user. It specif generally useful packages and something every home should have, as well as some dependencies for these configurations. #+begin_src nix :tangle ../nix/modules/home/user.nix -{ lib, config, pkgs, ... }: -{ - home = { - activation.startup-files = lib.hm.dag.entryAfter [ "installPackages" ] '' - if [ ! -d "/home/${config.monorepo.vars.userName}/email/ret2pop/" ]; then - mkdir -p /home/${config.monorepo.vars.userName}/email/ret2pop/ - fi - if [ ! -d "/home/${config.monorepo.vars.userName}/music" ]; then - mkdir -p /home/${config.monorepo.vars.userName}/music - fi - if [ ! -d /home/${config.monorepo.vars.userName}/org ]; then - mkdir -p /home/${config.monorepo.vars.userName}/org - fi - touch /home/${config.monorepo.vars.userName}/org/agenda.org - touch /home/${config.monorepo.vars.userName}/org/notes.org - ''; - - enableNixpkgsReleaseCheck = false; - username = config.monorepo.vars.userName; - homeDirectory = "/home/${config.monorepo.vars.userName}"; - stateVersion = "24.11"; - - packages = with pkgs; [ - # passwords - age sops - - # formatting - ghostscript texliveFull pandoc - - # Emacs Deps - graphviz jq - - # Apps - octaveFull vesktop grim swww vim + { lib, config, pkgs, ... }: + { + home = { + activation.startup-files = lib.hm.dag.entryAfter [ "installPackages" ] '' + if [ ! -d "/home/${config.monorepo.vars.userName}/email/ret2pop/" ]; then + mkdir -p /home/${config.monorepo.vars.userName}/email/ret2pop/ + fi + if [ ! -d "/home/${config.monorepo.vars.userName}/music" ]; then + mkdir -p /home/${config.monorepo.vars.userName}/music + fi + if [ ! -d /home/${config.monorepo.vars.userName}/org ]; then + mkdir -p /home/${config.monorepo.vars.userName}/org + fi + touch /home/${config.monorepo.vars.userName}/org/agenda.org + touch /home/${config.monorepo.vars.userName}/org/notes.org + ''; - # Sound/media - pavucontrol alsa-utils imagemagick ffmpeg helvum + enableNixpkgsReleaseCheck = false; + username = config.monorepo.vars.userName; + homeDirectory = "/home/${config.monorepo.vars.userName}"; + stateVersion = "24.11"; - # Net - curl rsync git + packages = with pkgs; [ + # wikipedia + kiwix kiwix-tools + # passwords + age sops + + # formatting + ghostscript texliveFull pandoc + + # Emacs Deps + graphviz jq + + # Apps + octaveFull vesktop grim swww vim + + # Sound/media + pavucontrol alsa-utils imagemagick ffmpeg helvum + + # Net + curl rsync git + + # Tor + torsocks tor-browser + + # fonts + 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" ]; }) + + # Misc. + pinentry + x11_ssh_askpass + xdg-utils + acpilight + pfetch + libnotify + ]; + }; - # Tor - torsocks tor-browser + services = { + gpg-agent = { + pinentryPackage = pkgs.pinentry-emacs; + enable = true; + extraConfig = '' + allow-emacs-pinentry + allow-loopback-pinentry + ''; + }; + }; - # fonts - 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" ]; }) + programs.bash.enable = true; - # Misc. - pinentry - x11_ssh_askpass - xdg-utils - acpilight - pfetch - libnotify - ]; - }; - - services = { - gpg-agent = { - pinentryPackage = pkgs.pinentry-emacs; + gtk = { enable = true; - extraConfig = '' - allow-emacs-pinentry - allow-loopback-pinentry - ''; + theme = null; + iconTheme = null; }; - }; - - programs.bash.enable = true; - - gtk = { - enable = true; - theme = null; - iconTheme = null; - }; - fonts.fontconfig.enable = true; - nixpkgs.config.cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; -} + fonts.fontconfig.enable = true; + nixpkgs.config.cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; + } #+end_src * Systems ** Continuity @@ -2590,66 +2598,66 @@ work deterministically. *** ISO Default Profile This contains the installation script I use to install my systems. #+begin_src nix :tangle ../nix/systems/installer/default.nix -{ pkgs, config, ... }: -let - commits = import ./commits.nix; -in -{ - networking = { - hostName = "nixos"; - networkmanager = { - enable = true; - }; - firewall = { - allowedTCPPorts = [ ]; - allowedUDPPorts = [ ]; + { pkgs, config, ... }: + let + commits = import ./commits.nix; + in + { + networking = { + hostName = "nixos"; + networkmanager = { + enable = true; + }; + firewall = { + allowedTCPPorts = [ ]; + allowedUDPPorts = [ ]; + }; + wireless.enable = false; }; - wireless.enable = false; - }; - users.extraUsers.root.password = "nixos"; - users.extraUsers.nixos.password = "nixos"; - users.users = { - nixos = { - packages = with pkgs; [ - git - curl - gum - (writeShellScriptBin "nix_installer" - '' -#!/usr/bin/env bash - -set -euo pipefail -if [ "$(id -u)" -eq 0 ]; then - echo "ERROR! $(basename "$0") should be run as a regular user" - exit 1 -fi -ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installation..." || nmtui -cd -if [ ! -d "$HOME/monorepo/" ]; then - git clone --recurse-submodules https://git.nullring.xyz/monorepo.git - cd monorepo - git checkout "${commits.monorepoCommitHash}" -fi -vim "$HOME/monorepo/nix/systems/continuity/default.nix" -sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/modules/sda-simple.nix" -cd /mnt -sudo nixos-install --flake $HOME/monorepo/nix#continuity -sudo cp -r $HOME/monorepo "/mnt/home/$(ls /mnt/home/)/" -echo "rebooting..."; sleep 3; reboot -'') - ]; + users.extraUsers.root.password = "nixos"; + users.extraUsers.nixos.password = "nixos"; + users.users = { + nixos = { + packages = with pkgs; [ + git + curl + gum + (writeShellScriptBin "nix_installer" + '' + #!/usr/bin/env bash + + set -euo pipefail + if [ "$(id -u)" -eq 0 ]; then + echo "ERROR! $(basename "$0") should be run as a regular user" + exit 1 + fi + ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installation..." || nmtui + cd + if [ ! -d "$HOME/monorepo/" ]; then + git clone --recurse-submodules https://git.nullring.xyz/monorepo.git + cd monorepo + git checkout "${commits.monorepoCommitHash}" + fi + vim "$HOME/monorepo/nix/systems/continuity/default.nix" + sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/modules/sda-simple.nix" + cd /mnt + sudo nixos-install --flake $HOME/monorepo/nix#continuity + sudo cp -r $HOME/monorepo "/mnt/home/$(ls /mnt/home/)/" + echo "rebooting..."; sleep 3; reboot + '') + ]; + }; }; - }; - systemd = { - services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; - targets = { - sleep.enable = false; - suspend.enable = false; - hibernate.enable = false; - hybrid-sleep.enable = false; + systemd = { + services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; + targets = { + sleep.enable = false; + suspend.enable = false; + hibernate.enable = false; + hybrid-sleep.enable = false; + }; }; - }; -} + } #+end_src -- cgit