Skip to content

Commit a5a9bda

Browse files
committed
Use efi; fix nixinate; fix automount
1 parent bdba72e commit a5a9bda

File tree

4 files changed

+108
-29
lines changed

4 files changed

+108
-29
lines changed

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ qcow: qcow-build qcow-copy
1010
#time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --eval-store auto --store 'ssh-ng://$(BUILD_STORE)' --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
1111
# IMG_PATH=$(shell cat $(BUILD_OUT_FILE) | jq .[].outputs.out -r ); [ ! -z "$$IMG_PATH" ] && time scp $(BUILD_STORE):"$$IMG_PATH/"*.qcow2 ./"$(TARGET).qcow2"
1212
#time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --eval-store auto --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
13+
#time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --eval-store auto --store 'ssh-ng://$(BUILD_STORE)' --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
14+
1315
qcow-build: ensure-target
14-
time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow --json -L | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
16+
time nix build .#nixosConfigurations.$(TARGET).config.formats.qcow-efi --json --print-build-logs --verbose | tee $(BUILD_OUT_FILE); exit "$${PIPESTATUS[0]}"
1517
qcow-copy: ensure-target
1618
[ -f "./result/nixos.qcow2" ] && rm -f ./_utm/"$(TARGET).qcow2" && cp -L "./result/nixos.qcow2" ./_utm/"$(TARGET).qcow2"
1719
utm-rebuild
1820

1921
deploy: ensure-target
20-
time nix run .#apps.nixinate.$(TARGET)
22+
time nix run .#nixinate.$(TARGET)
2123

2224
################################################################################
2325
# Helpers

flake.lock

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

flake.nix

+81-26
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
nixinate = {
1515
# url = "github:MatthewCroughan/nixinate";
16-
url = "github:J-Swift/nixinate/feature/allow-ssh-config-hostnames";
16+
url = "github:J-Swift/nixinate/fix/macos-shm";
1717
inputs.nixpkgs.follows = "nixpkgs";
1818
};
1919
};
@@ -28,14 +28,16 @@
2828
apps = nixinate.nixinate.${eachSystem} self;
2929
devShell = import ./shell.nix { inherit pkgs; };
3030
}
31-
) // {
31+
) //
32+
{
3233
nixosConfigurations =
3334
let
3435
bato-system = "x86_64-linux";
35-
stateVersion = "23.11";
36+
hostname = "bato-nix";
37+
stateVersion = "24.11";
3638
in
3739
{
38-
bato-nix =
40+
${hostname} =
3941
let
4042
in nixpkgs.lib.nixosSystem
4143
rec {
@@ -49,17 +51,80 @@
4951

5052
modules = [
5153
{
54+
_module.args.nixinate = {
55+
host = "192.168.64.9";
56+
sshUser = "root";
57+
buildOn = "remote";
58+
substituteOnTarget = true;
59+
hermetic = false;
60+
};
61+
}
62+
63+
{
64+
imports = [
65+
nixos-generators.nixosModules.all-formats
66+
];
67+
}
68+
69+
# boot loader
70+
{
71+
boot.initrd.availableKernelModules = [ "xhci_pci" "uhci_hcd" "ehci_pci" "ahci" "usbhid" "sd_mod" ];
72+
boot.initrd.kernelModules = [ ];
73+
boot.kernelModules = [ ];
74+
boot.extraModulePackages = [ ];
75+
76+
boot.growPartition = true;
77+
78+
boot.loader.grub = {
79+
enable = true;
80+
device = "nodev";
81+
efiSupport = true;
82+
efiInstallAsRemovable = true;
83+
84+
useOSProber = false;
85+
configurationLimit = 10;
86+
};
87+
}
88+
89+
{
90+
fileSystems."/" = {
91+
device = "/dev/disk/by-label/nixos";
92+
fsType = "ext4";
93+
autoResize = true;
94+
};
95+
96+
fileSystems."/boot" = {
97+
device = "/dev/disk/by-label/ESP";
98+
fsType = "vfat";
99+
};
100+
101+
swapDevices = [ ];
102+
103+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
104+
# (the default) this is the recommended approach. When using systemd-networkd it's
105+
# still possible to use this option, but it's recommended to use it in conjunction
106+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
107+
networking.useDHCP = true;
108+
# networking.interfaces.enp0s1.useDHCP = lib.mkDefault true;
109+
110+
nixpkgs.hostPlatform = "x86_64-linux";
111+
112+
boot.loader.grub.enable = true;
113+
52114
system.stateVersion = stateVersion;
53115
boot.kernelPackages = pkgs.linuxPackages_6_10;
54116

55-
users.users.root.password = "linux";
117+
users.users.root = {
118+
password = "linux";
56119

57-
time.timeZone = "America/New_York";
58-
services.openssh = {
59-
enable = true;
60-
settings.PermitRootLogin = "yes";
120+
openssh.authorizedKeys.keys = [
121+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINpmysyMziDLKjj2Faps0jl0aTZETR67zlJmeuSLOR75 [email protected]"
122+
];
61123
};
62-
networking.hostName = "bato-nix";
124+
125+
services.openssh.enable = true;
126+
time.timeZone = "America/New_York";
127+
networking.hostName = hostname;
63128

64129
i18n.defaultLocale = "en_US.UTF-8";
65130

@@ -98,11 +163,11 @@
98163
what = "http://localhost:9843";
99164
where = "/mnt/utm-shared";
100165

101-
wantedBy = [ "multi-user.target" ];
166+
after = [ "network-online.target" ];
167+
wants = [ "network-online.target" ];
102168

103169
type = "davfs";
104-
# options = "noauto,_netdev,x-systemd.automount,cache=none,credentials=/etc/davfs${secretsPath}/cifs-credentials.txt";
105-
options = "noauto,x-systemd.automount";
170+
options = "x-systemd.automount";
106171

107172
mountConfig = {
108173
DirectoryMode = "0777";
@@ -115,11 +180,9 @@
115180
{
116181
where = "/mnt/utm-shared";
117182

118-
after = [ "remote-fs-pre.target" ];
119-
wants = [ "remote-fs-pre.target" ];
120-
conflicts = [ "umount.target" ];
121-
before = [ "umount.target" ];
122-
wantedBy = [ "remote-fs.target" ];
183+
after = [ "network-online.target" ];
184+
wants = [ "network-online.target" ];
185+
wantedBy = [ "multi-user.target" ];
123186

124187
unitConfig = {
125188
DefaultDependencies = "no";
@@ -133,14 +196,6 @@
133196
];
134197
}
135198

136-
{
137-
imports = [
138-
nixos-generators.nixosModules.all-formats
139-
];
140-
141-
formatConfigs.qcow = { config, lib, ... }: { };
142-
}
143-
144199
{
145200
services.displayManager.autoLogin = {
146201
enable = true;

shell.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let
1616
set baseVm to virtual machine named "bato-base"
1717
set qcow to POSIX file "/Users/jimmy/Developer/bato-nix/_utm/bato-nix.qcow2"
1818
19-
duplicate baseVm with properties {configuration:{name:"bato-nix", architecture:"x86_64", uefi:false, drives:{{source:qcow}}}}
19+
duplicate baseVm with properties {configuration:{name:"bato-nix", architecture:"x86_64", uefi:true, drives:{{source:qcow}}}}
2020
end tell
2121
'';
2222
in

0 commit comments

Comments
 (0)