termux setup

This commit is contained in:
2026-08-06 22:57:19 +03:00
parent 1856f9e4fd
commit af90756661
7 changed files with 102 additions and 82 deletions
+6
View File
@@ -9,4 +9,10 @@
sapphira = import ./server.nix flakeContext; # sapphira sapphira = import ./server.nix flakeContext; # sapphira
wsl = import ./wsl.nix flakeContext; # wsl wsl = import ./wsl.nix flakeContext; # wsl
}; };
nixOnDroidConfigurations = {
epral = import ./mobile.nix flakeContext; # epral (Android via nix-on-droid)
# Alias so a plain `nix-on-droid switch` from a local clone
# (~/.config/nix-on-droid) picks up the device config without `#epral`.
default = import ./mobile.nix flakeContext;
};
} }
+19 -13
View File
@@ -18,7 +18,7 @@ let
}: }:
{ {
imports = [ imports = [
inputs.self.nixosModules.default # base defaultModule (termux-trimmed) inputs.self.nixosModules.strict
]; ];
xlib.device = { xlib.device = {
@@ -44,25 +44,26 @@ let
nano nano
# Some common stuff that people expect to have # Some common stuff that people expect to have
openssh bzip2
treefmt
git
procps
psmisc # provides killall (attr `killall` was removed from nixpkgs)
diffutils diffutils
findutils findutils
util-linux # renamed from utillinux git
tzdata
hostname
man
gnugrep gnugrep
gnupg gnupg
gnused gnused
gnutar gnutar
bzip2
gzip gzip
zip hostname
man
ncurses
openssh
procps
psmisc # provides killall (attr `killall` was removed from nixpkgs)
treefmt
tzdata
unzip unzip
util-linux # renamed from utillinux
zip
]; ];
# Backup etc files instead of failing to activate generation if a file already exists in /etc # Backup etc files instead of failing to activate generation if a file already exists in /etc
@@ -71,12 +72,17 @@ let
# Shared userspace home-manager config (same cozy shell as on NixOS hosts). # Shared userspace home-manager config (same cozy shell as on NixOS hosts).
# nix-on-droid forces home.username / home.homeDirectory from user.*, # nix-on-droid forces home.username / home.homeDirectory from user.*,
# so the strict module must not set them. # so the strict module must not set them.
# xlib is injected via home-manager.extraSpecialArgs (the HM submodule
# does not inherit the nix-on-droid module args).
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
backupFileExtension = "hm-bak"; backupFileExtension = "hm-bak";
extraSpecialArgs = {
inherit xlib;
};
config = { ... }: { config = { ... }: {
imports = [ imports = [
../home/shared/strict.nix ../home/termux.nix
]; ];
home.stateVersion = "24.05"; home.stateVersion = "24.05";
}; };
-9
View File
@@ -1,9 +0,0 @@
{ inputs, ... }@flakeContext:
{
nixOnDroidConfigurations = {
epral = import ./epral.nix flakeContext; # epral (Android via nix-on-droid)
# Alias so a plain `nix-on-droid switch` from a local clone
# (~/.config/nix-on-droid) picks up the device config without `#epral`.
default = import ./epral.nix flakeContext;
};
}
-1
View File
@@ -120,7 +120,6 @@
} }
// (import ./configurations flakeContext) // (import ./configurations flakeContext)
// (import ./deploy flakeContext) // (import ./deploy flakeContext)
// (import ./droid flakeContext)
// (import ./home flakeContext) // (import ./home flakeContext)
// (import ./modules flakeContext) // (import ./modules flakeContext)
// (import ./overlays flakeContext) // (import ./overlays flakeContext)
+38 -36
View File
@@ -2,6 +2,7 @@
config, config,
lib, lib,
pkgs, pkgs,
xlib,
... ...
}: }:
# Shared "strict" home-manager module. # Shared "strict" home-manager module.
@@ -17,46 +18,45 @@
# (which stay NixOS-only for now). When this module is wired into NixOS hosts # (which stay NixOS-only for now). When this module is wired into NixOS hosts
# via sharedModules, deduplicate those files. # via sharedModules, deduplicate those files.
{ {
home.packages = with pkgs; [ home = {
# Lazy (alias lc) packages = with pkgs; [
lazycli # Lazy (alias lc)
lazycli
# IDE # IDE
fresh-editor # EDITOR fresh-editor # EDITOR
# Base utils # Base utils
curl curl
wget wget
fd fd
tree tree
dust dust
gdu gdu
mc mc
rsync rsync
jq jq
unzip unzip
zip zip
zstd zstd
# Net diagnostic # Net diagnostic
mtr mtr
dnsutils dnsutils
# Monitoring # Monitoring
htop htop
]; ];
sessionVariables = {
home.sessionVariables = { TUCKR_HOME = "$HOME/Storage/dotfiles";
TUCKR_HOME = "$HOME/Storage/dotfiles"; EDITOR = "fresh";
EDITOR = "fresh"; };
file.".nanorc".text = ''
set nowrap
set tabstospaces
set tabsize 2
'';
}; };
home.file.".nanorc".text = ''
set nowrap
set tabstospaces
set tabsize 2
'';
programs = { programs = {
# ---- Shell: zsh ---- # ---- Shell: zsh ----
zsh = { zsh = {
@@ -90,6 +90,7 @@
lg = "lazygit"; lg = "lazygit";
lc = "lazycli"; lc = "lazycli";
gp = "git pull"; gp = "git pull";
ns = "nix-on-droid switch --flake ~/.config/nix-on-droid#${xlib.device.hostname}";
gp-ns = "gp && ns"; gp-ns = "gp && ns";
gc = "git add . && git commit -m 'dev: автокоммит $(date +'%Y-%m-%d %H:%M:%S')'"; gc = "git add . && git commit -m 'dev: автокоммит $(date +'%Y-%m-%d %H:%M:%S')'";
y = "yazi"; y = "yazi";
@@ -97,7 +98,8 @@
beet-path-library = "realpath --relative-to='${config.home.homeDirectory}/.config/beets/My' ."; beet-path-library = "realpath --relative-to='${config.home.homeDirectory}/.config/beets/My' .";
z-proxy = "export ALL_PROXY=socks5://localhost:10808"; z-proxy = "export ALL_PROXY=socks5://localhost:10808";
zh-proxy = "export HTTPS_PROXY=http://localhost:10808 && export HTTP_PROXY=http://localhost:10808"; zh-proxy = "export HTTPS_PROXY=http://localhost:10808 && export HTTP_PROXY=http://localhost:10808";
nix-dir = "cd ~/.config/nix-on-droid";
# beets # beets
beet-ima = "beet im ./ -A"; beet-ima = "beet im ./ -A";
+38 -22
View File
@@ -12,29 +12,22 @@ let
# NixOS-only modules. termux runs nix-on-droid (its own module system, # NixOS-only modules. termux runs nix-on-droid (its own module system,
# class = "nixOnDroid"): options like services.*, users.*, sops.*, disko.* # class = "nixOnDroid"): options like services.*, users.*, sops.*, disko.*
# and nixpkgs.overlays (flake assertion) do not exist there. # and nixpkgs.overlays (flake assertion) do not exist there.
imports = imports = with inputs; [
with inputs; ./essentials
[ ./options.nix
./options.nix ./users.nix
(./. + "/${deviceType}") # specific modules (./. + "/${deviceType}")
]
++ lib.optionals (deviceType != "termux") [
./essentials
./users.nix
home-manager.nixosModules.home-manager # home-manager module home-manager.nixosModules.home-manager # home-manager module
# nix-index-database.nixosModules.nix-index # nix-index module # nix-index-database.nixosModules.nix-index # nix-index module
grub2-themes.nixosModules.default # grub2 themes module grub2-themes.nixosModules.default # grub2 themes module
sops-nix.nixosModules.sops # sops module sops-nix.nixosModules.sops # sops module
self.homeConfigurations.default.nixosModule # default homeConfigurations self.homeConfigurations.default.nixosModule # default homeConfigurations
disko.nixosModules.disko # disko module disko.nixosModules.disko # disko module
]; ];
# nix-on-droid asserts that nixpkgs.* stays unset in flake mode. nixpkgs.overlays = with inputs; [
nixpkgs.overlays = lib.mkIf (deviceType != "termux") ( self.nixosOverlays.default
with inputs; [ ];
self.nixosOverlays.default
]
);
_module.args = { _module.args = {
inputs = inputs; inputs = inputs;
xlib = config.xlib; xlib = config.xlib;
@@ -57,6 +50,28 @@ let
sops-nix.nixosModules.sops # sops module sops-nix.nixosModules.sops # sops module
]; ];
_module.args = {
inputs = inputs;
xlib = config.xlib;
};
};
strictModule =
{
config,
deviceType,
lib,
xlib,
...
}:
{
imports = with inputs; [
# ./essentials
# ./users.nix
./options.nix
(./. + "/${deviceType}")
# sops-nix.nixosModules.sops
];
_module.args = { _module.args = {
inputs = inputs; inputs = inputs;
xlib = config.xlib; xlib = config.xlib;
@@ -67,5 +82,6 @@ in
nixosModules = { nixosModules = {
default = defaultModule; default = defaultModule;
public = publicModule; public = publicModule;
strict = strictModule;
}; };
} }
+1 -1
View File
@@ -30,7 +30,7 @@ in
"d ${configDir} 0755 homebox homebox -" "d ${configDir} 0755 homebox homebox -"
"z ${configDir} 0755 homebox homebox -" "z ${configDir} 0755 homebox homebox -"
]; ];
fileSystems = { fileSystems = {
"${varDir}" = { "${varDir}" = {
device = "${configDir}"; device = "${configDir}";