diff --git a/base.nix b/base.nix index 8e50f03..2c1076a 100644 --- a/base.nix +++ b/base.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { imports = [ ./modules/system_overrides.nix ./modules/minimize.nix @@ -8,6 +7,5 @@ ./modules/partitions.nix ./modules/network.nix ./modules/sysupdate.nix - ./modules/utils.nix ]; } diff --git a/justfile b/justfile index 1a1b7a8..cd8f0fd 100644 --- a/justfile +++ b/justfile @@ -14,7 +14,3 @@ build: build-image # Build PatOS image build-image: nix build .#patos_image - -run: build-image - qemu-efi -hda ./result/disk.qcow2 - diff --git a/modules/generic.nix b/modules/generic.nix index 1f42ec6..00058ef 100644 --- a/modules/generic.nix +++ b/modules/generic.nix @@ -1,24 +1,13 @@ -{ - pkgs, - config, - lib, - ... -}: -{ +{ pkgs, config, ... }: { - boot = { - uki.name = "patos"; - kernelParams = [ "console=ttyS0" ]; - initrd.systemd.enable = true; - }; + boot.uki.name = "patos"; + boot.kernelParams = [ "console=ttyS0" ]; - system.nixos = { - codeName = "Finn"; - distroId = "patos"; - distroName = "PatOS"; - release = "2024-09"; - }; + system.nixos.release = "2024-09"; + system.nixos.codeName = "Finn"; + system.nixos.distroId = "patos"; + system.nixos.distroName = "PatOS"; system.image.version = "0.0.1"; # FIXME: Use epoch version. # Make the current system version visible in the prompt. @@ -31,6 +20,8 @@ services.getty.autologinUser = "root"; + boot.initrd.systemd.enable = true; + # Don't accumulate crap. boot.tmp.cleanOnBoot = true; services.journald.extraConfig = '' diff --git a/modules/minimize.nix b/modules/minimize.nix index 2bc8cff..1e62db1 100644 --- a/modules/minimize.nix +++ b/modules/minimize.nix @@ -1,10 +1,8 @@ -{ modulesPath, ... }: -{ +{ modulesPath, ... }: { imports = [ "${modulesPath}/profiles/minimal.nix" ]; - boot.enableContainers = false; boot.loader.grub.enable = false; system.switch.enable = false; @@ -16,5 +14,6 @@ system.disableInstallerTools = true; programs.less.lessopen = null; programs.command-not-found.enable = false; + boot.enableContainers = false; environment.defaultPackages = [ ]; } diff --git a/modules/partitions.nix b/modules/partitions.nix index 0510348..c900c24 100644 --- a/modules/partitions.nix +++ b/modules/partitions.nix @@ -1,11 +1,4 @@ -{ - config, - pkgs, - lib, - modulesPath, - ... -}: -{ +{ config, pkgs, lib, modulesPath, ... }: { imports = [ "${modulesPath}/image/repart.nix" @@ -22,16 +15,16 @@ partitions = { "esp" = { contents = { - "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; + "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = + "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; - "/EFI/Linux/${config.system.boot.loader.ukiFile}".source = "${config.system.build.uki}/${config.system.boot.loader.ukiFile}"; + "/EFI/Linux/${config.system.boot.loader.ukiFile}".source = + "${config.system.build.uki}/${config.system.boot.loader.ukiFile}"; # systemd-boot configuration - "/loader/loader.conf".source = ( - pkgs.writeText "$out" '' - timeout 3 - '' - ); + "/loader/loader.conf".source = (pkgs.writeText "$out" '' + timeout 3 + ''); }; repartConfig = { Type = "esp"; @@ -46,7 +39,7 @@ stripNixStorePrefix = true; repartConfig = { Type = "linux-generic"; - Label = "${config.boot.uki.name}_${config.system.image.version}"; + Label = "store_${config.system.image.version}"; Format = "squashfs"; Minimize = "off"; ReadOnly = "yes"; diff --git a/modules/sysupdate.nix b/modules/sysupdate.nix index 8f126e8..6a7b4f5 100644 --- a/modules/sysupdate.nix +++ b/modules/sysupdate.nix @@ -37,7 +37,9 @@ in "${config.boot.uki.name}_@v.efi.xz" ]; - Path = "https://images.dl.patagia.dev/patos/"; + # We could fetch updates from the network as well: + # + Path = "https://images.dl.patagia.dev/"; Type = "url-file"; }; Target = { @@ -62,7 +64,7 @@ in MatchPattern = [ "${config.boot.uki.name}_@v.img.xz" ]; - Path = "https://images.dl.patagia.dev/patos/"; + Path = "https://images.dl.patagia.dev/"; Type = "url-file"; }; diff --git a/modules/utils.nix b/modules/utils.nix deleted file mode 100644 index 9fbad21..0000000 --- a/modules/utils.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - script = pkgs.writeShellScriptBin "patos-upgrade.sh" '' - systemd-sysupdate --verify=no - systemd-sysupdate --verify=no update --reboot - ''; -in -{ - environment.systemPackages = [ script ]; -}