Rename directories for better organization

This commit is contained in:
Vili Sinervä 2025-06-01 12:31:28 +03:00
parent 9d1bd2941f
commit de8301ba4a
Signed by: Vili Sinervä
SSH key fingerprint: SHA256:FladqYjaE4scJY3Hi+gnShZ6ygnTJgixy0I6BAoHyos
47 changed files with 52 additions and 52 deletions

72
installer/base.nix Normal file
View file

@ -0,0 +1,72 @@
{ pkgs, ... }:
let
create-partitions = pkgs.writeScriptBin "create-partitions" ''
if [[ $# -ne 3 ]]
then
echo "Usage: create-partitions <device prefix> <BOOT suffix> <root suffix>"
exit
fi
read -p "Erasing disk $1 -- Creating partition $1$2 as BOOT -- Creating partition $1$3 as root -- Are you sure? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
parted $1 -- mklabel gpt
parted $1 -- mkpart ESP fat32 1MB 512MB
parted $1 -- set 1 esp on
parted $1 -- mkpart root ext4 512MB 100%
fi
read -p "Setup root partition encryption?" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
cryptsetup luksFormat $1$3
if cryptsetup open $1$3 nixos
then
echo "Encrypted device accessible via /dev/mapper/nixos"
fi
fi
'';
create-filesystems = pkgs.writeScriptBin "create-filesystems" ''
if [[ $# -ne 2 ]]
then
echo "Usage: create-filesystems <BOOT partition> <root partition>"
exit
fi
mkfs.fat -F 32 -n BOOT $1
mkfs.ext4 -L nixos $2
'';
prep-install = pkgs.writeScriptBin "prep-install" ''
mkdir /mnt
mount /dev/disk/by-label/nixos /mnt
mkdir /mnt/boot
mount -o umask=077 /dev/disk/by-label/BOOT /mnt/boot
nixos-generate-config --root /mnt
mv /mnt/etc/nixos/configuration.nix configuration.nix.old
curl https://forgejo.sinerva.eu/VSinerva/nixos-conf/raw/branch/main/installer/template-configuration.nix -o /mnt/etc/nixos/configuration.nix
'';
in
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
../base.nix
];
environment.systemPackages =
(with pkgs; [
cryptsetup
])
++ [
create-partitions
create-filesystems
prep-install
];
isoImage.squashfsCompression = "gzip -Xcompression-level 1";
#Many installs will need this, and it won't hurt either way
services.qemuGuest.enable = true;
}

7
installer/graphical.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-combined.nix>
./base.nix
];
}

9
installer/minimal.nix Normal file
View file

@ -0,0 +1,9 @@
{ lib, ... }:
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
./base.nix
];
networking.networkmanager.enable = lib.mkForce false;
}

View file

@ -0,0 +1,25 @@
{ ... }:
let
host = "generic";
stateVersion = "25.05";
repo = builtins.fetchGit {
url = "https://forgejo.sinerva.eu/VSinerva/nixos-conf.git";
name = "nixos-conf-forgejo";
ref = "main";
};
in
{
imports = [
./hardware-configuration.nix
"${repo}/hosts/${host}.nix"
];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = stateVersion; # Did you read the comment?
}