diff --git a/flake-parts/merge-after-ci/default.nix b/flake-parts/merge-after-ci/default.nix index 0c8d8a5e..96fa5666 100644 --- a/flake-parts/merge-after-ci/default.nix +++ b/flake-parts/merge-after-ci/default.nix @@ -1,26 +1,25 @@ { perSystem = - { config - , pkgs + { pkgs , self' , ... }: let name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ + script = pkgs.writeShellApplication { + inherit name; + runtimeInputs = [ pkgs.bash pkgs.coreutils pkgs.git pkgs.tea pkgs.openssh self'.packages.tea-create-pr - ] - '' - export EDITOR=${pkgs.vim}/bin/vim + ]; + text = '' bash ${./script.sh} "$@" ''; + }; in { packages.${name} = script; diff --git a/flake-parts/packages.nix b/flake-parts/packages.nix index 7b6c70af..c379078e 100644 --- a/flake-parts/packages.nix +++ b/flake-parts/packages.nix @@ -6,11 +6,12 @@ modules = [ self.nixosModules.installer self.inputs.nixos-generators.nixosModules.all-formats + self.inputs.disko.nixosModules.disko ]; }; in { - install-iso = installer.config.formats.install-iso; + install-iso = self.inputs.disko.lib.lib.makeDiskImage { nixosConfig = installer; }; install-vm-nogui = installer.config.formats.vm-nogui; install-vm = installer.config.formats.vm; }; diff --git a/flake-parts/tea-create-pr/default.nix b/flake-parts/tea-create-pr/default.nix index c2c7df2e..e4160cd7 100644 --- a/flake-parts/tea-create-pr/default.nix +++ b/flake-parts/tea-create-pr/default.nix @@ -1,24 +1,24 @@ { perSystem = - { config - , pkgs + { pkgs , ... }: let name = builtins.baseNameOf ./.; - script = config.writers.writePureShellScriptBin - name - [ + script = pkgs.writeShellApplication { + inherit name; + runtimeInputs = [ pkgs.bash pkgs.coreutils pkgs.git pkgs.tea pkgs.openssh - ] - '' + ]; + text = '' export EDITOR=${pkgs.vim}/bin/vim bash ${./script.sh} "$@" ''; + }; in { packages.${name} = script; diff --git a/flake.lock b/flake.lock index d230d18a..23167f53 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690548222, + "narHash": "sha256-EcVjLOpbAuL/y55fLlEl3BNM4FP5Pwtp+6DbTiL6FDM=", + "owner": "nix-community", + "repo": "disko", + "rev": "43f17a8b31c49f6696b8b258d317161afdc7e36b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -74,6 +94,7 @@ }, "root": { "inputs": { + "disko": "disko", "flake-parts": "flake-parts", "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index 2644215f..9e9f9057 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,8 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; nixos-generators.url = "github:nix-community/nixos-generators"; nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts"; diff --git a/modules/installer.nix b/modules/installer.nix index b1aa8154..e691c8ed 100644 --- a/modules/installer.nix +++ b/modules/installer.nix @@ -1,10 +1,16 @@ { lib , pkgs +, modulesPath , ... }: { systemd.tmpfiles.rules = [ "d /var/shared 0777 root root - -" ]; + imports = [ + (modulesPath + "/profiles/installation-device.nix") + (modulesPath + "/profiles/all-hardware.nix") + (modulesPath + "/profiles/base.nix") + ]; services.openssh.settings.PermitRootLogin = "yes"; system.activationScripts.root-password = '' mkdir -p /var/shared @@ -34,7 +40,41 @@ cat /var/shared/qrcode.utf8 fi ''; - formatConfigs.install-iso = { - isoImage.squashfsCompression = "zstd -Xcompression-level 1"; + boot.loader.grub.efiInstallAsRemovable = true; + boot.loader.grub.efiSupport = true; + disko.devices = { + disk = { + stick = { + type = "disk"; + device = "/vda"; + imageSize = "3G"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; # for grub MBR + }; + ESP = { + size = "100M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; }; }