From c33674ce98a510da7266c386f8736642a0a7d6a5 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Fri, 10 Jan 2025 02:38:31 -0800 Subject: change docs and rename stuff --- README.org | 7 +++ flake.nix | 4 +- installer/iso.nix | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ live/iso.nix | 166 ------------------------------------------------------ 4 files changed, 175 insertions(+), 168 deletions(-) create mode 100644 installer/iso.nix delete mode 100644 live/iso.nix diff --git a/README.org b/README.org index f56ab87..d0e9a9e 100644 --- a/README.org +++ b/README.org @@ -158,3 +158,10 @@ Change my RSS feeds out in ~$HOME/org/website/config/elfeed.org~ with ones you w *** Website I update my website with the command ~usite~ (in the terminal). This will work by default if you set your ~vars.nix~ correctly and you have access to the server you're sshing through with rsync. +* Building the Installer +To build the installer, run this command in the flake: +#+begin_src bash + nix build .#nixosConfigurations.installer.config.system.build.isoImage +#+end_src +this will put the resultant ISO image in ~./results/iso/~. You can then flash it with ~dd~ or any +other method. diff --git a/flake.nix b/flake.nix index 86f1463..a4e1a04 100644 --- a/flake.nix +++ b/flake.nix @@ -28,13 +28,13 @@ outputs = { nixpkgs, home-manager, nur, disko, lanzaboote, ... }@attrs: { nixosConfigurations = { - live = nixpkgs.lib.nixosSystem { + installer = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ({pkgs, modulesPath, ...}: { imports = [(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")]; }) - ./live/iso.nix + ./installer/iso.nix ]; }; diff --git a/installer/iso.nix b/installer/iso.nix new file mode 100644 index 0000000..e06f175 --- /dev/null +++ b/installer/iso.nix @@ -0,0 +1,166 @@ +{ pkgs, lib, ... }: +{ + 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 +if [ ! -d "$HOME/toughnix/" ]; then + cd $HOME + git clone https://git.nullring.xyz/toughnix.git +fi +vim "$HOME/toughnix/desktop/vars.nix" +vim "$HOME/toughnix/desktop/sda-simple.nix" +sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount "$HOME/toughnix/disko/sda-simple.nix" +cd /mnt + +sudo nixos-install --flake $HOME/toughnix#continuity +'') + ]; + }; + }; + + + 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"; + }; +} diff --git a/live/iso.nix b/live/iso.nix deleted file mode 100644 index e06f175..0000000 --- a/live/iso.nix +++ /dev/null @@ -1,166 +0,0 @@ -{ pkgs, lib, ... }: -{ - 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 -if [ ! -d "$HOME/toughnix/" ]; then - cd $HOME - git clone https://git.nullring.xyz/toughnix.git -fi -vim "$HOME/toughnix/desktop/vars.nix" -vim "$HOME/toughnix/desktop/sda-simple.nix" -sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount "$HOME/toughnix/disko/sda-simple.nix" -cd /mnt - -sudo nixos-install --flake $HOME/toughnix#continuity -'') - ]; - }; - }; - - - 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"; - }; -} -- cgit