Compare commits
No commits in common. "f04eb7b0ae7d75454a4178fd533840f78b484d6a" and "0451c75fa139f66197ec77bd748ae4f6f8b8400a" have entirely different histories.
f04eb7b0ae
...
0451c75fa1
50
flake.nix
50
flake.nix
|
@ -100,7 +100,7 @@
|
|||
|
||||
outputs = { self, nixpkgs, nix-on-droid, home-manager, stylix, ... } @inputs: {
|
||||
# Constant values.
|
||||
const = {
|
||||
nixosModules.const = {
|
||||
droidStateVersion = "22.11";
|
||||
stateVersion = "23.11";
|
||||
timeZone = "Europe/Moscow";
|
||||
|
@ -108,17 +108,35 @@
|
|||
};
|
||||
|
||||
# Common modules used across all hosts.
|
||||
nixosModules.common = let
|
||||
ls = path: map (f: "${path}/${f}") (
|
||||
builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") (
|
||||
builtins.attrNames (builtins.readDir path)
|
||||
)
|
||||
);
|
||||
in {
|
||||
imports = (ls ./module/common) ++ [
|
||||
./user/Root.nix
|
||||
];
|
||||
};
|
||||
nixosModules.common.imports = [
|
||||
./module/common/AutoUpdateSigned.nix
|
||||
./module/common/Bash.nix
|
||||
./module/common/Bootloader.nix
|
||||
./module/common/Crypto.nix
|
||||
./module/common/Distrobox.nix
|
||||
./module/common/Dotfiles.nix
|
||||
./module/common/Filesystem.nix
|
||||
./module/common/Firefox.nix
|
||||
./module/common/Firewall.nix
|
||||
./module/common/Font.nix
|
||||
./module/common/Git.nix
|
||||
./module/common/KbdInterception.nix
|
||||
./module/common/Kernel.nix
|
||||
./module/common/Ld.nix
|
||||
./module/common/Locale.nix
|
||||
./module/common/Network.nix
|
||||
./module/common/Nix.nix
|
||||
./module/common/Nvim.nix
|
||||
./module/common/Package.nix
|
||||
./module/common/Ssh.nix
|
||||
./module/common/Sshd.nix
|
||||
./module/common/Stylix.nix
|
||||
./module/common/Swap.nix
|
||||
./module/common/Tmux.nix
|
||||
./module/common/Users.nix
|
||||
./module/common/YtDlp.nix
|
||||
./user/Root.nix
|
||||
];
|
||||
|
||||
# Function to create a host.
|
||||
mkHost = { system, hostname, modules } @args: nixpkgs.lib.nixosSystem {
|
||||
|
@ -127,7 +145,7 @@
|
|||
modules = [
|
||||
./host/${hostname}/Configuration.nix
|
||||
{ networking.hostName = hostname; }
|
||||
{ system.stateVersion = self.const.stateVersion; }
|
||||
{ system.stateVersion = self.nixosModules.const.stateVersion; }
|
||||
inputs.self.nixosModules.common
|
||||
home-manager.nixosModules.home-manager
|
||||
stylix.nixosModules.stylix
|
||||
|
@ -137,7 +155,7 @@
|
|||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||
config = self.nixosConfigurations.${hostname}.config;
|
||||
in {
|
||||
const = self.const;
|
||||
const = self.nixosModules.const;
|
||||
flake = self;
|
||||
inputs = inputs;
|
||||
key = import ./part/Key.nix {};
|
||||
|
@ -259,14 +277,14 @@
|
|||
# Android.
|
||||
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
modules = [
|
||||
{ system.stateVersion = inputs.self.const.droidStateVersion; }
|
||||
{ system.stateVersion = inputs.self.nixosModules.const.droidStateVersion; }
|
||||
./module/NixOnDroid.nix
|
||||
];
|
||||
|
||||
extraSpecialArgs = let
|
||||
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
|
||||
in {
|
||||
const = self.const;
|
||||
const = self.nixosModules.const;
|
||||
flake = self;
|
||||
inputs = inputs;
|
||||
key = import ./part/Key.nix {};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ pkgs, inputs, const, style, util, key, setting, secret, ... } @args: let
|
||||
{ pkgs, inputs, const, style, util, key, setting, ... } @args: let
|
||||
homePath = "/data/data/com.termux.nix/files/home";
|
||||
tmux = import ./common/tmux args;
|
||||
tmux = import ./common/tmux/Init.nix args;
|
||||
tmuxScript = pkgs.writeShellScriptBin "tmux_script" tmux.script;
|
||||
bash = import ./common/bash args;
|
||||
nvim = import ./common/nvim args;
|
||||
ssh = import ./common/ssh args;
|
||||
bash = import ./common/bash/Init.nix args;
|
||||
nvim = import ./common/nvim/Init.nix args;
|
||||
ssh = import ./common/ssh/Init.nix args;
|
||||
font = pkgs.runCommandNoCC "font" {} ''
|
||||
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
|
||||
'';
|
||||
|
@ -13,74 +13,7 @@
|
|||
foreground=#${style.color.fg.light}
|
||||
'';
|
||||
in {
|
||||
time.timeZone = const.timeZone;
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
home-manager.config = {
|
||||
home = {
|
||||
stateVersion = const.droidStateVersion;
|
||||
file = {
|
||||
".dotfiles".source = inputs.self;
|
||||
".ssh/config".text = ssh.config;
|
||||
".termux/_font.ttf".source = font;
|
||||
".termux/_colors.properties".text = colors;
|
||||
};
|
||||
sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
MANPAGER = "nvim +Man!";
|
||||
NIXPKGS_ALLOW_UNFREE = "1";
|
||||
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}";
|
||||
TERM = "xterm-256color";
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
bash = {
|
||||
enable = true;
|
||||
bashrcExtra = bash.config + ''
|
||||
[[ -f ~/.termux/font.ttf ]] || {
|
||||
cp ~/.termux/_font.ttf ~/.termux/font.ttf
|
||||
cp ~/.termux/_colors.properties ~/.termux/colors.properties
|
||||
_warn "Termux config installed, please restart."
|
||||
};
|
||||
'';
|
||||
};
|
||||
|
||||
tmux = {
|
||||
enable = true;
|
||||
extraConfig = tmux.config;
|
||||
};
|
||||
|
||||
git = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
credential.helper = "store";
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
rebase.autoStash = true;
|
||||
user.signingkey = builtins.readFile secret.crypto.sign.key;
|
||||
gpg.ssh.allowedSignersFile = toString(secret.crypto.sign.allowed);
|
||||
gpg.format = secret.crypto.sign.format;
|
||||
};
|
||||
};
|
||||
|
||||
neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
extraConfig = nvim.config;
|
||||
};
|
||||
|
||||
gpg = {
|
||||
enable = true;
|
||||
publicKeys = secret.crypto.publicKeys;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# NOTE: Split into modules?
|
||||
environment.packages = with pkgs; [
|
||||
android-tools
|
||||
binwalk
|
||||
|
@ -98,12 +31,13 @@ in {
|
|||
gnumake
|
||||
gnused
|
||||
gnutar
|
||||
gzip xz
|
||||
gzip
|
||||
hostname
|
||||
imagemagick
|
||||
jq
|
||||
lsof
|
||||
man
|
||||
neofetch
|
||||
nmap
|
||||
openssh
|
||||
parallel
|
||||
|
@ -115,7 +49,60 @@ in {
|
|||
tree
|
||||
utillinux
|
||||
wget
|
||||
xz
|
||||
yt-dlp
|
||||
zip unzip
|
||||
];
|
||||
|
||||
time.timeZone = const.timeZone;
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
home-manager.config = {
|
||||
home.stateVersion = const.droidStateVersion;
|
||||
home.file = {
|
||||
".dotfiles".source = inputs.self;
|
||||
".ssh/config".text = ssh.config;
|
||||
".termux/_font.ttf".source = font;
|
||||
".termux/_colors.properties".text = colors;
|
||||
};
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
MANPAGER = "nvim +Man!";
|
||||
NIXPKGS_ALLOW_UNFREE = "1";
|
||||
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}";
|
||||
TERM = "xterm-256color";
|
||||
};
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
bashrcExtra = bash.config + ''
|
||||
[[ -f ~/.termux/font.ttf ]] || {
|
||||
cp ~/.termux/_font.ttf ~/.termux/font.ttf
|
||||
cp ~/.termux/_colors.properties ~/.termux/colors.properties
|
||||
_warn "Termux config installed, please restart."
|
||||
};
|
||||
'';
|
||||
};
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
extraConfig = tmux.config;
|
||||
};
|
||||
programs.git = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
credential.helper = "store";
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
rebase.autoStash = true;
|
||||
};
|
||||
};
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
extraConfig = nvim.config;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
9
module/common/Direnv.nix
Normal file
9
module/common/Direnv.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }: {
|
||||
packages.direnv = {
|
||||
enable = true;
|
||||
silent = true;
|
||||
direnvrcExtra = ''
|
||||
export NIX_SHELL="direnv"
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
{ const, util, style, pkgs, lib, setting, key, secret, ... } @args: {
|
||||
{ pkgs, lib, ... }: {
|
||||
imports = [
|
||||
(import ./common (args // {
|
||||
username = "dasha";
|
||||
homeDir = "/home/dasha";
|
||||
}))
|
||||
./home/Dasha.nix
|
||||
];
|
||||
users.users.dasha = {
|
||||
createHome = true;
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
{ const, util, style, pkgs, setting, key, secret, ... } @args: {
|
||||
{ secret, ... }: {
|
||||
imports = [
|
||||
(import ./common (args // {
|
||||
username = "root";
|
||||
homeDir = "/root";
|
||||
}))
|
||||
./home/Root.nix
|
||||
];
|
||||
|
||||
users.users.root.hashedPassword = secret.hashedPassword;
|
||||
security.sudo = {
|
||||
enable = false;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{ const, util, style, pkgs, lib, setting, key, secret, ... } @args: {
|
||||
{ pkgs, lib, secret, ... }: {
|
||||
imports = [
|
||||
(import ./common (args // {
|
||||
username = "voronind";
|
||||
homeDir = "/home/voronind";
|
||||
}))
|
||||
./home/Voronind.nix
|
||||
];
|
||||
|
||||
users.users.voronind = {
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
{ const, username, homeDir, util, style, pkgs, setting, key, secret, ... } @args: let
|
||||
foot = import ./foot args;
|
||||
mako = import ./mako args;
|
||||
editorconfig = import ./editorconfig args;
|
||||
btop = import ./top/btop args;
|
||||
htop = import ./top/htop args;
|
||||
in {
|
||||
home-manager = {
|
||||
backupFileExtension = "old";
|
||||
|
||||
users.${username} = {
|
||||
home = {
|
||||
username = username;
|
||||
homeDirectory = homeDir;
|
||||
stateVersion = const.stateVersion;
|
||||
file = {
|
||||
".config/btop/btop.conf".text = btop.config;
|
||||
".config/htop/htoprc".text = htop.config;
|
||||
".config/mako/config".text = mako.config;
|
||||
".config/foot/foot.ini".text = foot.config;
|
||||
".editorconfig".text = editorconfig.config;
|
||||
".parallel/will-cite".text = "";
|
||||
"media/template".source = ./template;
|
||||
};
|
||||
};
|
||||
|
||||
xdg.userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
desktop = "${homeDir}/";
|
||||
documents = "${homeDir}/document/";
|
||||
download = "${homeDir}/download/";
|
||||
music = "${homeDir}/media/music/";
|
||||
pictures = "${homeDir}/media/picture/";
|
||||
publicShare = "${homeDir}/media/share/";
|
||||
templates = "${homeDir}/media/template/";
|
||||
videos = "${homeDir}/media/video/";
|
||||
extraConfig = {
|
||||
XDG_TMP_DIR = "${homeDir}/tmp/";
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
gpg = {
|
||||
enable = true;
|
||||
publicKeys = secret.crypto.publicKeys;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
8
user/home/Dasha.nix
Normal file
8
user/home/Dasha.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ const, util, style, pkgs, setting, key, secret, ... } @args: {
|
||||
imports = [
|
||||
(import ./common (args // {
|
||||
username = "dasha";
|
||||
homeDir = "/home/dasha";
|
||||
}))
|
||||
];
|
||||
}
|
8
user/home/Root.nix
Normal file
8
user/home/Root.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ const, util, style, pkgs, setting, key, secret, ... } @args: {
|
||||
imports = [
|
||||
(import ./common (args // {
|
||||
username = "root";
|
||||
homeDir = "/root";
|
||||
}))
|
||||
];
|
||||
}
|
8
user/home/Voronind.nix
Normal file
8
user/home/Voronind.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ const, util, style, pkgs, setting, key, secret, ... } @args: {
|
||||
imports = [
|
||||
(import ./common (args // {
|
||||
username = "voronind";
|
||||
homeDir = "/home/voronind";
|
||||
}))
|
||||
];
|
||||
}
|
50
user/home/common/default.nix
Normal file
50
user/home/common/default.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ const, username, homeDir, util, style, pkgs, setting, key, secret, ... } @args: let
|
||||
foot = import ./foot args;
|
||||
mako = import ./mako args;
|
||||
editorconfig = import ./editorconfig args;
|
||||
btop = import ./top/btop args;
|
||||
htop = import ./top/htop args;
|
||||
in {
|
||||
home-manager.backupFileExtension = "old";
|
||||
|
||||
home-manager.users.${username} = {
|
||||
programs.home-manager.enable = true;
|
||||
home.username = username;
|
||||
home.homeDirectory = homeDir;
|
||||
home.stateVersion = const.stateVersion;
|
||||
|
||||
home.file = {
|
||||
".config/btop/btop.conf".text = btop.config;
|
||||
".config/htop/htoprc".text = htop.config;
|
||||
".config/mako/config".text = mako.config;
|
||||
".config/foot/foot.ini".text = foot.config;
|
||||
".editorconfig".text = editorconfig.config;
|
||||
".parallel/will-cite".text = "";
|
||||
"media/template".source = ./template;
|
||||
};
|
||||
|
||||
# Directories.
|
||||
xdg.userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
desktop = "${homeDir}/";
|
||||
documents = "${homeDir}/document/";
|
||||
download = "${homeDir}/download/";
|
||||
music = "${homeDir}/media/music/";
|
||||
pictures = "${homeDir}/media/picture/";
|
||||
publicShare = "${homeDir}/media/share/";
|
||||
templates = "${homeDir}/media/template/";
|
||||
videos = "${homeDir}/media/video/";
|
||||
extraConfig = {
|
||||
XDG_TMP_DIR = "${homeDir}/tmp/";
|
||||
};
|
||||
};
|
||||
|
||||
# GPG.
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
publicKeys = secret.crypto.publicKeys;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in a new issue