Skip to content

Commit c34f93a

Browse files
committed
feat: nixify
1 parent 6ed2d44 commit c34f93a

File tree

7 files changed

+198
-220
lines changed

7 files changed

+198
-220
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
result
2+
result-*

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Liassica
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+19-219
Original file line numberDiff line numberDiff line change
@@ -1,230 +1,30 @@
1-
GRUB2 Live ISO Multiboot
2-
========================
1+
# glim-flake
32

4-
https://github.com/thias/glim | http://glee.thias.es/GLIM
3+
A flake for [glim](https://github.com/thias/glim) with a couple of customizations.
54

5+
## Overview
66

7-
Overview
8-
--------
7+
I've Nixified the upstream glim script, so it should work out of the box on systems with Nix. I've also added a few customizations like enabling Secure Boot support and switching the default theme out for [Catppuccin Frappe](https://github.com/catppuccin/grub).
98

10-
GLIM is a set of grub configuration files to turn a simple VFAT formatted USB
11-
memory stick with many GNU/Linux distribution ISO images into a neat device
12-
from which many different Live environments can be used.
9+
## Installation
1310

14-
Advantages over extracting files or using special Live USB creation tools :
11+
Follow the upstream instructions for setting up your USB device.
1512

16-
* A single USB memory can hold all Live environments (the limit is its size)
17-
* ISO images stay available to burn real CDs or DVDs
18-
* ISO images are quick to manipulate (vs. hundreds+ files)
13+
Then, install glim to your USB by running `nix run github:Liassica/glim-flake`. You can override the theme by adding this repo as a flake input and overriding the 'theme' input.
1914

20-
Disadvantages :
15+
E.g, to use the Breeze GRUB theme:
2116

22-
* There is no persistence overlay for distributions which normally support it
23-
* Setting up isn't as easy as a simple cat from the ISO image to a block device
24-
25-
My experience has been that the safest filesystem to use is FAT32
26-
(surprisingly!), though it will mean that ISO images greater than 4GB won't be
27-
supported. Other filesystems supported by GRUB2 also work, such as ext3/ext4,
28-
NTFS and exFAT, but the boot of the distributions must also support it, which
29-
isn't the case for many with NTFS (Ubuntu does, Fedora doesn't) and exFAT
30-
(Ubuntu doesn't, Fedora does). So FAT32 stays the safe bet.
31-
32-
33-
Screenshots
34-
-----------
35-
36-
![Main Menu](https://github.com/thias/glim/raw/master/screenshots/GLIM-3.0-shot1.png)
37-
![Ubuntu Submenu](https://github.com/thias/glim/raw/master/screenshots/GLIM-3.0-shot2.png)
38-
39-
40-
Installation
41-
------------
42-
43-
Once you have your USB memory with a single partition formatted as FAT32 with
44-
the filesystem label 'GLIM', mount it, clone this git repository and just run
45-
(as a normal user) :
46-
47-
./glim.sh
48-
49-
Once finished, you may change the filesystem label to anything you like.
50-
51-
The supported `boot/iso/` sub-directories (in alphabetical order) are :
52-
53-
[//]: # (distro-list-start)
54-
55-
* [`almalinux`](https://almalinux.org/) - _Live Media only_
56-
* [`antix`](https://antixlinux.com/)
57-
* [`arch`](https://archlinux.org/)
58-
* [`artix`](https://artixlinux.org/)
59-
* [`bodhi`](https://www.bodhilinux.com/)
60-
* [`calculate`](https://wiki.calculate-linux.org/desktop)
61-
* ~~[`centos`](https://www.centos.org/)~~ - _Live was discontinued_
62-
* [`clonezilla`](https://clonezilla.org/)
63-
* [`debian`](https://www.debian.org/CD/live/) - _live & `mini.iso`_
64-
* [`elementary`](https://elementary.io/)
65-
* [`fedora`](https://fedoraproject.org/)
66-
* [`finnix`](https://www.finnix.org/)
67-
* [`gentoo`](https://www.gentoo.org/)
68-
* [`gparted`](https://gparted.org/)
69-
* [`grml`](https://grml.org/)
70-
* [`ipxe`](https://ipxe.org/) - _.iso or .efi_
71-
* [`kali`](https://www.kali.org/)
72-
* [`kubuntu`](https://kubuntu.org/)
73-
* [`libreelec`](https://libreelec.tv/)
74-
* [`linuxmint`](https://linuxmint.com/)
75-
* [`lubuntu`](https://lubuntu.me/)
76-
* [`manjaro`](https://manjaro.org/)
77-
* [`memtest`](https://memtest.org/) - _Only .bin/.efi, not .iso_
78-
* [`mxlinux`](https://mxlinux.org/)
79-
* [`netrunner`](https://www.netrunner.com/)
80-
* [`openbsd`](https://www.openbsd.org/)
81-
* [`opensuse`](https://www.opensuse.org/) - _Live from Alternative Downloads only_
82-
* [`peppermint`](https://peppermintos.com/)
83-
* [`popos`](https://pop.system76.com/)
84-
* [`porteus`](http://www.porteus.org/)
85-
* [`rhel`](https://www.redhat.com/rhel) - _Installation only_
86-
* [`rockylinux`](https://rockylinux.org/)
87-
* [`slitaz`](https://slitaz.org/)
88-
* [`supergrub2disk`](https://www.supergrubdisk.org/)
89-
* [`systemrescue`](https://www.system-rescue.org/)
90-
* [`tails`](https://tails.net/)
91-
* [`ubuntubudgie`](https://ubuntubudgie.org/)
92-
* [`ubuntu`](https://ubuntu.com/)
93-
* [`void`](https://voidlinux.org/)
94-
* [`xubuntu`](https://xubuntu.org/)
95-
* [`zorinos`](https://zorin.com/os/)
96-
97-
[//]: # (distro-list-end)
98-
99-
Any unpopulated directory will have the matching boot menu entry automatically
100-
disabled, so to skip any distribution, just don't copy any files into it.
101-
102-
Download the right ISO image(s) to the matching directory. If you require
103-
boot parameter tweaks, edit the appropriate `boot/grub2/inc-*.cfg` file.
104-
105-
Items order in the menu
106-
------------
107-
108-
Menu items for a distro are ordered by modification time of the iso files
109-
starting from the most recent ones. If some iso files have the same mtime, their
110-
menu items are ordered alphabetically.
111-
112-
Here is a generic idea how to keep it nicely ordered when you have multiple
113-
releases of some distro:
114-
115-
- touch your **release** iso files with the release date
116-
- touch your **point release** iso files with the original release date plus a
117-
day per point. This is a way to ensure point releases never pop above the next
118-
release like Debian 10.13.0 (released 10 Sep 2022) would still be below Debian
119-
11.0.0 (released 14 August 2021)
120-
- in case there are multiple flavours of some iso but the version is the same,
121-
touch all of them with the same date for the whole group to be ordered
122-
alphabetically
123-
124-
Sample ordered menu:
125-
126-
| | iso mtime |
127-
|------------------------------------|-------------------------|
128-
| Debian Live 12.0.0 amd64 standard | 10 June 2023 |
129-
| Debian Live 11.7.0 amd64 gnome | 14 August 2021 + 7 days |
130-
| Debian Live 11.7.0 amd64 kde | 14 August 2021 + 7 days |
131-
| Debian Live 11.7.0 amd64 standard | 14 August 2021 + 7 days |
132-
| Debian Live 11.0.0 amd64 gnome | 14 August 2021 |
133-
| Debian Live 11.0.0 amd64 kde | 14 August 2021 |
134-
| Debian Live 11.0.0 amd64 standard | 14 August 2021 |
135-
| Debian Live 10.13.0 amd64 standard | 6 July 2019 + 13 days |
136-
| Debian Live 9.13.0 amd64 standard | 17 June 2017 + 13 days |
137-
138-
Special Cases
139-
-------------
140-
141-
### iPXE
142-
143-
The `.iso` files don't work when booting using EFI, you simply need to use
144-
`.efi` files instead.
145-
146-
### LibreELEC
147-
148-
LibreELEC isn't provided as ISO images, nor is it able to find the `KERNEL` and
149-
`SYSTEM` files it needs anywhere else than at the root of a filesystem.
150-
But it's useful to enable booting the installer by just copying both
151-
files to the root of the USB memory stick.
152-
Live booting is also supported, and the first launch will create a 512MB file
153-
as /STORAGE.
154-
155-
### Memtest86+
156-
157-
The `.iso` file doesn't work. Use either the `.bin` or the `.efi` depending on
158-
the boot mode used.
159-
160-
### Ubuntu
161-
162-
Recent Ubuntu desktop iso images bundle multiple versions on the Nvidia
163-
driver. With that, the images are over 4GB, the FAT32 max file size. For example
164-
`ubuntu-20.04.6-desktop-amd64.iso` is 4.1GB, `ubuntu-22.04.2-desktop-amd64.iso`
165-
is 4.6GB. The driver is not required in a live system, it can be removed to make
166-
an image fit into 4GB. For example, with 22.04.2 image in the current dir:
167-
168-
```
169-
mkdir slim
170-
iso=ubuntu-22.04.2-desktop-amd64.iso
171-
172-
xorriso -indev "$iso" -outdev slim/"$iso" \
173-
-boot_image any replay -rm_r /pool/restricted/{l,n} --
17+
```nix
18+
{ pkgs, glim, ...}:
19+
{
20+
environment.systemPackages = [
21+
glim.packages.x86_64-linux.glim.override {
22+
theme = "${pkgs.kdePackages.breeze-grub}/grub/themes/breeze";
23+
};
24+
];
25+
}
17426
```
17527

176-
Now you can copy `slim/ubuntu-22.04.2-desktop-amd64.iso` to your FAT32 formatted
177-
GLIM USB stick.
178-
179-
Some Ubuntu flavours also bundle the Nvidia driver (like Kubuntu), some don't
180-
(like Xubuntu). The same trick can be used with the former.
181-
182-
183-
Testing
184-
-------
185-
186-
With KVM it should "just work". The `/dev/sdx` device should be configured as
187-
an IDE or SATA disk (for some reason, as USB disk didn't work for me on Fedora
188-
17), that way you can easily and quickly test changes.
189-
Make sure you unmount the disk from the host OS before you start the KVM
190-
virtual machine that uses it.
191-
For UEFI testing, you'll need to use one of the `/usr/share/edk2/ovmf/*.fd`
192-
firmwares.
193-
194-
195-
Troubleshooting
196-
---------------
197-
198-
If you have any problem to boot, for instance stuck at the GRUB prompt before
199-
the menu, try re-installing.
200-
If you have other exotic GRUB errors, such as garbage text read instead of the
201-
configuration directives, try re-formatting your USB memory from scratch.
202-
I've seen weird things happen...
203-
204-
205-
Contributing
206-
------------
207-
208-
If you find GLIM useful but the configuration of the OS you require is missing
209-
or simply outdated, please feel free to contribute! What you will need is to
210-
create a GitHub pull request which includes :
211-
* All changes properly and fully tested.
212-
* New entries added similarly to the existing ones :
213-
* In alphabetical order.
214-
* With all possible variants supported (i.e. not just the one spin you want).
215-
* An original icon of high quality, and a shrunk 24x24 png version. Using
216-
`convert -size 24x24 -background 'rgba(0,0,0,0)' original.svg small.png`
217-
may work.
218-
* An updated supported directories list in this README file.
219-
220-
221-
---
222-
Copyleft 2012-2023 Matthias Saou http://matthias.saou.eu/
223-
224-
All configuration files included are public domain. Do what you want with them.
225-
The invader logo was made by me, so unless the exact shape is covered by
226-
copyright somewhere, do what you want with it.
227-
The background is "Wallpaper grey" © 2008 payalnic (DeviantArt)
228-
The `ascii.pf2` font comes from GRUB, which is GPLv3+ licensed. For more
229-
details as well as the source code, see http://www.gnu.org/software/grub/
28+
## License
23029

30+
MIT, with the exception of some theme files. See the upstream repository's license for details.

flake.lock

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
3+
4+
outputs =
5+
{ self, nixpkgs }:
6+
let
7+
system = "x86_64-linux";
8+
pkgs = nixpkgs.legacyPackages.${system};
9+
in
10+
{
11+
packages.${system} = {
12+
glim = pkgs.callPackage ./nix/package {
13+
theme = (pkgs.catppuccin-grub.override { flavor = "frappe"; }).outPath;
14+
};
15+
default = self.packages.${system}.glim;
16+
};
17+
};
18+
}

grub2/grub.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ terminal_output gfxterm
2020
loadfont unicode
2121

2222
insmod png
23-
set theme=${prefix}/themes/invader/theme.txt
23+
set theme=${prefix}/themes/theme/theme.txt
2424

2525
set isopath=/boot/iso
2626
probe --set rootuuid --fs-uuid $root

0 commit comments

Comments
 (0)