nix: basic installer image generator

This commit is contained in:
Primrose 2024-07-24 22:36:57 +02:00
parent d11b9486eb
commit b49def46ac
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
5 changed files with 130 additions and 3 deletions

View file

@ -1,9 +1,9 @@
{ self, ... }:
{ self, inputs, ... }:
{
flake.lib.mkNerdFont = ./mkNerdFont.nix;
perSystem =
{ pkgs, ... }:
{ pkgs, system, ... }:
let
inherit (pkgs) alt-ergo-pin;
mkNerdFont = pkgs.callPackage self.lib.mkNerdFont { };
@ -37,7 +37,21 @@
maeel = pkgs.callPackage ./maeel.nix { };
tokei = pkgs.callPackage ./tokei { }; # alpha tokei with typst, skel, hledger
posy-cursor = pkgs.callPackage ./posy-cursor.nix { };
carbon-installer = inputs.nixos-generators.nixosGenerate {
inherit system;
specialArgs = {
inherit pkgs;
hostname = "carbon";
};
format = "install-iso";
modules = [
self.nixosModules.layouts
{
environment.etc.flake-source.source = self;
environment.systemPackages = [ pkgs.disko ];
}
];
};
};
};
}

View file

@ -0,0 +1,70 @@
# Adapted from: https://github.com/nix-community/disko/blob/master/example/luks-lvm.nix
{
disko.devices = {
disk = {
main = {
type = "disk";
device = throw "Override me or change me";
content = {
type = "gpt";
partitions = {
ESP = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "defaults" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = [ ];
settings = {
# # if you want to use the key for interactive login be sure there is no trailing newline
# # for example use `echo -n "password" > /tmp/secret.key`
# keyFile = "/tmp/secret.key";
askPassword = true;
allowDiscards = true;
};
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "20G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [ "defaults" ];
};
};
home = {
size = "100%FREE";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/home";
};
};
};
};
};
};
}

1
nix/disko/default.nix Normal file
View file

@ -0,0 +1 @@
{ flake.diskoConfigurations.carbon = import ./carbon; }