Rename directories for better organization
This commit is contained in:
parent
9d1bd2941f
commit
de8301ba4a
47 changed files with 52 additions and 52 deletions
72
installer/base.nix
Normal file
72
installer/base.nix
Normal 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
7
installer/graphical.nix
Normal 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
9
installer/minimal.nix
Normal 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;
|
||||
}
|
25
installer/template-configuration.nix
Normal file
25
installer/template-configuration.nix
Normal 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. It‘s 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?
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue