feat: move capella to nix-on-droid

This commit is contained in:
tux
2025-05-08 23:13:22 +05:30
parent f7ccfbf112
commit 60893ab742
4 changed files with 80 additions and 154 deletions

View File

@ -66,7 +66,6 @@
alpha = nixosSystem (mkNixOSConfig "alpha"); alpha = nixosSystem (mkNixOSConfig "alpha");
sirius = nixosSystem (mkNixOSConfig "sirius"); sirius = nixosSystem (mkNixOSConfig "sirius");
vega = nixosSystem (mkNixOSConfig "vega"); vega = nixosSystem (mkNixOSConfig "vega");
capella = nixosSystem (mkNixOSConfig "capella");
vps = nixosSystem (mkNixOSConfig "vps"); vps = nixosSystem (mkNixOSConfig "vps");
isoImage = nixosSystem (mkNixOSConfig "isoImage"); isoImage = nixosSystem (mkNixOSConfig "isoImage");
homelab = nixosSystem (mkNixOSConfig "homelab"); homelab = nixosSystem (mkNixOSConfig "homelab");
@ -75,6 +74,7 @@
# NixOnDroid configuration entrypoint # NixOnDroid configuration entrypoint
# 'nix-on-droid switch --flake .#your-hostname' # 'nix-on-droid switch --flake .#your-hostname'
nixOnDroidConfigurations = { nixOnDroidConfigurations = {
capella = nixOnDroidConfiguration (mkDroidConfig "capella");
rigel = nixOnDroidConfiguration (mkDroidConfig "rigel"); rigel = nixOnDroidConfiguration (mkDroidConfig "rigel");
}; };
@ -85,8 +85,8 @@
alpha = mkNixOSNode "alpha"; alpha = mkNixOSNode "alpha";
sirius = mkNixOSNode "sirius"; sirius = mkNixOSNode "sirius";
vega = mkNixOSNode "vega"; vega = mkNixOSNode "vega";
capella = mkNixOSNode "capella";
homelab = mkNixOSNode "homelab"; homelab = mkNixOSNode "homelab";
capella = mkDroidNode "capella";
rigel = mkDroidNode "rigel"; rigel = mkDroidNode "rigel";
}; };
}; };

View File

@ -1,104 +1,63 @@
{ {
modulesPath, pkgs,
inputs,
username, username,
lib, outputs,
inputs,
email,
... ...
}: { }: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") ../../modules/droid/sshd.nix
(modulesPath + "/profiles/qemu-guest.nix")
inputs.disko.nixosModules.default
(import ./disko.nix {device = "/dev/vda";})
../common
]; ];
tux.services.openssh.enable = true; android-integration.am.enable = true;
android-integration.termux-open-url.enable = true;
android-integration.xdg-open.enable = true;
android-integration.termux-setup-storage.enable = true;
android-integration.termux-reload-settings.enable = true;
nixpkgs = { terminal.font = let
hostPlatform = "x86_64-linux"; firacode = pkgs.nerd-fonts.fira-code;
}; fontPath = "share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf";
in "${firacode}/${fontPath}";
boot = { time.timeZone = "Asia/Kolkata";
initrd.systemd = {
enable = lib.mkForce true;
services.wipe-my-fs = { tux.services.openssh = {
wantedBy = ["initrd.target"]; enable = true;
after = ["initrd-root-device.target"]; ports = [8022];
before = ["sysroot.mount"]; authorizedKeys = [
unitConfig.DefaultDependencies = "no"; "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${email}"
serviceConfig.Type = "oneshot";
script = ''
mkdir /btrfs_tmp
mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
};
};
loader = {
grub = {
efiSupport = true;
efiInstallAsRemovable = true;
};
};
};
networking = {
hostName = "capella";
firewall.enable = false;
};
users = {
users.${username} = {
password = "${username}";
hashedPasswordFile = lib.mkForce null;
};
};
programs.fuse.userAllowOther = true;
fileSystems."/persist".neededForBoot = true;
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/var/log"
"/var/lib/nixos"
];
files = [
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
]; ];
}; };
home-manager.users.${username} = { user = {
imports = [ uid = 10479;
./home.nix gid = 10479;
]; shell = "${pkgs.zsh}/bin/zsh";
}; };
system.stateVersion = "24.11"; environment.etcBackupExtension = ".backup";
environment.motd = '''';
environment.packages = with pkgs; [
nano
git
neovim
openssh
inputs.trok.packages."aarch64-linux".default
];
home-manager = {
config = ./home.nix;
backupFileExtension = "backup";
extraSpecialArgs = {inherit inputs outputs username email;};
useGlobalPkgs = true;
};
# Set up nix for flakes
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
system.stateVersion = "24.05";
} }

View File

@ -1,53 +0,0 @@
{device ? throw "Set this to the disk device, e.g. /dev/nvme0n1", ...}: {
disko.devices.disk.primary = {
inherit device;
type = "disk";
content = {
type = "gpt"; # GPT partitioning scheme
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
# EFI Partition
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["defaults" "umask=0077"];
};
};
# Btrfs Root Partition
root = {
size = "100%"; # Use remaining space
type = "8300"; # Linux filesystem type
content = {
type = "btrfs";
subvolumes = {
"/root" = {
mountOptions = ["compress=zstd"]; # Compression for better performance
mountpoint = "/"; # Root subvolume
};
"/persist" = {
mountOptions = ["compress=zstd"]; # Compression for persistent data
mountpoint = "/persist"; # Persistent subvolume
};
"/nix" = {
mountOptions = [
"compress=zstd"
"noatime"
"noacl"
]; # Optimize for Nix store
mountpoint = "/nix"; # Nix subvolume
};
};
};
};
};
};
};
}

View File

@ -1,14 +1,34 @@
{username, ...}: { {pkgs, ...}: {
home.persistence."/persist/home/${username}" = { imports = [
directories = [ ../../modules/home/git
"Projects" ../../modules/home/starship
".ssh" ];
];
files = [ programs = {
".zsh_history" bat.enable = true;
]; zoxide = {
allowOther = true; enable = true;
options = ["--cmd cd"];
};
zsh = {
enable = true;
shellAliases = {
ls = "lsd";
};
syntaxHighlighting.enable = true;
autosuggestion.enable = true;
initContent = ''
fastfetch
'';
};
}; };
home.stateVersion = "24.11"; home.packages = with pkgs; [
neovim
busybox
lsd
fastfetch
];
home.stateVersion = "24.05";
} }