9 Commits

Author SHA1 Message Date
ahtlon
a96b8f65c9 [disko]Force grub on legacy boot
Some checks failed
Check flake syntax / flake-check (push) Waiting to run
Evaluate Hydra Jobs / eval-hydra-jobs (push) Has been cancelled
Evaluate Hydra Jobs / eval-hydra-jobs (pull_request) Has been cancelled
Check flake syntax / flake-check (pull_request) Has been cancelled
2025-01-19 17:59:29 +01:00
29d6bc02e0 Merge branch 'master' into issue31
Some checks failed
Evaluate Hydra Jobs / eval-hydra-jobs (pull_request) Successful in 3m41s
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 3m46s
Check flake syntax / flake-check (pull_request) Failing after 2m20s
Check flake syntax / flake-check (push) Failing after 2m15s
2025-01-18 22:57:21 +01:00
ahtlon
950ada1e10 [actions] Add flake check
All checks were successful
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 4m33s
Check flake syntax / flake-check (push) Successful in 7m30s
2025-01-18 22:24:21 +01:00
ahtlon
1e269966ff Merge branch 'fix-flake-check'
All checks were successful
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 5m54s
nix flake check and show now work again
2025-01-18 22:02:19 +01:00
ahtlon
3861daaf76 [modules] move microvm module import from makeMicroVM to baseModules 2025-01-18 22:01:06 +01:00
ahtlon
3a332e77d1 [scripts] move packages to legacyPackages 2025-01-18 21:45:48 +01:00
ahtlon
c0cef1ff1e Apply legacy to bakunin
Some checks failed
Evaluate Hydra Jobs / eval-hydra-jobs (push) Has been cancelled
Evaluate Hydra Jobs / eval-hydra-jobs (pull_request) Successful in 5m14s
2025-01-18 21:33:41 +01:00
ahtlon
7099c92236 [disko] add legacy option
I don't know if the grub device is right
2025-01-18 21:33:23 +01:00
ahtlon
79c311b45d Merge branch 'issue51'
All checks were successful
Evaluate Hydra Jobs / eval-hydra-jobs (push) Successful in 6m3s
Fixes #51
2025-01-18 20:41:06 +01:00
6 changed files with 226 additions and 188 deletions

View File

@@ -0,0 +1,15 @@
name: "Check flake syntax"
on:
pull_request:
push:
jobs:
flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies for Nix setup action
run: |
apt update -y
apt install sudo -y
- uses: cachix/install-nix-action@v27
- run: nix flake check --no-update-lock-file --accept-flake-config .

View File

@@ -26,6 +26,7 @@ in
malobeo.disks = { malobeo.disks = {
enable = true; enable = true;
legacy = true;
hostId = "a3c3102f"; hostId = "a3c3102f";
root = { root = {
disk0 = "disk/by-id/ata-HITACHI_HTS725016A9A364_110308PCKB04VNHX9XTJ"; disk0 = "disk/by-id/ata-HITACHI_HTS725016A9A364_110308PCKB04VNHX9XTJ";
@@ -33,9 +34,7 @@ in
}; };
malobeo.initssh = { malobeo.initssh = {
enable = true; enable = false;
authorizedKeys = sshKeys.admins;
ethernetDrivers = ["r8169"];
}; };
hardware.sane.enable = true; #scanner support hardware.sane.enable = true; #scanner support

View File

@@ -3,6 +3,7 @@
, nixpkgs , nixpkgs
, sops-nix , sops-nix
, inputs , inputs
, microvm
, nixos-hardware , nixos-hardware
, home-manager , home-manager
, ... , ...
@@ -34,15 +35,14 @@ let
}; };
}; };
}) })
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
microvm.nixosModules.microvm
]; ];
} }
]; ];
defaultModules = baseModules; defaultModules = baseModules;
makeMicroVM = hostName: ipv4Addr: macAddr: modules: [ makeMicroVM = hostName: ipv4Addr: macAddr: modules: [
inputs.microvm.nixosModules.microvm
{ {
microvm = { microvm = {
hypervisor = "cloud-hypervisor"; hypervisor = "cloud-hypervisor";

View File

@@ -20,6 +20,11 @@ in
default = true; default = true;
description = "Allows encryption to be disabled for testing"; description = "Allows encryption to be disabled for testing";
}; };
legacy = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable legacy boot (bios)";
};
devNodes = lib.mkOption { devNodes = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "/dev/disk/by-id/"; default = "/dev/disk/by-id/";
@@ -81,7 +86,25 @@ in
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkMerge [
(lib.mkIf (cfg.enable && !cfg.legacy) {
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
supportedFilesystems = [ "vfat" "zfs" ];
};
fileSystems."/boot".neededForBoot = true;
})
(lib.mkIf (cfg.enable && cfg.legacy) {
boot.loader.grub = {
enable = lib.mkForce true;
device = "/dev/${cfg.root.disk0}-part1";
efiSupport = false;
enableCryptodisk = cfg.encryption;
zfsSupport = true;
};
})
(lib.mkIf cfg.enable {
networking.hostId = cfg.hostId; networking.hostId = cfg.hostId;
disko.devices = { disko.devices = {
disk = lib.mkMerge [ disk = lib.mkMerge [
@@ -92,7 +115,7 @@ in
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
ESP = { ESP = lib.mkIf (!cfg.legacy) {
size = "1024M"; size = "1024M";
type = "EF00"; type = "EF00";
content = { content = {
@@ -102,6 +125,10 @@ in
mountOptions = [ "umask=0077" ]; mountOptions = [ "umask=0077" ];
}; };
}; };
boot = lib.mkIf cfg.legacy {
size = "1024M";
type = "EF02";
};
encryptedSwap = { encryptedSwap = {
size = cfg.root.swap; size = cfg.root.swap;
content = { content = {
@@ -270,9 +297,9 @@ in
fileSystems."/".neededForBoot = true; fileSystems."/".neededForBoot = true;
fileSystems."/etc".neededForBoot = true; fileSystems."/etc".neededForBoot = true;
fileSystems."/boot".neededForBoot = true;
fileSystems."/var".neededForBoot = true; fileSystems."/var".neededForBoot = true;
fileSystems."/home".neededForBoot = true; fileSystems."/home".neededForBoot = true;
fileSystems."/nix".neededForBoot = true; fileSystems."/nix".neededForBoot = true;
}; })
];
} }

View File

@@ -26,13 +26,9 @@ in
config = lib.mkIf (cfg.enable && config.malobeo.disks.encryption) { config = lib.mkIf (cfg.enable && config.malobeo.disks.encryption) {
boot = { boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
supportedFilesystems = [ "vfat" "zfs" ];
zfs = { zfs = {
forceImportAll = true; forceImportAll = true;
requestEncryptionCredentials = true; requestEncryptionCredentials = true;
}; };
initrd = { initrd = {
availableKernelModules = cfg.ethernetDrivers; availableKernelModules = cfg.ethernetDrivers;

View File

@@ -20,7 +20,7 @@ in (utils.lib.eachSystem (builtins.filter filter_system utils.lib.defaultSystems
let let
sops = sops-nix.packages."${pkgs.system}"; sops = sops-nix.packages."${pkgs.system}";
microvmpkg = microvm.packages."${pkgs.system}"; microvmpkg = microvm.packages."${pkgs.system}";
installed = builtins.attrNames self.packages."${pkgs.system}".scripts; installed = builtins.attrNames self.legacyPackages."${pkgs.system}".scripts;
in in
pkgs.mkShell { pkgs.mkShell {
sopsPGPKeyDirs = [ sopsPGPKeyDirs = [
@@ -38,13 +38,14 @@ in (utils.lib.eachSystem (builtins.filter filter_system utils.lib.defaultSystems
pkgs.mdbook pkgs.mdbook
microvmpkg.microvm microvmpkg.microvm
]; ];
packages = builtins.map (pkgName: self.packages."${pkgs.system}".scripts.${pkgName}) installed; packages = builtins.map (pkgName: self.legacyPackages."${pkgs.system}".scripts.${pkgName}) installed;
shellHook = ''echo "Available scripts: ${builtins.concatStringsSep " " installed}"''; shellHook = ''echo "Available scripts: ${builtins.concatStringsSep " " installed}"'';
}; };
legacyPackages = {
packages = {
scripts.remote-install = pkgs.writeShellScriptBin "remote-install" (builtins.readFile ./scripts/remote-install-encrypt.sh); scripts.remote-install = pkgs.writeShellScriptBin "remote-install" (builtins.readFile ./scripts/remote-install-encrypt.sh);
scripts.boot-unlock = pkgs.writeShellScriptBin "boot-unlock" (builtins.readFile ./scripts/unlock-boot.sh); scripts.boot-unlock = pkgs.writeShellScriptBin "boot-unlock" (builtins.readFile ./scripts/unlock-boot.sh);
};
packages = {
docs = pkgs.stdenv.mkDerivation { docs = pkgs.stdenv.mkDerivation {
name = "malobeo-docs"; name = "malobeo-docs";
phases = [ "buildPhase" ]; phases = [ "buildPhase" ];