File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 24
24
util-linux
25
25
] ;
26
26
preVM = ''
27
- ${ lib . concatMapStringsSep "\n " ( disk : "truncate -s ${ disk . imageSize } ${ disk . name } .raw" ) ( lib . attrValues nixosConfig . config . disko . devices . disk ) }
27
+ export PATH=$PATH:${ lib . makeBinPath ( with pkgs ; [ nix jq ] ) }
28
+ export NIX_STATE_DIR=$TMPDIR/state
29
+ export NIX_CONFIG="experimental-features = nix-command"
30
+ nix-store --load-db < ${ pkgs . closureInfo {
31
+ rootPaths = [ systemToInstall . config . system . build . toplevel ] ;
32
+ } } /registration
33
+
34
+ ${ lib . concatMapStringsSep "\n " ( disk : "truncate -s $(($(set -x; nix path-info --json ${ systemToInstall . config . system . build . toplevel } | jq .[].closureSize) + ${ toString disk . imageSizeExtraBytes } )) ${ disk . name } .raw" ) ( lib . attrValues nixosConfig . config . disko . devices . disk ) }
28
35
'' ;
29
36
postVM = ''
30
37
# shellcheck disable=SC2154
Original file line number Diff line number Diff line change 16
16
type = diskoLib . optionTypes . absolute-pathname ; # TODO check if subpath of /dev ? - No! eg: /.swapfile
17
17
description = "Device path" ;
18
18
} ;
19
- imageSize = lib . mkOption {
20
- type = lib . types . strMatching "[0-9]+[KMGTP]?" ;
19
+ imageSizeExtraBytes = lib . mkOption {
20
+ type = lib . types . int ;
21
21
description = ''
22
- size of the image if the makeDiskImages function from diksoLib is used.
23
- is used as an argument to truncate -s
22
+ extra size in bytes to add to the end of the disk image if the makeDiskImages function from diksoLib is used.
23
+ This is used as an argument to truncate -s
24
24
'' ;
25
- default = "2G" ;
25
+ default = 2000000000 ;
26
26
} ;
27
27
content = diskoLib . deviceType { parent = config ; device = config . device ; } ;
28
28
_meta = lib . mkOption {
You can’t perform that action at this time.
0 commit comments