diff options
Diffstat (limited to 'nix/systems/installer')
-rw-r--r-- | nix/systems/installer/default.nix | 55 | ||||
-rw-r--r-- | nix/systems/installer/iso.nix | 174 |
2 files changed, 55 insertions, 174 deletions
diff --git a/nix/systems/installer/default.nix b/nix/systems/installer/default.nix new file mode 100644 index 0000000..62018a0 --- /dev/null +++ b/nix/systems/installer/default.nix @@ -0,0 +1,55 @@ +{ pkgs, config, ... }: +let + commits = ./commits.nix; +in +{ + imports = [ + ../../modules/default.nix + ]; + + monorepo.profiles.home.enable = false; + monorepo.vars.userName = "nixos"; + + users.extraUsers.root.password = "nixos"; + users.users = { + "${config.monorepo.vars.userName}" = { + packages = with pkgs; [ + 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/toughnix/" ]; then + git clone https://git.nullring.xyz/monorepo.git + cd monorepo + git checkout "${commits.monorepoCommitHash}" +fi +vim "$HOME/monorepo/nix/modules/default.nix" +vim "$HOME/monorepo/nix/modules/vars.nix" +sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/systems/desktop/sda-simple.nix" +cd /mnt +sudo nixos-install --flake $HOME/monorepo/nix#continuity +sudo cp $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; + }; + }; +} diff --git a/nix/systems/installer/iso.nix b/nix/systems/installer/iso.nix deleted file mode 100644 index 84b8560..0000000 --- a/nix/systems/installer/iso.nix +++ /dev/null @@ -1,174 +0,0 @@ -{ pkgs, lib, ... }: -let - commits = ./commits.nix; -in -{ - documentation = { - enable = true; - man.enable = true; - dev.enable = true; - }; - - environment = { - etc = { - securetty.text = '' - # /etc/securetty: list of terminals on which root is allowed to login. - # See securetty(5) and login(1). - ''; - }; - }; - - networking = { - hostName = "iso"; - wireless.enable = lib.mkForce false; - networkmanager = { - enable = true; - # wifi.macAddress = ""; - }; - firewall = { - allowedTCPPorts = [ ]; - allowedUDPPorts = [ ]; - }; - }; - - hardware = { - cpu.intel.updateMicrocode = true; - graphics = { - enable = true; - }; - pulseaudio.enable = false; - }; - - services = { - qemuGuest.enable = true; - chrony = { - enable = true; - enableNTS = true; - servers = [ "time.cloudflare.com" "ptbtime1.ptb.de" "ptbtime2.ptb.de" ]; - }; - - jitterentropy-rngd.enable = true; - resolved.dnssec = true; - dbus = { - apparmor = "enabled"; - }; - - pipewire = { - enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - pulse.enable = true; - jack.enable = true; - wireplumber.enable = true; - extraConfig.pipewire-pulse."92-low-latency" = { - "context.properties" = [ - { - name = "libpipewire-module-protocol-pulse"; - args = { }; - } - ]; - "pulse.properties" = { - "pulse.min.req" = "32/48000"; - "pulse.default.req" = "32/48000"; - "pulse.max.req" = "32/48000"; - "pulse.min.quantum" = "32/48000"; - "pulse.max.quantum" = "32/48000"; - }; - "stream.properties" = { - "node.latency" = "32/48000"; - "resample.quality" = 1; - }; - }; - }; - - openssh = { - enable = true; - settings = { - PasswordAuthentication = true; - AllowUsers = [ "nixos" ]; - PermitRootLogin = "yes"; - KbdInteractiveAuthentication = false; - }; - }; - }; - - programs = { - zsh.enable = true; - ssh.enableAskPassword = false; - }; - - nixpkgs.config = { - allowUnfree = true; - cudaSupport = false; - }; - - environment.systemPackages = with pkgs; [ - cryptsetup - restic - sbctl - linux-manual - man-pages - man-pages-posix - ]; - - users.extraUsers.root.password = "nixos"; - users.extraUsers.nixos.password = "nixos"; - users.users = { - nixos = { - isNormalUser = true; - description = "NixOS"; - extraGroups = [ "networkmanager" "wheel" "video" "docker" "jackaudio" "tss" "dialout" ]; - shell = pkgs.zsh; - 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/toughnix/" ]; then - git clone https://git.nullring.xyz/monorepo.git - cd monorepo - git checkout "${commits.monorepoCommitHash}" -fi -vim "$HOME/monorepo/nix/modules/default.nix" -vim "$HOME/monorepo/nix/modules/vars.nix" -sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/systems/desktop/sda-simple.nix" -cd /mnt -sudo nixos-install --flake $HOME/monorepo/nix#continuity -sudo cp $HOME/monorepo "/mnt/home/$(ls /mnt/home/)/" -echo "rebooting..."; sleep 3; reboot -'') - ]; - }; - }; - - - nix.settings.experimental-features = "nix-command flakes"; - time.timeZone = "America/Vancouver"; - i18n.defaultLocale = "en_CA.UTF-8"; - - systemd = { - services.sshd.wantedBy = pkgs.lib.mkForce ["multi-user.target"]; - targets = { - sleep.enable = false; - suspend.enable = false; - hibernate.enable = false; - hybrid-sleep.enable = false; - }; - }; - - system = { - stateVersion = "24.11"; - }; -} |