-
-
Notifications
You must be signed in to change notification settings - Fork 83
use make-disk-image instead of sd-image #91
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
result |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ pkgs }: | ||
|
||
pkgs.substituteAll { | ||
src = ./atomic-copy-clobber.sh; | ||
isExecutable = true; | ||
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; | ||
inherit (pkgs) bash; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! @bash@/bin/sh -e | ||
|
||
# copy+paste of copyToKernelsDir https://github.com/NixOS/nixpkgs/blob/904ecf0b4e055dc465f5ae6574be2af8cc25dec3/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh#L53 | ||
# but without the check which skips the copy if the destination exists | ||
|
||
shopt -s nullglob | ||
|
||
export PATH=/empty | ||
for i in @path@; do PATH=$PATH:$i/bin; done | ||
|
||
src=$(readlink -f "$1") | ||
dst="$2" | ||
|
||
# Create $dst atomically to prevent partially copied files | ||
# if this script is ever interrupted. | ||
dstTmp=$dst.tmp.$$ | ||
cp -r $src $dstTmp | ||
mv $dstTmp $dst |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ pkgs }: | ||
|
||
pkgs.substituteAll { | ||
src = ./atomic-copy-safe.sh; | ||
isExecutable = true; | ||
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; | ||
inherit (pkgs) bash; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! @bash@/bin/sh -e | ||
|
||
# copy+paste of copyToKernelsDir https://github.com/NixOS/nixpkgs/blob/904ecf0b4e055dc465f5ae6574be2af8cc25dec3/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh#L53 | ||
|
||
shopt -s nullglob | ||
|
||
export PATH=/empty | ||
for i in @path@; do PATH=$PATH:$i/bin; done | ||
|
||
src=$(readlink -f "$1") | ||
dst="$2" | ||
|
||
# Don't copy the file if $dst already exists. | ||
# Also create $dst atomically to prevent partially copied files | ||
# if this script is ever interrupted. | ||
if ! test -e $dst; then | ||
dstTmp=$dst.tmp.$$ | ||
cp -r $src $dstTmp | ||
mv $dstTmp $dst | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ config, inputs, lib, modulesPath, pkgs, ... }: { | ||
time.timeZone = "America/New_York"; | ||
users.users.root.initialPassword = "root"; | ||
networking = { | ||
hostName = "example"; | ||
useDHCP = false; | ||
interfaces = { | ||
wlan0.useDHCP = true; | ||
eth0.useDHCP = true; | ||
}; | ||
}; | ||
raspberry-pi-nix = { | ||
board = "bcm2711"; | ||
}; | ||
hardware = { | ||
raspberry-pi = { | ||
config = { | ||
all = { | ||
base-dt-params = { | ||
BOOT_UART = { | ||
value = 1; | ||
enable = true; | ||
}; | ||
uart_2ndstage = { | ||
value = 1; | ||
enable = true; | ||
}; | ||
}; | ||
dt-overlays = { | ||
disable-bt = { | ||
enable = true; | ||
params = { }; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
security.rtkit.enable = true; | ||
services.pipewire = { | ||
enable = true; | ||
alsa.enable = true; | ||
alsa.support32Bit = true; | ||
pulse.enable = true; | ||
}; | ||
fileSystems = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tstat you said:
You'll notice that There's a parallel discussion in nix-community/disko#550 about using This doesn't mean that there aren't assumptions made - the To talk a little more about this |
||
"/boot" = { | ||
device = "/dev/disk/by-label/ESP"; | ||
fsType = "vfat"; | ||
}; | ||
"/" = { | ||
device = "/dev/disk/by-label/nixos"; | ||
fsType = "ext4"; | ||
autoResize = true; | ||
}; | ||
}; | ||
boot.growPartition = true; | ||
system.build.image = (import "${toString modulesPath}/../lib/make-disk-image.nix" { | ||
inherit lib config pkgs; | ||
format = "raw"; | ||
partitionTableType = "efi"; | ||
copyChannel = false; | ||
diskSize = "auto"; | ||
additionalSpace = "64M"; | ||
bootSize = "128M"; | ||
touchEFIVars = false; | ||
installBootLoader = true; | ||
label = "nixos"; | ||
deterministic = true; | ||
}); | ||
|
||
nix.settings.substituters = lib.mkForce config.nix.settings.trusted-substituters; | ||
nix.settings.trusted-substituters = [ | ||
"https://cache.nixos.org/" | ||
"https://nix-community.cachix.org" | ||
]; | ||
nix.settings.trusted-public-keys = [ | ||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" | ||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" | ||
]; | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ config, inputs, lib, modulesPath, pkgs, ... }: { | ||
imports = [ | ||
./common.nix | ||
]; | ||
raspberry-pi-nix.uboot.enable = false; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ config, inputs, lib, modulesPath, pkgs, ... }: { | ||
imports = [ | ||
./common.nix | ||
]; | ||
raspberry-pi-nix.uboot.enable = true; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Copied from: | ||
|
||
https://github.com/NixOS/nixpkgs/blob/93fb96ecdead26092b8425383fffb0422bf52182/nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix | ||
|
||
The goal is to merge the changes back in once tested. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ ... }: { | ||
imports = [ ./generic-extlinux-compatible.nix ]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ pkgs }: | ||
|
||
pkgs.substituteAll { | ||
src = ./extlinux-conf-builder.sh; | ||
isExecutable = true; | ||
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; | ||
inherit (pkgs) bash; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tstat you said:
This line moves the files into the right place after they've been copied to the boot filesystem. Notice line 16 though - the file won't be copied if it already exists at the destination. This is copied from the
generic-extlinux-compatible
shell script. A modified versionatomic-copy-clobber.sh
does the same but overwrites the file, which is used forconfig.txt
andcmdline.txt
. Is this in line with what you mean?