@@ -1,89 +1,88 @@
# This module creates a bootable ISO image containing the given NixOS
# This module creates a bootable ISO image containing the given NixOS
# configuration. The derivation for the ISO image will be placed in
# configuration. The derivation for the ISO image will be placed in
# config.system.build.isoImage.
# config.system.build.isoImage.
{
{ config , lib , pkgs , . . . }:
config ,
lib ,
with lib ;
pkgs ,
. . .
let
}:
/* *
with lib ; let
* G i v e n a l i s t o f ` o p t i o n s ` , c o n c a t s t h e r e s u l t o f m a p p i n g e a c h o p t i o n s
/*
* t o a m e n u e n t r y f o r u s e i n g r u b .
*
*
* * d e f a u l t s : { n a m e , i m a g e , p a r a m s , i n i t r d }
* G i v e n a l i s t o f ` o p t i o n s ` , c o n c a t s t h e r e s u l t o f m a p p i n g e a c h o p t i o n s
* * o p t i o n s : [ o p t i o n . . . ]
* t o a m e n u e n t r y f o r u s e i n g r u b .
* * o p t i o n : { n a m e , p a r a m s , c l a s s }
*
*/
* * d e f a u l t s : { n a m e , i m a g e , p a r a m s , i n i t r d }
menuBuilderGrub2 =
* * o p t i o n s : [ o p t i o n . . . ]
defaults : options : lib . concatStrings
* * o p t i o n : { n a m e , p a r a m s , c l a s s }
*/
menuBuilderGrub2 = defaults : options :
lib . concatStrings
(
(
map
map
( option : ''
( option : ''
m e n u e n t r y ' ${ defaults . name } ${
m e n u e n t r y ' ${ defaults . name } ${
# Name appended to menuentry defaults to params if no specific name given.
# Name appended to menuentry defaults to params if no specific name given.
option . name or ( optionalString ( option ? params ) " ( ${ option . params } ) " )
option . name or ( optionalString ( option ? params ) " ( ${ option . params } ) " )
} ' ${ optionalString ( option ? class ) " - - c l a s s ${ option . class } " } {
} ' ${ optionalString ( option ? class ) " - - c l a s s ${ option . class } " } {
# F a l l b a c k t o U E F I c o n s o l e f o r b o o t , e f i f b s o m e t i m e s h a s d i f f i c u l t i e s .
# F a l l b a c k t o U E F I c o n s o l e f o r b o o t , e f i f b s o m e t i m e s h a s d i f f i c u l t i e s .
t e r m i n a l _ o u t p u t c o n s o l e
t e r m i n a l _ o u t p u t c o n s o l e
l i n u x ${ defaults . image } \ ''$ { i s o b o o t } ${ defaults . params } ${
l i n u x ${ defaults . image } \ ''$ { i s o b o o t } ${ defaults . params } ${
option . params or " "
option . params or " "
}
}
i n i t r d ${ defaults . initrd }
i n i t r d ${ defaults . initrd }
}
}
'' )
'' )
options
options
)
) ;
;
/* *
/*
* B u i l d s t h e d e f a u l t o p t i o n s .
*
*/
* B u i l d s t h e d e f a u l t o p t i o n s .
*/
buildMenuGrub2 = buildMenuAdditionalParamsGrub2 " " ;
buildMenuGrub2 = buildMenuAdditionalParamsGrub2 " " ;
targetArch =
targetArch =
if config . boot . loader . grub . forcei686 then
if config . boot . loader . grub . forcei686
" i a 3 2 "
then " i a 3 2 "
else
else pkgs . stdenv . hostPlatform . efiArch ;
pkgs . stdenv . hostPlatform . efiArch ;
/* *
/*
* G i v e n p a r a m s t o a d d t o ` p a r a m s ` , b u i l d a s e t o f d e f a u l t o p t i o n s .
*
* U s e t h i s o n e w h e n c r e a t i n g a v a r i a n t ( e . g . h i d p i )
* G i v e n p a r a m s t o a d d t o ` p a r a m s ` , b u i l d a s e t o f d e f a u l t o p t i o n s .
*/
* U s e t h i s o n e w h e n c r e a t i n g a v a r i a n t ( e . g . h i d p i )
buildMenuAdditionalParamsGrub2 = additional :
*/
let
buildMenuAdditionalParamsGrub2 = additional : let
finalCfg = {
finalCfg = {
name = " ${ config . isoImage . prependToMenuLabel } ${ config . system . nixos . distroName } ${ config . system . nixos . label } ${ config . isoImage . appendToMenuLabel } " ;
name = " ${ config . isoImage . prependToMenuLabel } ${ config . system . nixos . distroName } ${ config . system . nixos . label } ${ config . isoImage . appendToMenuLabel } " ;
params = " i n i t = ${ config . system . build . toplevel } / i n i t ${ additional } ${ toString config . boot . kernelParams } " ;
params = " i n i t = ${ config . system . build . toplevel } / i n i t ${ additional } ${ toString config . boot . kernelParams } " ;
image = " / b o o t / ${ config . system . boot . loader . kernelFile } " ;
image = " / b o o t / ${ config . system . boot . loader . kernelFile } " ;
initrd = " / b o o t / i n i t r d " ;
initrd = " / b o o t / i n i t r d " ;
} ;
} ;
in
in
menuBuilderGrub2
menuBuilderGrub2
finalCfg
finalCfg
[
[
{ class = " i n s t a l l e r " ; }
{ class = " i n s t a l l e r " ; }
]
] ;
;
# Timeout in syslinux is in units of 1/10 of a second.
# Timeout in syslinux is in units of 1/10 of a second.
# null means max timeout (35996, just under 1h in 1/10 seconds)
# null means max timeout (35996, just under 1h in 1/10 seconds)
# 0 means disable timeout
# 0 means disable timeout
syslinuxTimeout = if config . boot . loader . timeout = = null then
syslinuxTimeout =
35996
if config . boot . loader . timeout = = null
else
then 35996
config . boot . loader . timeout * 10 ;
else config . boot . loader . timeout * 10 ;
# Timeout in grub is in seconds.
# Timeout in grub is in seconds.
# null means max timeout (infinity)
# null means max timeout (infinity)
# 0 means disable timeout
# 0 means disable timeout
grubEfiTimeout = if config . boot . loader . timeout = = null then
grubEfiTimeout =
-1
if config . boot . loader . timeout = = null
else
then -1
config . boot . loader . timeout ;
else config . boot . loader . timeout ;
# The configuration file for syslinux.
# The configuration file for syslinux.
@@ -122,23 +121,28 @@ let
A P P E N D ${ toString config . boot . loader . grub . memtest86 . params }
A P P E N D ${ toString config . boot . loader . grub . memtest86 . params }
'' ;
'' ;
isolinuxCfg = concatStringsSep " \n "
isolinuxCfg =
( [ baseIsolinuxCfg ] ++ optional config . boot . loader . grub . memtest86 . enable isolinuxMemtest86Entry ) ;
concatStringsSep " \n "
( [ baseIsolinuxCfg ] ++ optional config . boot . loader . grub . memtest86 . enable isolinuxMemtest86Entry ) ;
refindBinary = if targetArch = = " x 6 4 " || targetArch = = " a a 6 4 " then " r e f i n d _ ${ targetArch } . e f i " else null ;
refindBinary =
if targetArch = = " x 6 4 " || targetArch = = " a a 6 4 "
then " r e f i n d _ ${ targetArch } . e f i "
else null ;
# Setup instructions for rEFInd.
# Setup instructions for rEFInd.
refind =
refind =
if refindBinary != null then
if refindBinary != null
''
then ''
# A d d s r E F I n d t o t h e I S O .
# A d d s r E F I n d t o t h e I S O .
c p - v ${ pkgs . refind } / s h a r e / r e f i n d / ${ refindBinary } $o u t / E F I / b o o t /
c p - v ${ pkgs . refind } / s h a r e / r e f i n d / ${ refindBinary } $o u t / E F I / b o o t /
''
''
else
else " # N o r e f i n d f o r ${ targetArch } " ;
" # N o r e f i n d f o r ${ targetArch } "
;
grubPkgs = if config . boot . loader . grub . forcei686 then pkgs . pkgsi686Linux else pkgs ;
grubPkgs =
if config . boot . loader . grub . forcei686
then pkgs . pkgsi686Linux
else pkgs ;
grubMenuCfg = ''
grubMenuCfg = ''
#
#
@@ -181,234 +185,239 @@ let
f i
f i
${ # When there is a theme configured, use it, otherwise use the background image.
${ # When there is a theme configured, use it, otherwise use the background image.
if config . isoImage . grubTheme != null then ''
if config . isoImage . grubTheme != null
# S e t s t h e m e .
then ''
s e t t h e m e = ( \ $r o o t) / E F I / b o o t / g r u b - t h e m e / t h e m e . t x t
# S e t s t h e m e .
# L o a d t h e m e f o n t s
s e t t h e m e = ( \ $r o o t ) / E F I / b o o t / g r u b - t h e m e / t h e m e . t x t
$( f i n d ${ config . isoImage . grubTheme } - i n a m e ' * . p f 2 ' - p r i n t f " l o a d f o n t ( \ $r o o t ) / E F I / b o o t / g r u b - t h e m e / % P \ n " )
# L o a d t h e m e f o n t s
'' else ''
$( f i n d ${ config . isoImage . grubTheme } - i n a m e ' * . p f 2 ' - p r i n t f " l o a d f o n t ( \ $r o o t ) / E F I / b o o t / g r u b - t h e m e / % P \ n " )
i f b a c k g r o u n d _ i m a g e ( \ $r o o t ) / E F I / b o o t / e f i - b a c k g r o u n d . p n g ; t h e n
''
# B l a c k b a c k g r o u n d m e a n s t r a n s p a r e n t b a c k g r o u n d w h e n t h e r e
else ''
# i s a b a c k g r o u n d i m a g e s e t . . . T h i s s e e m s u n d o c u m e n t e d : (
i f b a c k g r o u n d _ i m a g e ( \ $r o o t ) / E F I / b o o t / e f i - b a c k g r o u n d . p n g ; t h e n
s e t c o l o r _ n o r m a l = b l a c k / b l a c k
# B l a c k b a c k g r o u n d m e a n s t r a n s p a r e n t b a c k g r o u n d w h e n t h e r e
s e t c o l o r _ h i g h l i g h t = w h i t e / b l u e
# i s a b a ck g r o u n d i m a g e s e t . . . T h i s s e e m s u n d o c u m e n t e d : (
e l s e
s e t c o l o r _ n o r m a l = b l a c k / b l a c k
# F a l l s b a c k a g a i n t o p r o p e r c o l o r s .
s e t c o l o r _ h i g h l i g h t = w h i t e / b l u e
s e t m e n u _ c o l o r _ n o r m a l = c y a n / b l u e
e l s e
s e t m e n u _ c o l o r _ h i g h l i g h t = w h i t e / b l u e
# F a l l s b a c k a g a i n t o p r o p e r c o l o r s .
f i
s e t m e n u _ c o l o r _ n o r m a l = c y a n / b l u e
'' }
s e t m e n u _ c o l o r _ h i g h l i g h t = w h i t e / b l u e
f i
''
}
'' ;
'' ;
# The EFI boot image.
# The EFI boot image.
# Notes about grub:
# Notes about grub:
# * Yes, the grubMenuCfg has to be repeated in all submenus. Otherwise you
# * Yes, the grubMenuCfg has to be repeated in all submenus. Otherwise you
# will get white-on-black console-like text on sub-menus. *sigh*
# will get white-on-black console-like text on sub-menus. *sigh*
efiDir = pkgs . runCommand " e f i - d i r e c t o r y " {
efiDir =
nativeBuildInputs = [ pkgs . buildPackages . grub2_efi ] ;
pkgs . runCommand " e f i - d i r e c t o r y " {
strictDeps = true ;
nativeBuildInputs = [ pkgs . buildPackages . grub2_efi ] ;
} ''
strictDeps = true ;
m k d i r - p $o u t / E F I / b o o t /
} ''
m k d i r - p $o u t / E F I / b o o t /
# A d d a m a r k e r s o G R U B c a n f i n d t h e f i l e s y s t e m .
# A d d a m a r k e r s o G R U B c a n f i n d t h e f i l e s y s t e m .
t o u c h $o u t / E F I / n i x o s - i n s t a l l e r - i m a g e
to u c h $o u t / E F I / n i x o s - i n s t a l l e r - i m a g e
# A L W A Y S r e q u i r e d m o d u l e s .
# A L W A Y S r e q u i r e d m o d u l e s .
M O D U L E S = (
MO D U L E S = (
# B a s i c m o d u l e s f o r f i l e s y s t e m s a n d p a r t i t i o n s c h e m e s
# B a s i c m o d u l e s f o r f i l e s y s t e m s a n d p a r t i t i o n s c h e m e s
" f a t "
"f a t "
" i s o 9 6 6 0 "
"i s o 9 6 6 0 "
" p a r t _ g p t "
"p a r t _ g p t "
" p a r t _ m s d o s "
"p a r t _ m s d o s "
# B a s i c s t u f f
# B a s i c s t u f f
" n o r m a l "
"n o r m a l "
" b o o t "
"b o o t "
" l i n u x "
"l i n u x "
" c o n f i g f i l e "
"c o n f i g f i l e "
" l o o p b a c k "
"l o o p b a c k "
" c h a i n "
"c h a i n "
" h a l t "
"h a l t "
# A l l o w s r e b o o t i n g i n t o f i r m w a r e s e t u p i n t e r f a c e
# A l l o w s r e b o o t i n g i n t o f i r m w a r e s e t u p i n t e r f a c e
" e f i f w s e t u p "
"e f i f w s e t u p "
# E F I G r a p h i c s O u t p u t P r o t o c o l
# E F I G r a p h i c s O u t p u t P r o t o c o l
" e f i _ g o p "
"e f i _ g o p "
# U s e r c o m m a n d s
# U s e r c o m m a n d s
" l s "
"l s "
# S y s t e m c o m m a n d s
# S y s t e m c o m m a n d s
" s e a r c h "
"s e a r c h "
" s e a r c h _ l a b e l "
"s e a r c h _ l a b e l "
" s e a r c h _ f s _ u u i d "
"s e a r c h _ f s _ u u i d "
" s e a r c h _ f s _ f i l e "
"s e a r c h _ f s _ f i l e "
" e c h o "
"e c h o "
# W e ' r e n o t u s i n g i t a n y m o r e , b u t w e ' l l l e a v e i t i n s o i t c a n b e u s e d
# W e ' r e n o t u s i n g i t a n y m o r e , b u t w e ' l l l e a v e i t i n s o i t c a n b e u s e d
# b y u s e r , w i t h t h e c o n s o l e u s i n g " C "
# b y u s e r , w i t h t h e c o n s o l e u s i n g " C "
" s e r i a l "
"s e r i a l "
# G r a p h i c a l m o d e s t u f f
# G r a p h i c a l m o d e s t u f f
" g f x m e n u "
"g f x m e n u "
" g f x t e r m "
"g f x t e r m "
" g f x t e r m _ b a c k g r o u n d "
"g f x t e r m _ b a c k g r o u n d "
" g f x t e r m _ m e n u "
"g f x t e r m _ m e n u "
" t e s t "
"t e s t "
" l o a d e n v "
"l o a d e n v "
" a l l _ v i d e o "
"a l l _ v i d e o "
" v i d e o i n f o "
"v i d e o i n f o "
# F i l e t y p e s f o r g r a p h i c a l m o d e
# F i l e t y p e s f o r g r a p h i c a l m o d e
" p n g "
"p n g "
)
)
e c h o " B u i l d i n g G R U B w i t h m o d u l e s : "
ec h o " B u i l d i n g G R U B w i t h m o d u l e s : "
f o r m o d i n ''$ { M O D U L E S [ @ ] } ; d o
fo r m o d i n ''$ { M O D U L E S [ @ ] } ; d o
e c h o " - $m o d "
d o n e
# M o d u l e s t h a t m a y o r m a y n o t b e a v a i l a b l e p e r - p l a t f o r m .
e c h o " A d d i n g a d d i t i o n a l m o d u l e s : "
f o r m o d i n e f i _ u g a ; d o
i f [ - f ${ grubPkgs . grub2_efi } / l i b / g r u b / ${ grubPkgs . grub2_efi . grubTarget } / $m o d . m o d ] ; t h e n
e c h o " - $m o d "
e c h o " - $m o d "
M O D U L E S + = ( " $m o d " )
d o n e
f i
d o n e
# M a k e o u r o w n e f i p r o g r a m , w e c a n ' t r e l y o n " g r u b - i n s t a l l " s i n c e i t s e e m s t o
# M o d u l e s t h a t m a y o r m a y n o t b e a v a i l a b l e p e r - p l a t f o r m .
# p r o b e f o r d e v i c e s , e v e n w i t h - - s k i p - f s - p r o b e .
e c h o " A d d i n g a d d i t i o n a l m o d u l e s : "
g r u b - m k i m a g e \
f o r m o d i n e f i _ u g a ; d o
- - d i r e c t o r y = ${ grubPkgs . grub2_efi } / l i b / g r u b / ${ grubPkgs . grub2_efi . grubTarget } \
i f [ - f ${ grubPkgs . grub2_efi } / l i b / g r u b / ${ grubPkgs . grub2_efi . grubTarget } / $m o d . m o d ] ; t h e n
- o $o u t / E F I / b o o t / b o o t ${ targetArch } . e f i \
e c h o " - $m o d "
- p / E F I / b o o t \
M O D U L E S + = ( " $m o d " )
- O ${ grubPkgs . grub2_efi . grubTarget } \
f i
''$ { M O D U L E S [ @ ] }
d o n e
c p ${ grubPkgs . grub2_efi } / s h a r e / g r u b / u n i c o d e . p f 2 $o u t / E F I / b o o t /
c a t < < E O F > $o u t / E F I / b o o t / g r u b . c f g
# M a k e o u r o w n e f i p r o g r a m , w e c a n ' t r e l y o n " g r u b - i n s t a l l " s i n c e i t s e e m s t o
# p r o b e f o r d e v i c e s , e v e n w i t h - - s k i p - f s - p r o b e .
g r u b - m k i m a g e \
- - d i r e c t o r y = ${ grubPkgs . grub2_efi } / l i b / g r u b / ${ grubPkgs . grub2_efi . grubTarget } \
- o $o u t / E F I / b o o t / b o o t ${ targetArch } . e f i \
- p / E F I / b o o t \
- O ${ grubPkgs . grub2_efi . grubTarget } \
''$ { M O D U L E S [ @ ] }
c p ${ grubPkgs . grub2_efi } / s h a r e / g r u b / u n i c o d e . p f 2 $o u t / E F I / b o o t /
s e t t e x t m o d e = ${ boolToString ( config . isoImage . forceTextMode ) }
c a t < < E O F > $ ou t / E F I / b o o t / g r u b . c f g
s e t t i m e o u t = ${ toString grubEfiTimeout }
c l e a r
s e t t e x t m o d e = ${ boolToString ( config . isoImage . forceTextMode ) }
# T h i s m e s s a g e w i l l o n l y b e v i e w a b l e o n t h e d e f a u l t ( U E F I ) c o n s o l e .
s e t t i m e o u t = ${ toString grubEfiTimeout }
e c h o " "
e c h o " L o a d i n g g r a p h i c a l b o o t m e n u . . . "
e c h o " "
e c h o " P r e s s ' t ' t o u s e t h e t e x t b o o t m e n u o n t h i s c o n s o l e . . . "
e c h o " "
${ grubMenuCfg }
h i d d e n e n t r y ' T e x t m o d e ' - - h o t k e y ' t ' {
l o a d f o n t ( \ $r o o t ) / E F I / b o o t / u n i c o d e . p f 2
s e t t e x t m o d e = t r u e
t e r m i n a l _ o u t p u t c o n s o l e
}
h i d d e n e n t r y ' G U I m o d e ' - - h o t k e y ' g ' {
$( f i n d ${ config . isoImage . grubTheme } - i n a m e ' * . p f 2 ' - p r i n t f " l o a d f o n t ( \ $r o o t ) / E F I / b o o t / g r u b - t h e m e / % P \ n " )
s e t t e x t m o d e = f a l s e
t e r m i n a l _ o u t p u t g f x t e r m
}
# I f t h e p a r a m e t e r i s o _ p a t h i s s e t , a p p e n d t h e f i n d i s o p a r a m e t e r t o t h e k e r n e l
# l i n e . W e n e e d t h i s t o a l l o w t h e n i x o s i s o t o b e b o o t e d f r o m g r u b d i r e c t l y .
i f [ \ ''$ { i s o _ p a t h } ] ; t h e n
s e t i s o b o o t = " f i n d i s o = \ ''$ { i s o _ p a t h } "
f i
#
# M e n u e n t r i e s
#
${ buildMenuGrub2 }
s u b m e n u " H i D P I , Q u i r k s a n d A c c e s s i b i l i t y " - - c l a s s h i d p i - - c l a s s s u b m e n u {
${ grubMenuCfg }
s u b m e n u " S u g g e s t s r e s o l u t i o n @ 7 2 0 p " - - c l a s s h i d p i - 7 2 0 p {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " v i d e o = 1 2 8 0 x 7 2 0 @ 6 0 " }
}
s u b m e n u " S u g g e s t s r e s o l u t i o n @ 1 0 8 0 p " - - c l a s s h i d p i - 1 0 8 0 p {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " v i d e o = 1 9 2 0 x 1 0 8 0 @ 6 0 " }
}
# I f w e b o o t i n t o a g r a p h i c a l e n v i r o n m e n t w h e r e X i s a u t o r a n
# a n d a l w a y s c r a s h e s , i t m a k e s t h e m e d i a u n u s a b l e . A l l o w t h e u s e r
# t o d i s a b l e t h i s .
s u b m e n u " D i s a b l e d i s p l a y - m a n a g e r " - - c l a s s q u i r k - d i s a b l e - d i s p l a y m a n a g e r {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " s y s t e m d . m a s k = d i s p l a y - m a n a g e r . s e r v i c e " }
}
# S o m e l a p t o p a n d c o n v e r t i b l e s h a v e t h e p a n e l i n s t a l l e d i n a n
# i n c o n v e n i e n t w a y , r o t a t e d a w a y f r o m t h e k e y b o a r d .
# T h o s e e n t r i e s m a k e s i t e a s i e r t o u s e t h e i n s t a l l e r .
s u b m e n u " " { r e t u r n }
s u b m e n u " R o t a t e f r a m e b u f f e r C l o c k w i s e " - - c l a s s r o t a t e - 9 0 c w {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " f b c o n = r o t a t e : 1 " }
}
s u b m e n u " R o t a t e f r a m e b u f f e r U p s i d e - D o w n " - - c l a s s r o t a t e - 1 8 0 {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " f b c o n = r o t a t e : 2 " }
}
s u b m e n u " R o t a t e f r a m e b u f f e r C o u n t e r - C l o c k w i s e " - - c l a s s r o t a t e - 9 0 c c w {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " f b c o n = r o t a t e : 3 " }
}
# A s a p r o o f o f c o n c e p t , m a i n l y . ( N o t s u r e i t h a s a c c e s s i b i l i t y m e r i t s . )
s u b m e n u " " { r e t u r n }
s u b m e n u " U s e b l a c k o n w h i t e " - - c l a s s a c c e s s i b i l i t y - b l a k c o n w h i t e {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " v t . d e f a u l t _ r e d = 0 x F F , 0 x B C , 0 x 4 F , 0 x B 4 , 0 x 5 6 , 0 x B C , 0 x 4 F , 0 x 0 0 , 0 x A 1 , 0 x C F , 0 x 8 4 , 0 x C A , 0 x 8 D , 0 x B 4 , 0 x 8 4 , 0 x 6 8 v t . d e f a u l t _ g r n = 0 x F F , 0 x 5 5 , 0 x B A , 0 x B A , 0 x 4 D , 0 x 4 D , 0 x B 3 , 0 x 0 0 , 0 x A 0 , 0 x 8 F , 0 x B 3 , 0 x C A , 0 x 8 8 , 0 x 9 3 , 0 x A 4 , 0 x 6 8 v t . d e f a u l t _ b l u = 0 x F F , 0 x 5 8 , 0 x 5 F , 0 x 5 8 , 0 x C 5 , 0 x B D , 0 x C 5 , 0 x 0 0 , 0 x A 8 , 0 x B B , 0 x A B , 0 x 9 7 , 0 x B D , 0 x C 7 , 0 x C 5 , 0 x 6 8 " }
}
# S e r i a l a c c e s s i s a m u s t !
s u b m e n u " " { r e t u r n }
s u b m e n u " S e r i a l c o n s o l e = t t y S 0 , 1 1 5 2 0 0 n 8 " - - c l a s s s e r i a l {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " c o n s o l e = t t y S 0 , 1 1 5 2 0 0 n 8 " }
}
}
${ lib . optionalString ( refindBinary != null ) ''
# G R U B a p p a r e n t l y c a n n o t d o " c h a i n l o a d e r " o p e r a t i o n s o n " C D " .
i f [ " \ $r o o t " ! = " c d 0 " ] ; t h e n
m e n u e n t r y ' r E F I n d ' - - c l a s s r e f i n d {
# F o r c e r o o t t o b e t h e F A T p a r t i t i o n
# O t h e r w i s e i t b r e a k s r E F I n d ' s b o o t
s e a r c h - - s e t = r o o t - - n o - f l o p p y - - f s - u u i d 1 2 3 4 - 5 6 7 8
c h a i n l o a d e r ( \ $r o o t ) / E F I / b o o t / ${ refindBinary }
}
f i
'' }
m e n u e n t r y ' F i r m w a r e S e t u p ' - - c l a s s s e t t i n g s {
f w s e t u p
c l e a r
c l e a r
# T h i s m e s s a g e w i l l o n l y b e v i e w a b l e o n t h e d e f a u l t ( U E F I ) c o n s o l e .
e c h o " "
e c h o " "
e c h o " I f y o u s e e t h i s m e s s a g e , y o u r E F I s y s t e m d o e s n ' t s u p p o r t t h i s f e a t u r e . "
e c h o " L o a d i n g g r a p h i c a l b o o t m e n u . . . "
e c h o " "
e c h o " "
e c h o " P r e s s ' t ' t o u s e t h e t e x t b o o t m e n u o n t h i s c o n s o l e . . . "
e c h o " "
${ grubMenuCfg }
h i d d e n e n t r y ' T e x t m o d e ' - - h o t k e y ' t ' {
l o a d f o n t ( \ $r o o t ) / E F I / b o o t / u n i c o d e . p f 2
s e t t e x t m o d e = t r u e
t e r m i n a l _ o u t p u t c o n s o l e
}
h i d d e n e n t r y ' G U I m o d e ' - - h o t k e y ' g ' {
$( f i n d ${ config . isoImage . grubTheme } - i n a m e ' * . p f 2 ' - p r i n t f " l o a d f o n t ( \ $r o o t ) / E F I / b o o t / g r u b - t h e m e / % P \ n " )
s e t t e x t m o d e = f a l s e
t e r m i n a l _ o u t p u t g f x t e r m
}
# I f t h e p a r a m e t e r i s o _ p a t h i s s e t , a p p e n d t h e f i n d i s o p a r a m e t e r t o t h e k e r n e l
# l i n e . W e n e e d t h i s t o a l l o w t h e n i x o s i s o t o b e b o o t e d f r o m g r u b d i r e c t l y .
i f [ \ ''$ { i s o _ p a t h } ] ; t h e n
s e t i s o b o o t = " f i n d i s o = \ ''$ { i s o _ p a t h } "
f i
#
# M e n u e n t r i e s
#
${ buildMenuGrub2 }
s u b m e n u " H i D P I , Q u i r k s a n d A c c e s s i b i l i t y " - - c l a s s h i d p i - - c l a s s s u b m e n u {
${ grubMenuCfg }
s u b m e n u " S u g g e s t s r e s o l u t i o n @ 7 2 0 p " - - c l a s s h i d p i - 7 2 0 p {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " v i d e o = 1 2 8 0 x 7 2 0 @ 6 0 " }
}
s u b m e n u " S u g g e s t s r e s o l u t i o n @ 1 0 8 0 p " - - c l a s s h i d p i - 1 0 8 0 p {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " v i d e o = 1 9 2 0 x 1 0 8 0 @ 6 0 " }
}
# I f w e b o o t i n t o a g r a p h i c a l e n v i r o n m e n t w h e r e X i s a u t o r a n
# a n d a l w a y s c r a s h e s , i t m a k e s t h e m e d i a u n u s a b l e . A l l o w t h e u s e r
# t o d i s a b l e t h i s .
s u b m e n u " D i s a b l e d i s p l a y - m a n a g e r " - - c l a s s q u i r k - d i s a b l e - d i s p l a y m a n a g e r {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " s y s t e m d . m a s k = d i s p l a y - m a n a g e r . s e r v i c e " }
}
# S o m e l a p t o p a n d c o n v e r t i b l e s h a v e t h e p a n e l i n s t a l l e d i n a n
# i n c o n v e n i e n t w a y , r o t a t e d a w a y f r o m t h e k e y b o a r d .
# T h o s e e n t r i e s m a k e s i t e a s i e r t o u s e t h e i n s t a l l e r .
s u b m e n u " " { r e t u r n }
s u b m e n u " R o t a t e f r a m e b u f f e r C l o c k w i s e " - - c l a s s r o t a t e - 9 0 c w {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " f b c o n = r o t a t e : 1 " }
}
s u b m e n u " R o t a t e f r a m e b u f f e r U p s i d e - D o w n " - - c l a s s r o t a t e - 1 8 0 {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " f b c o n = r o t a t e : 2 " }
}
s u b m e n u " R o t a t e f r a m e b u f f e r C o u n t e r - C l o c k w i s e " - - c l a s s r o t a t e - 9 0 c c w {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " f b c o n = r o t a t e : 3 " }
}
# A s a p r o o f o f c o n c e p t , m a i n l y . ( N o t s u r e i t h a s a c c e s s i b i l i t y m e r i t s . )
s u b m e n u " " { r e t u r n }
s u b m e n u " U s e b l a c k o n w h i t e " - - c l a s s a c c e s s i b i l i t y - b l a k c o n w h i t e {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " v t . d e f a u l t _ r e d = 0 x F F , 0 x B C , 0 x 4 F , 0 x B 4 , 0 x 5 6 , 0 x B C , 0 x 4 F , 0 x 0 0 , 0 x A 1 , 0 x C F , 0 x 8 4 , 0 x C A , 0 x 8 D , 0 x B 4 , 0 x 8 4 , 0 x 6 8 v t . d e f a u l t _ g r n = 0 x F F , 0 x 5 5 , 0 x B A , 0 x B A , 0 x 4 D , 0 x 4 D , 0 x B 3 , 0 x 0 0 , 0 x A 0 , 0 x 8 F , 0 x B 3 , 0 x C A , 0 x 8 8 , 0 x 9 3 , 0 x A 4 , 0 x 6 8 v t . d e f a u l t _ b l u = 0 x F F , 0 x 5 8 , 0 x 5 F , 0 x 5 8 , 0 x C 5 , 0 x B D , 0 x C 5 , 0 x 0 0 , 0 x A 8 , 0 x B B , 0 x A B , 0 x 9 7 , 0 x B D , 0 x C 7 , 0 x C 5 , 0 x 6 8 " }
}
# S e r i a l a c c e s s i s a m u s t !
s u b m e n u " " { r e t u r n }
s u b m e n u " S e r i a l c o n s o l e = t t y S 0 , 1 1 5 2 0 0 n 8 " - - c l a s s s e r i a l {
${ grubMenuCfg }
${ buildMenuAdditionalParamsGrub2 " c o n s o l e = t t y S 0 , 1 1 5 2 0 0 n 8 " }
}
}
${ lib . optionalString ( refindBinary != null ) ''
# G R U B a p p a r e n t l y c a n n o t d o " c h a i n l o a d e r " o p e r a t i o n s o n " C D " .
i f [ " \ $r o o t " ! = " c d 0 " ] ; t h e n
m e n u e n t r y ' r E F I n d ' - - c l a s s r e f i n d {
# F o r c e r o o t t o b e t h e F A T p a r t i t i o n
# O t h e r w i s e i t b r e a k s r E F I n d ' s b o o t
s e a r c h - - s e t = r o o t - - n o - f l o p p y - - f s - u u i d 1 2 3 4 - 5 6 7 8
c h a i n l o a d e r ( \ $r o o t ) / E F I / b o o t / ${ refindBinary }
}
f i
'' }
m e n u e n t r y ' F i r m w a r e S e t u p ' - - c l a s s s e t t i n g s {
f w s e t u p
c l e a r
e c h o " "
e c h o " I f y o u s e e t h i s m e s s a g e , y o u r E F I s y s t e m d o e s n ' t s u p p o r t t h i s f e a t u r e . "
e c h o " "
}
m e n u e n t r y ' S h u t d o w n ' - - c l a s s s h u t d o w n {
h a l t
}
E O F
g r u b - s c r i p t - c h e c k $o u t / E F I / b o o t / g r u b . c f g
${ refind }
'' ;
efiImg =
pkgs . runCommand " e f i - i m a g e _ e l t o r i t o " {
nativeBuildInputs = [ pkgs . buildPackages . mtools pkgs . buildPackages . libfaketime pkgs . buildPackages . dosfstools ] ;
strictDeps = true ;
}
}
m e n u e n t r y ' S h u t d o w n ' - - c l a s s s h u t d o w n {
h a l t
}
E O F
g r u b - s c r i p t - c h e c k $o u t / E F I / b o o t / g r u b . c f g
${ refind }
'' ;
efiImg = pkgs . runCommand " e f i - i m a g e _ e l t o r i t o " {
nativeBuildInputs = [ pkgs . buildPackages . mtools pkgs . buildPackages . libfaketime pkgs . buildPackages . dosfstools ] ;
strictDeps = true ;
}
# Be careful about determinism: du --apparent-size,
# Be careful about determinism: du --apparent-size,
# dates (cp -p, touch, mcopy -m, faketime for label), IDs (mkfs.vfat -i)
# dates (cp -p, touch, mcopy -m, faketime for label), IDs (mkfs.vfat -i)
''
''
@@ -443,12 +452,8 @@ let
# V e r i f y t h e F A T p a r t i t i o n .
# V e r i f y t h e F A T p a r t i t i o n .
f s c k . v f a t - v n " $o u t "
f s c k . v f a t - v n " $o u t "
'' ; # */
'' ; # */
in {
in
{
options = {
options = {
isoImage . isoName = mkOption {
isoImage . isoName = mkOption {
default = " ${ config . isoImage . isoBaseName } . i s o " ;
default = " ${ config . isoImage . isoBaseName } . i s o " ;
type = lib . types . str ;
type = lib . types . str ;
@@ -475,12 +480,13 @@ in
} ;
} ;
isoImage . squashfsCompression = mkOption {
isoImage . squashfsCompression = mkOption {
default = with pkgs . stdenv . hostPlatform ; " x z - X d i c t - s i z e 1 0 0 % "
default = with pkgs . stdenv . hostPlatform ;
+ lib . optionalString isx86 " - X b c j x 8 6 "
" x z - X d i c t - s i z e 1 0 0 % "
# Untested but should also reduce size for these platforms
+ lib . optionalString isx86 " - X b c j x 8 6 "
+ lib . optionalString isAarch " - X b c j a r m "
# Untested but should also reduce size for these platforms
+ lib . optionalString ( isPower && is32bit && isBigEndian ) " - X b c j p o w e r p c "
+ lib . optionalString isAarch " - X b c j a r m "
+ lib . optionalString ( isSparc ) " - X b c j s p a r c " ;
+ lib . optionalString ( isPower && is32bit && isBigEndian ) " - X b c j p o w e r p c "
+ lib . optionalString isSparc " - X b c j s p a r c " ;
type = lib . types . nullOr lib . types . str ;
type = lib . types . nullOr lib . types . str ;
description = ''
description = ''
C o m p r e s s i o n s e t t i n g s t o u s e f o r t h e s q u a s h f s n i x s t o r e .
C o m p r e s s i o n s e t t i n g s t o u s e f o r t h e s q u a s h f s n i x s t o r e .
@@ -578,9 +584,9 @@ in
isoImage . efiSplashImage = mkOption {
isoImage . efiSplashImage = mkOption {
default = pkgs . fetchurl {
default = pkgs . fetchurl {
url = " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / N i x O S / n i x o s - a r t w o r k / a 9 e 0 5 d 7 d e b 3 8 a 8 e 0 0 5 a 2 b 5 2 5 7 5 a 3 f 5 9 a 6 3 a 4 d b a 0 / b o o t l o a d e r / e f i - b a c k g r o u n d . p n g " ;
url = " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / N i x O S / n i x o s - a r t w o r k / a 9 e 0 5 d 7 d e b 3 8 a 8 e 0 0 5 a 2 b 5 2 5 7 5 a 3 f 5 9 a 6 3 a 4 d b a 0 / b o o t l o a d e r / e f i - b a c k g r o u n d . p n g " ;
sha256 = " 1 8 l f w m p 8 y q 9 2 3 3 2 2 n l b 9 g x r h 5 q i k j 1 w s k 6 g 5 q v d h 3 1 c 4 h 5 b 1 5 3 8 x " ;
sha256 = " 1 8 l f w m p 8 y q 9 2 3 3 2 2 n l b 9 g x r h 5 q i k j 1 w s k 6 g 5 q v d h 3 1 c 4 h 5 b 1 5 3 8 x " ;
} ;
} ;
description = ''
description = ''
T h e s p l a s h i m a g e t o u s e i n t h e E F I b o o t l o a d e r .
T h e s p l a s h i m a g e t o u s e i n t h e E F I b o o t l o a d e r .
'' ;
'' ;
@@ -588,9 +594,9 @@ in
isoImage . splashImage = mkOption {
isoImage . splashImage = mkOption {
default = pkgs . fetchurl {
default = pkgs . fetchurl {
url = " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / N i x O S / n i x o s - a r t w o r k / a 9 e 0 5 d 7 d e b 3 8 a 8 e 0 0 5 a 2 b 5 2 5 7 5 a 3 f 5 9 a 6 3 a 4 d b a 0 / b o o t l o a d e r / i s o l i n u x / b i o s - b o o t . p n g " ;
url = " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / N i x O S / n i x o s - a r t w o r k / a 9 e 0 5 d 7 d e b 3 8 a 8 e 0 0 5 a 2 b 5 2 5 7 5 a 3 f 5 9 a 6 3 a 4 d b a 0 / b o o t l o a d e r / i s o l i n u x / b i o s - b o o t . p n g " ;
sha256 = " 1 w p 8 2 2 z r h b g 4 f g f b w k r 7 c b k r 4 l a b x 4 7 7 2 0 9 a g z c 0 h r 6 k 6 2 f r 6 r x d " ;
sha256 = " 1 w p 8 2 2 z r h b g 4 f g f b w k r 7 c b k r 4 l a b x 4 7 7 2 0 9 a g z c 0 h r 6 k 6 2 f r 6 r x d " ;
} ;
} ;
description = ''
description = ''
T h e s p l a s h i m a g e t o u s e i n t h e l e g a c y - b o o t b o o t l o a d e r .
T h e s p l a s h i m a g e t o u s e i n t h e l e g a c y - b o o t b o o t l o a d e r .
'' ;
'' ;
@@ -674,44 +680,52 @@ in
I f t e x t m o d e i s r e q u i r e d o f f - h a n d e d l y ( e . g . f o r s e r i a l u s e ) y o u c a n u s e t h e ` T ` k e y , a f t e r b e i n g p r o m p t e d , t o u s e t e x t m o d e f o r t h e c u r r e n t b o o t .
I f t e x t m o d e i s r e q u i r e d o f f - h a n d e d l y ( e . g . f o r s e r i a l u s e ) y o u c a n u s e t h e ` T ` k e y , a f t e r b e i n g p r o m p t e d , t o u s e t e x t m o d e f o r t h e c u r r e n t b o o t .
'' ;
'' ;
} ;
} ;
} ;
} ;
# store them in lib so we can mkImageMediaOverride the
# store them in lib so we can mkImageMediaOverride the
# entire file system layout in installation media (only)
# entire file system layout in installation media (only)
config . lib . isoFileSystems = {
config . lib . isoFileSystems = {
" / " = mkImageMediaOverride
" / " =
mkImageMediaOverride
{
{
fsType = " t m p f s " ;
fsType = " t m p f s " ;
options = [ " m o d e = 0 7 5 5 " ] ;
options = [ " m o d e = 0 7 5 5 " ] ;
} ;
} ;
# Note that /dev/root is a symlink to the actual root device
# Note that /dev/root is a symlink to the actual root device
# specified on the kernel command line, created in the stage 1
# specified on the kernel command line, created in the stage 1
# init script.
# init script.
" / i s o " = mkImageMediaOverride
" / i s o " =
{ device = " / d e v / r o o t " ;
mkImageMediaOverride
{
device = " / d e v / r o o t " ;
neededForBoot = true ;
neededForBoot = true ;
noCheck = true ;
noCheck = true ;
} ;
} ;
# In stage 1, mount a tmpfs on top of /nix/store (the squashfs
# In stage 1, mount a tmpfs on top of /nix/store (the squashfs
# image) to make this a live CD.
# image) to make this a live CD.
" / n i x / . r o - s t o r e " = mkImageMediaOverride
" / n i x / . r o - s t o r e " =
{ fsType = " s q u a s h f s " ;
mkImageMediaOverride
{
fsType = " s q u a s h f s " ;
device = " / i s o / n i x - s t o r e . s q u a s h f s " ;
device = " / i s o / n i x - s t o r e . s q u a s h f s " ;
options = [ " l o o p " ] ;
options = [ " l o o p " ] ;
neededForBoot = true ;
neededForBoot = true ;
} ;
} ;
" / n i x / . r w - s t o r e " = mkImageMediaOverride
" / n i x / . r w - s t o r e " =
{ fsType = " t m p f s " ;
mkImageMediaOverride
options = [ " m o d e = 0 7 5 5 " ] ;
{
fsType = " t m p f s " ;
options = [ " m o d e = 0 7 5 5 " ] ;
neededForBoot = true ;
neededForBoot = true ;
} ;
} ;
" / n i x / s t o r e " = mkImageMediaOverride
" / n i x / s t o r e " =
{ fsType = " o v e r l a y " ;
mkImageMediaOverride
{
fsType = " o v e r l a y " ;
device = " o v e r l a y " ;
device = " o v e r l a y " ;
options = [
options = [
" l o w e r d i r = / n i x / . r o - s t o r e "
" l o w e r d i r = / n i x / . r o - s t o r e "
@@ -741,8 +755,7 @@ in
length = stringLength config . isoImage . volumeID ;
length = stringLength config . isoImage . volumeID ;
howmany = toString length ;
howmany = toString length ;
toomany = toString ( length - 32 ) ;
toomany = toString ( length - 32 ) ;
in
in " i s o I m a g e . v o l u m e I D ${ config . isoImage . volumeID } i s ${ howmany } c h a r a c t e r s . T h a t i s ${ toomany } c h a r a c t e r s l o n g e r t h a n t h e l i m i t o f 3 2 . " ;
" i s o I m a g e . v o l u m e I D ${ config . isoImage . volumeID } i s ${ howmany } c h a r a c t e r s . T h a t i s ${ toomany } c h a r a c t e r s l o n g e r t h a n t h e l i m i t o f 3 2 . " ;
}
}
] ;
] ;
@@ -750,9 +763,9 @@ in
# here and it causes a cyclic dependency.
# here and it causes a cyclic dependency.
boot . loader . grub . enable = false ;
boot . loader . grub . enable = false ;
environment . systemPackages = [ grubPkgs . grub2 grubPkgs . grub2_efi ]
environment . systemPackages =
++ optional ( config . isoImage . makeBiosBootable ) pkgs . syslinux
[ grubPkgs . grub2 grubPkgs . grub2_efi ]
;
++ optional ( config . isoImage . makeBiosBootable ) pkgs . syslinux ;
# In stage 1 of the boot, mount the CD as the root FS by label so
# In stage 1 of the boot, mount the CD as the root FS by label so
# that we don't need to know its device. We pass the label of the
# that we don't need to know its device. We pass the label of the
@@ -762,70 +775,86 @@ in
# UUID of the USB stick. It would be nicer to write
# UUID of the USB stick. It would be nicer to write
# `root=/dev/disk/by-label/...' here, but UNetbootin doesn't
# `root=/dev/disk/by-label/...' here, but UNetbootin doesn't
# recognise that.
# recognise that.
boot . kernelParams =
boot . kernelParams = [
[ " r o o t = L A B E L = ${ config . isoImage . volumeID } "
" r o o t = L A B E L = ${ config . isoImage . volumeID } "
" b o o t . s h e l l _ o n _ f a i l "
" b o o t . s h e l l _ o n _ f a i l "
] ;
] ;
fileSystems = config . lib . isoFileSystems ;
fileSystems = config . lib . isoFileSystems ;
boot . initrd . availableKernelModules = [ " s q u a s h f s " " i s o 9 6 6 0 " " u a s " " o v e r l a y " ] ;
boot . initrd . availableKernelModules = [ " s q u a s h f s " " i s o 9 6 6 0 " " u a s " " o v e r l a y " ] ;
boot . initrd . kernelModules = [ " l o o p " " o v e r l a y " ] ;
boot . initrd . kernelModules = [ " l o o p " " o v e r l a y " ] ;
# Closures to be copied to the Nix store on the CD, namely the init
# Closures to be copied to the Nix store on the CD, namely the init
# script and the top-level system configuration directory.
# script and the top-level system configuration directory.
isoImage . storeContents =
isoImage . storeContents =
[ config . system . build . toplevel ] ++
[ config . system . build . toplevel ]
optional config . isoImage . includeSystemBuildDependencies
++ optional config . isoImage . includeSystemBuildDependencies
config . system . build . toplevel . drvPath ;
config . system . build . toplevel . drvPath ;
# Individual files to be included on the CD, outside of the Nix
# Individual files to be included on the CD, outside of the Nix
# store on the CD.
# store on the CD.
isoImage . contents =
isoImage . contents =
[
[
{ source = config . boot . kernelPackages . kernel + " / " + config . system . boot . loader . kernelFile ;
{
source = config . boot . kernelPackages . kernel + " / " + config . system . boot . loader . kernelFile ;
target = " / b o o t / " + config . system . boot . loader . kernelFile ;
target = " / b o o t / " + config . system . boot . loader . kernelFile ;
}
}
{ source = config . system . build . initialRamdisk + " / " + config . system . boot . loader . initrdFile ;
{
source = config . system . build . initialRamdisk + " / " + config . system . boot . loader . initrdFile ;
target = " / b o o t / " + config . system . boot . loader . initrdFile ;
target = " / b o o t / " + config . system . boot . loader . initrdFile ;
}
}
{ source = pkgs . writeText " v e r s i o n " config . system . nixos . label ;
{
source = pkgs . writeText " v e r s i o n " config . system . nixos . label ;
target = " / v e r s i o n . t x t " ;
target = " / v e r s i o n . t x t " ;
}
}
] ++ optionals ( config . isoImage . makeBiosBootable ) [
]
{ source = config . isoImage . splashImage ;
++ optionals ( config . isoImage . makeBiosBootable ) [
{
source = config . isoImage . splashImage ;
target = " / i s o l i n u x / b a c k g r o u n d . p n g " ;
target = " / i s o l i n u x / b a c k g r o u n d . p n g " ;
}
}
{ source = pkgs . substituteAll {
{
source = pkgs . substituteAll {
name = " i s o l i n u x . c f g " ;
name = " i s o l i n u x . c f g " ;
src = pkgs . writeText " i s o l i n u x . c f g - i n " isolinuxCfg ;
src = pkgs . writeText " i s o l i n u x . c f g - i n " isolinuxCfg ;
bootRoot = " / b o o t " ;
bootRoot = " / b o o t " ;
} ;
} ;
target = " / i s o l i n u x / i s o l i n u x . c f g " ;
target = " / i s o l i n u x / i s o l i n u x . c f g " ;
}
}
{ source = " ${ pkgs . syslinux } / s h a r e / s y s l i n u x " ;
{
source = " ${ pkgs . syslinux } / s h a r e / s y s l i n u x " ;
target = " / i s o l i n u x " ;
target = " / i s o l i n u x " ;
}
}
] ++ optionals config . isoImage . makeEfiBootable [
]
{ source = efiImg ;
++ optionals config . isoImage . makeEfiBootable [
{
source = efiImg ;
target = " / b o o t / e f i . i m g " ;
target = " / b o o t / e f i . i m g " ;
}
}
{ source = " ${ efiDir } / E F I " ;
{
source = " ${ efiDir } / E F I " ;
target = " / E F I " ;
target = " / E F I " ;
}
}
{ source = ( pkgs . writeTextDir " g r u b / l o o p b a c k . c f g " " s o u r c e / E F I / b o o t / g r u b . c f g " ) + " / g r u b " ;
{
source = ( pkgs . writeTextDir " g r u b / l o o p b a c k . c f g " " s o u r c e / E F I / b o o t / g r u b . c f g " ) + " / g r u b " ;
target = " / b o o t / g r u b " ;
target = " / b o o t / g r u b " ;
}
}
{ source = config . isoImage . efiSplashImage ;
{
source = config . isoImage . efiSplashImage ;
target = " / E F I / b o o t / e f i - b a c k g r o u n d . p n g " ;
target = " / E F I / b o o t / e f i - b a c k g r o u n d . p n g " ;
}
}
] ++ optionals ( config . boot . loader . grub . memtest86 . enable && config . isoImage . makeBiosBootable ) [
]
{ source = " ${ pkgs . memtest86plus } / m e m t e s t . b i n " ;
++ optionals ( config . boot . loader . grub . memtest86 . enable && config . isoImage . makeBiosBootable ) [
{
source = " ${ pkgs . memtest86plus } / m e m t e s t . b i n " ;
target = " / b o o t / m e m t e s t . b i n " ;
target = " / b o o t / m e m t e s t . b i n " ;
}
}
] ++ optionals ( config . isoImage . grubTheme != null ) [
]
{ source = config . isoImage . grubTheme ;
++ optionals ( config . isoImage . grubTheme != null ) [
{
source = config . isoImage . grubTheme ;
target = " / E F I / b o o t / g r u b - t h e m e " ;
target = " / E F I / b o o t / g r u b - t h e m e " ;
}
}
] ;
] ;
@@ -834,36 +863,38 @@ in
# Create the ISO image.
# Create the ISO image.
system . build . isoImage = pkgs . callPackage " ${ toString pkgs . path } / n i x o s / l i b / m a k e - i s o 9 6 6 0 - i m a g e . n i x " ( {
system . build . isoImage = pkgs . callPackage " ${ toString pkgs . path } / n i x o s / l i b / m a k e - i s o 9 6 6 0 - i m a g e . n i x " ( {
inherit ( config . isoImage ) isoName compressImage volumeID contents ;
inherit ( config . isoImage ) isoName compressImage volumeID contents ;
bootable = config . isoImage . makeBiosBootable ;
bootable = config . isoImage . makeBiosBootable ;
bootImage = " / i s o l i n u x / i s o l i n u x . b i n " ;
bootImage = " / i s o l i n u x / i s o l i n u x . b i n " ;
syslinux = if config . isoImage . makeBiosBootable then pkgs . syslinux else null ;
syslinux =
squashfsContents = config . isoImage . storeContents ;
if config . isoImage . makeBiosBootable
squashfsCompression = config . isoImage . squashfsCompression ;
then pkgs . syslinux
} // optionalAttrs ( config . isoImage . makeUsbBootable && config . isoImage . makeBiosBootable ) {
else null ;
usbBootable = true ;
squashfsContents = config . isoImage . storeContents ;
isohybridMbrImage = " ${ pkgs . syslinux } / s h a r e / s y s l i n u x / i s o h d p f x . b i n " ;
squashfsCompression = config . isoImage . squashfsCompression ;
} // optionalAttrs config . isoImage . makeEfiBootable {
}
efiBootable = true ;
// optionalAttrs ( config . isoImage . makeUsbBootable && config . isoImage . makeBiosBootable ) {
efiBootImage = " b o o t / e f i . i m g " ;
usbBootable = true ;
} ) ;
isohybridMbrImage = " ${ pkgs . syslinux } / s h a r e / s y s l i n u x / i s o h d p f x . b i n " ;
}
// optionalAttrs config . isoImage . makeEfiBootable {
efiBootable = true ;
efiBootImage = " b o o t / e f i . i m g " ;
} ) ;
boot . postBootCommands =
boot . postBootCommands = ''
''
# A f t e r b o o t i n g , r e g i s t e r t h e c o n t e n t s o f t h e N i x s t o r e o n t h e
# A f t e r b o o t i n g , r e g i s t e r t h e c o n t e n t s o f t h e N ix s t o r e o n t h e
# C D i n t h e N i x d a t a b a s e i n t h e t m p f s .
# C D i n t h e N i x d a t a b a s e i n t h e t m p f s .
${ config . nix . package . out } / b i n / n i x - s t o r e - - l o a d - d b < / n i x / s t o r e / n i x - p a t h - r e g i s t r a t i o n
${ config . nix . package . out } / b i n / n i x - s t o r e - - l o a d - d b < / n i x / s t o r e / n i x - p a t h - r e g i s t r a t i o n
# n i x o s - r e b u i l d a l s o r e q u i r e s a " s y s t e m " p r o f i l e a n d a n
# n i x o s - r e b u i l d a l s o r e q u i r e s a " s y s t e m " p r o f i l e a n d a n
# / e t c / N I X O S t a g .
# / e t c / N I X O S t a g .
to u c h / e t c / N I X O S
t o u c h / e t c / N I X O S
${ config . nix . package . out } / b i n / n i x - e n v - p / n i x / v a r / n i x / p r o f i l e s / s y s t e m - - s e t / r u n / c u r r e n t - s y s t e m
${ config . nix . package . out } / b i n / n i x - e n v - p / n i x / v a r / n i x / p r o f i l e s / s y s t e m - - s e t / r u n / c u r r e n t - s y s t e m
'';
'' ;
# Add vfat support to the initrd to enable people to copy the
# Add vfat support to the initrd to enable people to copy the
# contents of the CD to a bootable USB stick.
# contents of the CD to a bootable USB stick.
boot . initrd . supportedFilesystems = [ " v f a t " ] ;
boot . initrd . supportedFilesystems = [ " v f a t " ] ;
} ;
} ;
}
}