From 3ce077f92cb5259251b914ea04250d7af9a51e8a Mon Sep 17 00:00:00 2001 From: sinavir Date: Thu, 17 Oct 2024 12:56:29 +0200 Subject: [PATCH] chore(iso): Remove as it is broken Several stuff are broken in the generation of the iso: - Impure (using nixpkgs in user nix_path) - Using a software which is just a wrpper around nixpkgs - Raid stuff is kinda broken (depend on the version of nixpkgs you use, going back to impurity stated above) --- iso/build-iso.sh | 5 -- iso/configuration.nix | 38 --------- iso/dgn-install/README.md | 1 - iso/dgn-install/default.nix | 20 ----- iso/dgn-install/dgn-install.sh | 149 --------------------------------- iso/nixpkgs.nix | 9 -- 6 files changed, 222 deletions(-) delete mode 100755 iso/build-iso.sh delete mode 100644 iso/configuration.nix delete mode 100644 iso/dgn-install/README.md delete mode 100644 iso/dgn-install/default.nix delete mode 100644 iso/dgn-install/dgn-install.sh delete mode 100644 iso/nixpkgs.nix diff --git a/iso/build-iso.sh b/iso/build-iso.sh deleted file mode 100755 index a210aad..0000000 --- a/iso/build-iso.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -NIXPKGS=$(nix-build --no-out-link nixpkgs.nix) - -nixos-generate -c configuration.nix -I NIX_PATH="$NIXPKGS" -f install-iso diff --git a/iso/configuration.nix b/iso/configuration.nix deleted file mode 100644 index e7cabf8..0000000 --- a/iso/configuration.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib, pkgs, ... }: - -let - dgn-keys = import ../keys; - - dgn-members = (import ../meta lib).organization.groups.root; -in - -{ - imports = [ ./dgn-install ]; - - boot = { - blacklistedKernelModules = [ "snd_pcsp" ]; - kernelPackages = pkgs.linuxPackages_latest; - tmp.cleanOnBoot = true; - - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - - supportedFilesystems = [ - "exfat" - "zfs" - "bcachefs" - ]; - - swraid.enable = lib.mkForce false; - }; - - console.keyMap = "fr"; - - services = { - openssh.enable = true; - }; - - users.users.root.openssh.authorizedKeys.keys = dgn-keys.getKeys dgn-members; -} diff --git a/iso/dgn-install/README.md b/iso/dgn-install/README.md deleted file mode 100644 index 32f2f2f..0000000 --- a/iso/dgn-install/README.md +++ /dev/null @@ -1 +0,0 @@ -Script pour installer automatiquement NixOS sur les machines de la DGNum diff --git a/iso/dgn-install/default.nix b/iso/dgn-install/default.nix deleted file mode 100644 index 3028540..0000000 --- a/iso/dgn-install/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, ... }: - -let - installScript = pkgs.writeShellApplication { - name = "dgn-install"; - - runtimeInputs = with pkgs; [ - coreutils - gnused - nixos-install-tools - zfs - ]; - - text = builtins.readFile ./dgn-install.sh; - }; -in - -{ - environment.systemPackages = [ installScript ]; -} diff --git a/iso/dgn-install/dgn-install.sh b/iso/dgn-install/dgn-install.sh deleted file mode 100644 index ae7d179..0000000 --- a/iso/dgn-install/dgn-install.sh +++ /dev/null @@ -1,149 +0,0 @@ -bootDevice= -rootDevice= - -domain="par01.infra.dgnum.eu" -hostname="dgn0x" - -hasZFS= - -while [ "$#" -gt 0 ]; do - i="$1" - shift 1 - case "$i" in - --root) - rootDevice="$1" - shift 1 - ;; - --boot) - bootDevice="$1" - shift 1 - ;; - --swap) - swapDevice="$1" - shift 1 - ;; - --domain) - domain="$1" - shift 1 - ;; - --hostname) - hostname="$1" - shift 1 - ;; - --with-zfs) - hasZFS="1" - ;; - *) - echo "$0: unknown option \`$i'" - exit 1 - ;; - esac -done - -if [ -z "$bootDevice" ]; then - echo "Missing boot partition" - exit 1 -fi - -if [ -z "$rootDevice" ]; then - echo "Missing root partition" - exit 1 -fi - -# Mount the partitions to where they should be -mount "$rootDevice" /mnt -mkdir /mnt/boot - -mount "$bootDevice" /mnt/boot - -if [ -n "$swapDevice" ]; then - swapon "$swapDevice" -fi - -# Generate configration -nixos-generate-config --root /mnt - -NIX="/mnt/etc/nixos/" - -# Setup our own files -mv $NIX/configuration.nix $NIX/base-configuration.nix - -cat < $NIX/dgnum-server.nix -{ ... }: { - services.nscd.enableNsncd = false; - programs.bash.promptInit = '' - # Provide a nice prompt if the terminal supports it. - if [ "\$TERM" != "dumb" ] || [ -n "\$INSIDE_EMACS" ]; then - PROMPT_COLOR="1;31m" - ((UID)) && PROMPT_COLOR="1;32m" - if [ -n "\$INSIDE_EMACS" ] || [ "\$TERM" = "eterm" ] || [ "\$TERM" = "eterm-color" ]; then - # Emacs term mode doesn't support xterm title escape sequence (\e]0;) - PS1="\n\[\033[\$PROMPT_COLOR\][\u@\$(hostname -f):\w]\\\$\[\033[0m\] " - else - PS1="\n\[\033[\$PROMPT_COLOR\][\[\e]0;\u@\H: \w\a\]\u@\$(hostname -f):\w]\\\$\[\033[0m\] " - fi - if test "\$TERM" = "xterm"; then - PS1="\[\033]2;\$(hostname -f):\u:\w\007\]\$PS1" - fi - fi - ''; -} -EOF - -cat < $NIX/configuration.nix -{ pkgs, ... }: { - imports = [ - ./base-configuration.nix - ./dgnum-server.nix - $(if [ -n "$hasZFS" ]; then echo './zfs.nix'; fi) - ]; - - boot.tmp.cleanOnBoot = true; - - console.keyMap = "fr"; - - time.timeZone = "Europe/Paris"; - - environment.systemPackages = with pkgs; [ - vim - wget - kitty.terminfo - ]; - - networking = { - hostName = "$hostname"; - domain = "$domain"; - }; - - # Activate SSH and set the keys - services.openssh = { - enable = true; - - settings.PasswordAuthentication = false; - }; - - users.users.root.openssh.authorizedKeys.keyFiles = [ ./rootKeys ]; -} -EOF - -if [ -n "$hasZFS" ]; then - cat < $NIX/zfs.nix -{ ... }: { - boot = { - supportedFilesystems = [ "zfs" ]; - zfs.forceImportRoot = false; - zfs.extraPools = [ - $(zpool list -Ho name | sed 's/^/"/;s/$/"/') - ]; - }; - - networking.hostId = "$(head -c4 /dev/urandom | od -A none -t x4 | sed 's/ //')"; -} -EOF -fi - -# Copy the keys -cp /etc/ssh/authorized_keys.d/root $NIX/rootKeys - -# Perform the installation -nixos-install diff --git a/iso/nixpkgs.nix b/iso/nixpkgs.nix deleted file mode 100644 index c859113..0000000 --- a/iso/nixpkgs.nix +++ /dev/null @@ -1,9 +0,0 @@ -let - version = (import ../meta/nixpkgs.nix).default; - nixpkgs = (import ../npins)."nixos-${version}"; -in - -(import nixpkgs { }).srcOnly { - name = "nixpkgs-for-iso"; - src = nixpkgs; -}