style: format code

This commit is contained in:
tux
2026-09-11 01:59:55 +05:30
parent 49a341d6b3
commit 344d8bdd4a
87 changed files with 2528 additions and 2719 deletions

View File

@@ -1,7 +1,7 @@
{
description = "tux's nix configurations";
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} (inputs.import-tree ./modules);
inputs = {
flake-parts = {

View File

@@ -1,13 +1,14 @@
{ inputs, config, ... }:
{
flake.modules.nixOnDroid.core =
{
inputs,
config,
...
}: {
flake.modules.nixOnDroid.core = {
hostName,
userName,
userEmail,
...
}:
{
}: {
home-manager = {
backupFileExtension = "bak";
useGlobalPkgs = true;

View File

@@ -1,12 +1,10 @@
{
flake.modules.nixOnDroid.networking =
{
flake.modules.nixOnDroid.networking = {
config,
lib,
pkgs,
...
}:
let
}: let
# utility functions
concatLines = list: builtins.concatStringsSep "\n" list;
@@ -57,8 +55,7 @@
-f "/etc/${configPath}" \
-D # don't detach into a daemon process
'';
in
{
in {
options.tnix.networking.openssh = {
enable = lib.mkEnableOption ''
Whether to enable the OpenSSH secure shell daemon, which
@@ -67,7 +64,7 @@
ports = lib.mkOption {
type = lib.types.listOf lib.types.port;
default = [ 22 ];
default = [22];
description = ''
Specifies on which ports the SSH daemon listens.
'';
@@ -75,7 +72,7 @@
authorizedKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
default = [];
description = ''
Specify a list of public keys to be added to the authorized_keys file.
'';

View File

@@ -1,4 +1,3 @@
{ inputs, ... }:
{
imports = [ inputs.flake-parts.flakeModules.modules ];
{inputs, ...}: {
imports = [inputs.flake-parts.flakeModules.modules];
}

View File

@@ -3,18 +3,17 @@
inputs,
config,
...
}:
let
mkNixOSHost =
hostName:
{
}: let
mkNixOSHost = hostName: {
userName ? "tux",
userEmail ? "t@tux.rs",
system ? "x86_64-linux",
unstable ? true,
}:
let
nixpkgs = if unstable then inputs.nixpkgs else inputs.nixpkgs-stable;
}: let
nixpkgs =
if unstable
then inputs.nixpkgs
else inputs.nixpkgs-stable;
in
nixpkgs.lib.nixosSystem {
inherit system;
@@ -32,16 +31,16 @@ let
];
};
mkDroidHost =
hostName:
{
mkDroidHost = hostName: {
userName ? "nix-on-droid",
userEmail ? "t@tux.rs",
system ? "aarch64-linux",
unstable ? true,
}:
let
nixpkgs = if unstable then inputs.nixpkgs else inputs.nixpkgs-stable;
}: let
nixpkgs =
if unstable
then inputs.nixpkgs
else inputs.nixpkgs-stable;
in
inputs.nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import nixpkgs {
@@ -65,12 +64,7 @@ let
];
};
mkNixOSNode =
hostName:
{
system ? "x86_64-linux",
}:
{
mkNixOSNode = hostName: {system ? "x86_64-linux"}: {
hostname = hostName;
profiles.system = {
user = "root";
@@ -78,17 +72,11 @@ let
};
};
activateNixOnDroid =
system: configuration:
activateNixOnDroid = system: configuration:
inputs.deploy-rs.lib.${system}.activate.custom configuration.activationPackage
"${configuration.activationPackage}/activate";
mkDroidNode =
hostName:
{
system ? "aarch64-linux",
}:
{
mkDroidNode = hostName: {system ? "aarch64-linux"}: {
hostname = hostName;
profiles.system = {
sshUser = "nix-on-droid";
@@ -101,30 +89,30 @@ let
path = activateNixOnDroid system self.nixOnDroidConfigurations.${hostName};
};
};
in
{
in {
flake = {
nixosConfigurations = builtins.mapAttrs mkNixOSHost {
sirius = { };
canopus = { };
arcturus = { };
alpha = { };
vps = { };
sirius = {};
canopus = {};
arcturus = {};
alpha = {};
vps = {};
};
nixOnDroidConfigurations = builtins.mapAttrs mkDroidHost {
vega = { };
vega = {};
};
deploy.nodes =
builtins.mapAttrs (hostName: _: mkNixOSNode hostName { }) self.nixosConfigurations
// builtins.mapAttrs (hostName: _: mkDroidNode hostName { }) self.nixOnDroidConfigurations;
builtins.mapAttrs (hostName: _: mkNixOSNode hostName {}) self.nixosConfigurations
// builtins.mapAttrs (hostName: _: mkDroidNode hostName {}) self.nixOnDroidConfigurations;
};
perSystem = {
checks = builtins.mapAttrs (
checks =
builtins.mapAttrs (
_: hostConfig: hostConfig.config.system.build.toplevel
) self.nixosConfigurations;
)
self.nixosConfigurations;
};
}

View File

@@ -1,8 +1,4 @@
{
inputs,
...
}:
{
{inputs, ...}: {
flake.overlays = {
modifications = final: prev: {
tnvim = inputs.tnvim.packages.${prev.stdenv.hostPlatform.system}.default;
@@ -31,9 +27,7 @@
copyparty = inputs.copyparty.overlays.default;
};
perSystem =
{ system, ... }:
{
perSystem = {system, ...}: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = builtins.attrValues inputs.self.overlays;

View File

@@ -1,5 +1,4 @@
{ inputs, ... }:
{
{inputs, ...}: {
imports = [
inputs.treefmt-nix.flakeModule
];
@@ -9,7 +8,7 @@
projectRootFile = "flake.nix";
flakeCheck = true;
programs = {
nixfmt.enable = true;
alejandra.enable = true;
};
};
};

View File

@@ -1,7 +1,5 @@
{
flake.modules.homeManager.core =
{ userName, ... }:
{
flake.modules.homeManager.core = {userName, ...}: {
programs.home-manager.enable = true;
systemd.user.startServices = "sd-switch";

View File

@@ -1,12 +1,9 @@
{ inputs, ... }:
{
flake.modules.homeManager.core =
{
{inputs, ...}: {
flake.modules.homeManager.core = {
lib,
osConfig ? { },
osConfig ? {},
...
}:
{
}: {
nixpkgs = lib.mkIf (!(osConfig.home-manager.useGlobalPkgs or false)) {
config = {
allowUnfree = true;

View File

@@ -1,11 +1,9 @@
{
flake.modules.homeManager.desktop =
{
flake.modules.homeManager.desktop = {
pkgs,
config,
...
}:
let
}: let
configDir = "${config.xdg.configHome}/BraveSoftware/Brave-Browser";
extensionJson = ext: {
@@ -16,14 +14,13 @@
};
extensions = [
{ id = "nkbihfbeogaeaoehlefnkodbefgpgknn"; } # Metamask
{ id = "gppongmhjkpfnbhagpmjfkannfbllamg"; } # Wappalyzer
{ id = "nngceckbapebfimnlniiiahkandclblb"; } # Bitwarden
{ id = "bfnaelmomeimhlpmgjnjophhpkkoljpa"; } # Phantom
{ id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # DarkReader
{id = "nkbihfbeogaeaoehlefnkodbefgpgknn";} # Metamask
{id = "gppongmhjkpfnbhagpmjfkannfbllamg";} # Wappalyzer
{id = "nngceckbapebfimnlniiiahkandclblb";} # Bitwarden
{id = "bfnaelmomeimhlpmgjnjophhpkkoljpa";} # Phantom
{id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";} # DarkReader
];
in
{
in {
programs.chromium = {
enable = true;
package = pkgs.brave;

View File

@@ -1,7 +1,9 @@
{
flake.modules.homeManager.desktop =
{ inputs, userName, ... }:
{
flake.modules.homeManager.desktop = {
inputs,
userName,
...
}: {
imports = [
inputs.nixcord.homeModules.nixcord
];
@@ -47,7 +49,7 @@
rpcServer = true;
rpcProcessScanner = true;
pushToTalk = true;
pushToTalkKeys = [ "RControl" ];
pushToTalkKeys = ["RControl"];
desktopNotifications = true;
unreadBadge = true;
};

View File

@@ -1,11 +1,9 @@
{
flake.modules.homeManager.desktop =
{
flake.modules.homeManager.desktop = {
pkgs,
userName,
...
}:
{
}: {
programs.firefox = {
enable = true;

View File

@@ -1,7 +1,9 @@
{
flake.modules.homeManager.desktop =
{ config, pkgs, ... }:
{
flake.modules.homeManager.desktop = {
config,
pkgs,
...
}: {
# TODO: Hyprland 0.55 switched to Lua-based configuration.
# HM module is updated but I'm too lazy at this point so we symlink our config instead.
wayland.windowManager.hyprland = {
@@ -10,7 +12,7 @@
portalPackage = null;
xwayland.enable = true;
configType = "hyprlang";
systemd.variables = [ "--all" ];
systemd.variables = ["--all"];
};
home.file = {

View File

@@ -1,25 +1,21 @@
{ inputs, ... }:
{
flake.modules.homeManager.desktop =
{
{inputs, ...}: {
flake.modules.homeManager.desktop = {
config,
pkgs,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.lan-mouse;
in
{
imports = [ inputs.lan-mouse.homeManagerModules.default ];
in {
imports = [inputs.lan-mouse.homeManagerModules.default];
options.tnix.services.lan-mouse = {
enable = mkEnableOption "Enable Lan-Mouse";
settings = mkOption {
type = (pkgs.formats.toml { }).type;
default = { };
type = (pkgs.formats.toml {}).type;
default = {};
description = ''
TOML configuration for lan-mouse.
See <https://github.com/feschber/lan-mouse/> for available options.
@@ -28,7 +24,6 @@
};
config = mkIf cfg.enable {
programs.lan-mouse = {
enable = true;
systemd = true;

View File

@@ -1,17 +1,13 @@
{ inputs, ... }:
{
flake.modules.homeManager.desktop =
{
{inputs, ...}: {
flake.modules.homeManager.desktop = {
config,
pkgs,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.desktop.mangowm;
in
{
in {
imports = [
inputs.mango.hmModules.mango
];
@@ -21,12 +17,12 @@
monitorRule = mkOption {
type = with types; listOf str;
default = [ ];
default = [];
};
tagRule = mkOption {
type = with types; listOf str;
default = [ ];
default = [];
};
};

View File

@@ -1,13 +1,10 @@
{
flake.modules.homeManager.desktop =
{ pkgs, ... }:
{
flake.modules.homeManager.desktop = {pkgs, ...}: {
programs.mpv = {
enable = true;
scripts = (
with pkgs.mpvScripts;
[
with pkgs.mpvScripts; [
modernz
thumbfast
mpris

View File

@@ -1,7 +1,5 @@
{
flake.modules.homeManager.desktop =
{ pkgs, ... }:
{
flake.modules.homeManager.desktop = {pkgs, ...}: {
home.pointerCursor = {
enable = true;
package = pkgs.bibata-cursors;

View File

@@ -1,10 +1,5 @@
{
flake.modules.homeManager.desktop =
{
pkgs,
...
}:
{
flake.modules.homeManager.desktop = {pkgs, ...}: {
programs.vicinae = {
enable = true;
systemd = {
@@ -52,7 +47,7 @@
opacity = 0.98;
};
imports = [ "/run/secrets/vicinae.json" ];
imports = ["/run/secrets/vicinae.json"];
providers = {
"@sovereign/vicinae-extension-awww-switcher-0" = {

View File

@@ -1,5 +1,5 @@
{ inputs, ... }: {
flake.modules.homeManager.desktop = { pkgs, ... }: {
{inputs, ...}: {
flake.modules.homeManager.desktop = {pkgs, ...}: {
imports = [
inputs.voxtype.homeManagerModules.default
];

View File

@@ -1,7 +1,5 @@
{
flake.modules.homeManager.desktop =
{ pkgs, ... }:
{
flake.modules.homeManager.desktop = {pkgs, ...}: {
programs.wezterm = {
enable = true;
package = pkgs.wezterm-git;

View File

@@ -1,5 +1,5 @@
{
flake.modules.homeManager.desktop = { osConfig, ... }: {
flake.modules.homeManager.desktop = {osConfig, ...}: {
programs.lutris = {
enable = true;
steamPackage = osConfig.programs.steam.package;

View File

@@ -1,11 +1,9 @@
{
flake.modules.homeManager.shell =
{
flake.modules.homeManager.shell = {
userName,
userEmail,
...
}:
{
}: {
programs.git = {
enable = true;
signing = {

View File

@@ -1,7 +1,5 @@
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
{
flake.modules.homeManager.shell = {pkgs, ...}: {
home.packages = with pkgs; [
systemctl-tui
zip

View File

@@ -1,7 +1,5 @@
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
{
flake.modules.homeManager.shell = {pkgs, ...}: {
home.file = {
".config/nvim" = {
recursive = true;

View File

@@ -1,5 +1,5 @@
{
flake.modules.homeManager.shell = { pkgs, ... }: {
flake.modules.homeManager.shell = {pkgs, ...}: {
programs.opencode = {
enable = true;
package = pkgs.opencode-git;
@@ -25,7 +25,7 @@
};
};
};
plugin = [ "@dietrichgebert/ponytail" ];
plugin = ["@dietrichgebert/ponytail"];
};
};
};

View File

@@ -1,58 +1,47 @@
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
let
flake.modules.homeManager.shell = {pkgs, ...}: let
bg = "default";
fg = "default";
bg2 = "brightblack";
fg2 = "white";
color = c: "#{@${c}}";
indicator =
let
indicator = let
accent = color "indicator_color";
content = " ";
in
"#[reverse,fg=${accent}]#{?client_prefix,${content},}";
in "#[reverse,fg=${accent}]#{?client_prefix,${content},}";
current_window =
let
current_window = let
accent = color "main_accent";
index = "#[reverse,fg=${accent},bg=${fg}] #I ";
name = "#[fg=${bg2},bg=${fg2}] #W ";
# flags = "#{?window_flags,#{window_flags}, }";
in
"${index}${name}";
in "${index}${name}";
window_status =
let
window_status = let
accent = color "window_color";
index = "#[reverse,fg=${accent},bg=${fg}] #I ";
name = "#[fg=${bg2},bg=${fg2}] #W ";
# flags = "#{?window_flags,#{window_flags}, }";
in
"${index}${name}";
in "${index}${name}";
battery =
let
battery = let
percentage = pkgs.writeShellScript "percentage" (
if pkgs.stdenv.isDarwin then
''
if pkgs.stdenv.isDarwin
then ''
echo $(pmset -g batt | grep -o "[0-9]\+%" | tr '%' ' ')
''
else
''
else ''
path="/org/freedesktop/UPower/devices/DisplayDevice"
echo $(${pkgs.upower}/bin/upower -i $path | grep -o "[0-9]\+%" | tr '%' ' ')
''
);
state = pkgs.writeShellScript "state" (
if pkgs.stdenv.isDarwin then
''
if pkgs.stdenv.isDarwin
then ''
echo $(pmset -g batt | awk '{print $4}')
''
else
''
else ''
path="/org/freedesktop/UPower/devices/DisplayDevice"
echo $(${pkgs.upower}/bin/upower -i $path | grep state | awk '{print $2}')
''
@@ -77,31 +66,25 @@
elif [ $percentage -ge 0 ]; then echo "red"
fi
'';
in
"#[fg=#(${color})]#(${icon}) #[fg=${fg}]#(${percentage})%";
in "#[fg=#(${color})]#(${icon}) #[fg=${fg}]#(${percentage})%";
pwd =
let
pwd = let
accent = color "main_accent";
icon = "#[fg=${accent}] ";
format = "#[fg=${fg}]#{b:pane_current_path}";
in
"${icon}${format}";
in "${icon}${format}";
git =
let
git = let
icon = pkgs.writeShellScript "branch" ''
git -C "$1" branch && echo " "
'';
branch = pkgs.writeShellScript "branch" ''
git -C "$1" rev-parse --abbrev-ref HEAD
'';
in
"#[fg=magenta]#(${icon} #{pane_current_path})#(${branch} #{pane_current_path})";
in "#[fg=magenta]#(${icon} #{pane_current_path})#(${branch} #{pane_current_path})";
separator = "#[fg=${fg}]|";
in
{
in {
programs.tmux = {
enable = true;
baseIndex = 1;

View File

@@ -2,7 +2,7 @@
flake.modules.homeManager.shell = {
programs.zoxide = {
enable = true;
options = [ "--cmd cd" ];
options = ["--cmd cd"];
enableZshIntegration = true;
};
};

View File

@@ -1,8 +1,5 @@
{ lib, ... }:
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
{
{lib, ...}: {
flake.modules.homeManager.shell = {pkgs, ...}: {
programs.zsh = {
enable = true;
history = {

View File

@@ -1,14 +1,14 @@
{ inputs, config, ... }:
{
flake.modules.nixos.alpha =
{
inputs,
config,
...
}: {
flake.modules.nixos.alpha = {
hostName,
userName,
...
}@innerArgs:
{
imports =
with config.flake.modules.nixos;
} @ innerArgs: {
imports = with config.flake.modules.nixos;
[
boot
networking

View File

@@ -1,12 +1,12 @@
{ inputs, ... }:
{
flake.modules.nixos.alpha =
{ config, lib, ... }:
let
{inputs, ...}: {
flake.modules.nixos.alpha = {
config,
lib,
...
}: let
hasOptinPersistence = config.tnix.boot.impermanence.enable;
isLegacy = config.tnix.boot.legacy.enable;
in
{
in {
imports = [
inputs.disko.nixosModules.disko
];
@@ -16,7 +16,8 @@
type = "disk";
content = {
type = "gpt";
partitions = {
partitions =
{
ESP = {
size = "1G";
type = "EF00";
@@ -36,7 +37,8 @@
content = {
type = "btrfs";
# Base subvolumes that always exist
subvolumes = {
subvolumes =
{
"/root" = {
mountOptions = [
"compress=zstd"

View File

@@ -1,12 +1,10 @@
{
flake.modules.nixos.alpha =
{
flake.modules.nixos.alpha = {
lib,
modulesPath,
system,
...
}:
{
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];

View File

@@ -1,12 +1,10 @@
{ config, ... }: {
flake.modules.nixos.arcturus =
{
{config, ...}: {
flake.modules.nixos.arcturus = {
pkgs,
hostName,
userName,
...
}@innerArgs:
{
} @ innerArgs: {
imports = with config.flake.modules.nixos; [
boot
networking
@@ -53,7 +51,7 @@
services = {
hermes-agent = {
enable = true;
environmentFiles = [ innerArgs.config.sops.secrets.hermes.path ];
environmentFiles = [innerArgs.config.sops.secrets.hermes.path];
};
cyber-tux = {
@@ -76,7 +74,7 @@
path = "/var/lib/copyparty/data";
access = {
r = "*";
rwmdgGha = [ userName ];
rwmdgGha = [userName];
};
};
};

View File

@@ -1,11 +1,11 @@
{ inputs, ... }:
{
flake.modules.nixos.arcturus =
{ config, lib, ... }:
let
{inputs, ...}: {
flake.modules.nixos.arcturus = {
config,
lib,
...
}: let
hasOptinPersistence = config.tnix.boot.impermanence.enable;
in
{
in {
imports = [
inputs.disko.nixosModules.disko
];
@@ -35,7 +35,8 @@
content = {
type = "btrfs";
# Base subvolumes that always exist
subvolumes = {
subvolumes =
{
"/root" = {
mountOptions = [
"compress=zstd"

View File

@@ -1,13 +1,10 @@
{ config, ... }:
{
flake.modules.nixos.arcturus =
{
{config, ...}: {
flake.modules.nixos.arcturus = {
lib,
pkgs,
system,
...
}@innerArgs:
{
} @ innerArgs: {
imports = with config.flake.modules.nixos; [
hardware
];
@@ -20,9 +17,9 @@
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
hardware.cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware;

View File

@@ -1,12 +1,10 @@
{ config, ... }: {
flake.modules.nixos.canopus =
{
{config, ...}: {
flake.modules.nixos.canopus = {
pkgs,
hostName,
userName,
...
}:
{
}: {
imports = with config.flake.modules.nixos; [
boot
networking

View File

@@ -1,11 +1,11 @@
{ inputs, ... }:
{
flake.modules.nixos.canopus =
{ config, lib, ... }:
let
{inputs, ...}: {
flake.modules.nixos.canopus = {
config,
lib,
...
}: let
hasOptinPersistence = config.tnix.boot.impermanence.enable;
in
{
in {
imports = [
inputs.disko.nixosModules.disko
];
@@ -43,7 +43,8 @@
content = {
type = "btrfs";
# Base subvolumes that always exist
subvolumes = {
subvolumes =
{
"/root" = {
mountOptions = [
"compress=zstd"

View File

@@ -1,15 +1,15 @@
{ inputs, config, ... }:
{
flake.modules.nixos.canopus =
{
inputs,
config,
...
}: {
flake.modules.nixos.canopus = {
lib,
pkgs,
system,
...
}@innerArgs:
{
imports =
with config.flake.modules.nixos;
} @ innerArgs: {
imports = with config.flake.modules.nixos;
[
hardware
]
@@ -18,7 +18,7 @@
inputs.cardwire.nixosModules.default
];
boot.kernelParams = [ "nvidia-drm.modeset=1" ];
boot.kernelParams = ["nvidia-drm.modeset=1"];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
@@ -27,9 +27,9 @@
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
hardware = {
nvidia = {
@@ -42,7 +42,7 @@
};
services = {
xserver.videoDrivers = [ "nvidia" ];
xserver.videoDrivers = ["nvidia"];
power-profiles-daemon.enable = true;
upower.enable = true;

View File

@@ -1,6 +1,5 @@
{ config, ... }:
{
flake.modules.homeManager.canopus = { pkgs, ... }: {
{config, ...}: {
flake.modules.homeManager.canopus = {pkgs, ...}: {
imports = with config.flake.modules.homeManager; [
desktop
];
@@ -27,8 +26,7 @@
enable = true;
settings = {
authorized_fingerprints = {
"f4:4b:17:61:f7:01:a4:a2:e1:c7:8c:1c:7a:f3:8b:87:14:3d:05:3d:a0:8b:cc:e7:88:d8:d8:d2:a4:c2:75:8b" =
"sirius";
"f4:4b:17:61:f7:01:a4:a2:e1:c7:8c:1c:7a:f3:8b:87:14:3d:05:3d:a0:8b:cc:e7:88:d8:d8:d2:a4:c2:75:8b" = "sirius";
};
};
};

View File

@@ -1,12 +1,10 @@
{ config, ... }: {
flake.modules.nixos.sirius =
{
{config, ...}: {
flake.modules.nixos.sirius = {
pkgs,
hostName,
userName,
...
}:
{
}: {
imports = with config.flake.modules.nixos; [
boot
networking

View File

@@ -1,11 +1,11 @@
{ inputs, ... }:
{
flake.modules.nixos.sirius =
{ config, lib, ... }:
let
{inputs, ...}: {
flake.modules.nixos.sirius = {
config,
lib,
...
}: let
hasOptinPersistence = config.tnix.boot.impermanence.enable;
in
{
in {
imports = [
inputs.disko.nixosModules.disko
];
@@ -43,7 +43,8 @@
content = {
type = "btrfs";
# Base subvolumes that always exist
subvolumes = {
subvolumes =
{
"/root" = {
mountOptions = [
"compress=zstd"

View File

@@ -1,15 +1,15 @@
{ inputs, config, ... }:
{
flake.modules.nixos.sirius =
{
inputs,
config,
...
}: {
flake.modules.nixos.sirius = {
lib,
pkgs,
system,
...
}@innerArgs:
{
imports =
with config.flake.modules.nixos;
} @ innerArgs: {
imports = with config.flake.modules.nixos;
[
hardware
]
@@ -17,7 +17,7 @@
inputs.cardwire.nixosModules.default
];
boot.kernelParams = [ "nvidia-drm.modeset=1" ];
boot.kernelParams = ["nvidia-drm.modeset=1"];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
@@ -26,9 +26,9 @@
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
hardware = {
nvidia = {
@@ -41,7 +41,7 @@
};
services = {
xserver.videoDrivers = [ "nvidia" ];
xserver.videoDrivers = ["nvidia"];
power-profiles-daemon.enable = true;
cardwire = {

View File

@@ -1,5 +1,4 @@
{ config, ... }:
{
{config, ...}: {
flake.modules.homeManager.sirius = {
imports = with config.flake.modules.homeManager; [
desktop
@@ -45,7 +44,7 @@
position = "bottom";
hostname = "canopus";
activate_on_startup = true;
ips = [ "192.168.8.2" ];
ips = ["192.168.8.2"];
}
];
};

View File

@@ -1,12 +1,9 @@
{ config, ... }:
{
flake.modules.nixOnDroid.vega =
{
{config, ...}: {
flake.modules.nixOnDroid.vega = {
pkgs,
userEmail,
...
}:
{
}: {
imports = with config.flake.modules.nixOnDroid; [
networking
];
@@ -18,18 +15,16 @@
# android-integration.termux-setup-storage.enable = true;
# android-integration.termux-reload-settings.enable = true;
terminal.font =
let
terminal.font = let
firacode = pkgs.nerd-fonts.fira-code;
fontPath = "share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf";
in
"${firacode}/${fontPath}";
in "${firacode}/${fontPath}";
time.timeZone = "Asia/Kolkata";
tnix.networking.openssh = {
enable = true;
ports = [ 8033 ];
ports = [8033];
authorizedKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}"
];

View File

@@ -1,5 +1,4 @@
{ lib, ... }:
{
{lib, ...}: {
flake.modules.homeManager.vega = {
# @TODO: Broken currently - By default it's enabled by neovim module
programs.vim.enable = lib.mkForce false;

View File

@@ -1,11 +1,5 @@
{ config, ... }:
{
flake.modules.nixos.vps =
{
hostName,
...
}:
{
{config, ...}: {
flake.modules.nixos.vps = {hostName, ...}: {
imports = with config.flake.modules.nixos; [
boot
networking

View File

@@ -1,12 +1,12 @@
{ inputs, ... }:
{
flake.modules.nixos.vps =
{ config, lib, ... }:
let
{inputs, ...}: {
flake.modules.nixos.vps = {
config,
lib,
...
}: let
hasOptinPersistence = config.tnix.boot.impermanence.enable;
isLegacy = config.tnix.boot.legacy.enable;
in
{
in {
imports = [
inputs.disko.nixosModules.disko
];
@@ -16,7 +16,8 @@
type = "disk";
content = {
type = "gpt";
partitions = {
partitions =
{
ESP = {
size = "1G";
type = "EF00";
@@ -36,7 +37,8 @@
content = {
type = "btrfs";
# Base subvolumes that always exist
subvolumes = {
subvolumes =
{
"/root" = {
mountOptions = [
"compress=zstd"

View File

@@ -1,12 +1,10 @@
{
flake.modules.nixos.vps =
{
flake.modules.nixos.vps = {
lib,
modulesPath,
system,
...
}:
{
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];

View File

@@ -1,16 +1,12 @@
{ inputs, ... }:
{
flake.modules.nixos.boot =
{
{inputs, ...}: {
flake.modules.nixos.boot = {
config,
lib,
userName,
...
}:
let
}: let
cfg = config.tnix.boot;
in
{
in {
imports = [
inputs.impermanence.nixosModules.impermanence
];
@@ -20,24 +16,24 @@
directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
default = [];
};
files = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
default = [];
};
};
options.tnix.boot.impermanence.home = {
directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
default = [];
};
files = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
default = [];
};
};
@@ -46,14 +42,16 @@
fileSystems."/persist".neededForBoot = true;
environment.persistence."/persist" = {
hideMounts = true;
directories = [
directories =
[
"/var/log"
"/var/lib"
"/etc/NetworkManager/system-connections"
]
++ cfg.impermanence.directories;
files = [
files =
[
"/etc/machine-id"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
@@ -65,7 +63,8 @@
home-manager.users.${userName} = {
home.persistence."/persist" = {
directories = [
directories =
[
"Downloads"
"Music"
"Wallpapers"
@@ -85,9 +84,9 @@
enable = true;
services.wipe-my-fs = {
wantedBy = [ "initrd.target" ];
after = [ "initrd-root-device.target" ];
before = [ "sysroot.mount" ];
wantedBy = ["initrd.target"];
after = ["initrd-root-device.target"];
before = ["sysroot.mount"];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''

View File

@@ -1,17 +1,18 @@
{
flake.modules.nixos.boot =
{ config, lib, ... }:
let
flake.modules.nixos.boot = {
config,
lib,
...
}: let
cfg = config.tnix.boot;
in
{
in {
options.tnix.boot.legacy = {
enable = lib.mkEnableOption "legacy boot (GRUB) instead of systemd-boot";
};
config = lib.mkMerge [
{
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
boot.binfmt.emulatedSystems = ["aarch64-linux"];
boot.loader = {
timeout = 1;

View File

@@ -1,12 +1,10 @@
{
flake.modules.nixos.boot =
{ pkgs, ... }:
{
flake.modules.nixos.boot = {pkgs, ...}: {
boot = {
consoleLogLevel = 0;
initrd.verbose = false;
kernelPackages = pkgs.linuxPackages_zen;
supportedFilesystems = [ "ntfs" ];
supportedFilesystems = ["ntfs"];
};
};
}

View File

@@ -1,17 +1,13 @@
{ inputs, ... }:
{
flake.modules.nixos.boot =
{
{inputs, ...}: {
flake.modules.nixos.boot = {
config,
lib,
pkgs,
...
}:
let
}: let
cfg = config.tnix.boot;
in
{
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
in {
imports = [inputs.lanzaboote.nixosModules.lanzaboote];
options.tnix.boot.secure-boot = {
enable = lib.mkEnableOption "Enable secure-boot";
@@ -25,7 +21,7 @@
}
];
environment.systemPackages = [ pkgs.sbctl ];
environment.systemPackages = [pkgs.sbctl];
# Lanzaboote replaces systemd-boot, so force it off
boot.loader.systemd-boot.enable = lib.mkForce false;

View File

@@ -1,13 +1,14 @@
{ inputs, config, ... }:
{
flake.modules.nixos.core =
{
inputs,
config,
...
}: {
flake.modules.nixos.core = {
hostName,
userName,
userEmail,
...
}:
{
}: {
imports = [
inputs.home-manager.nixosModules.home-manager
];

View File

@@ -1,11 +1,9 @@
{
flake.modules.nixos.core =
{
flake.modules.nixos.core = {
config,
userName,
...
}:
{
}: {
programs.nh = {
enable = true;

View File

@@ -1,6 +1,5 @@
{ inputs, ... }:
{
flake.modules.nixos.core = { pkgs, ... }: {
{inputs, ...}: {
flake.modules.nixos.core = {pkgs, ...}: {
imports = [
inputs.nix-index-database.nixosModules.default
];

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.core =
{ userName, ... }:
{
flake.modules.nixos.core = {userName, ...}: {
nix = {
channel.enable = false;

View File

@@ -1,5 +1,4 @@
{ inputs, ... }:
{
{inputs, ...}: {
flake.modules.nixos.core = {
nixpkgs = {
config = {

View File

@@ -1,18 +1,14 @@
{ inputs, ... }:
{
flake.modules.nixos.core =
{
{inputs, ...}: {
flake.modules.nixos.core = {
config,
pkgs,
...
}:
let
}: let
isEd25519 = k: k.type == "ed25519";
getKeyPath = k: k.path;
keys = builtins.filter isEd25519 config.services.openssh.hostKeys;
in
{
imports = [ inputs.sops-nix.nixosModules.sops ];
in {
imports = [inputs.sops-nix.nixosModules.sops];
sops.age = {
sshKeyPaths = map getKeyPath keys;
@@ -20,6 +16,6 @@
generateKey = true;
};
environment.systemPackages = with pkgs; [ sops ];
environment.systemPackages = with pkgs; [sops];
};
}

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.core =
{
flake.modules.nixos.core = {
pkgs,
lib,
config,
userName,
userEmail,
...
}:
let
hasPasswordSecret = lib.hasAttrByPath [ "sops" "secrets" "tux-password" ] config;
in
{
}: let
hasPasswordSecret = lib.hasAttrByPath ["sops" "secrets" "tux-password"] config;
in {
programs.zsh.enable = true;
time.timeZone = "Asia/Kolkata";

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
flake.modules.nixos.desktop = {pkgs, ...}: {
fonts.packages = with pkgs.nerd-fonts; [
fira-code
jetbrains-mono

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
flake.modules.nixos.desktop = {pkgs, ...}: {
programs.gpu-screen-recorder = {
enable = true;
};

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
flake.modules.nixos.desktop = {pkgs, ...}: {
programs.hyprland = {
enable = true;
package = pkgs.hyprland-git.hyprland;

View File

@@ -1,15 +1,9 @@
{
inputs,
...
}:
{
flake.modules.nixos.desktop =
{
{inputs, ...}: {
flake.modules.nixos.desktop = {
pkgs,
lib,
...
}:
{
}: {
imports = [
inputs.mango.nixosModules.mango
];
@@ -28,8 +22,8 @@
"hyprland"
"gtk"
];
"org.freedesktop.impl.portal.ScreenCast" = lib.mkForce [ "hyprland" ];
"org.freedesktop.impl.portal.ScreenShot" = lib.mkForce [ "hyprland" ];
"org.freedesktop.impl.portal.ScreenCast" = lib.mkForce ["hyprland"];
"org.freedesktop.impl.portal.ScreenShot" = lib.mkForce ["hyprland"];
};
};
};

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ brightnessctl ];
flake.modules.nixos.desktop = {pkgs, ...}: {
environment.systemPackages = with pkgs; [brightnessctl];
};
}

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
flake.modules.nixos.desktop = {pkgs, ...}: {
programs.obs-studio = {
enable = true;
enableVirtualCamera = true;

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
flake.modules.nixos.desktop = {pkgs, ...}: {
services = {
gvfs.enable = true;
tumbler.enable = true;

View File

@@ -1,7 +1,5 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ tshell ];
flake.modules.nixos.desktop = {pkgs, ...}: {
environment.systemPackages = with pkgs; [tshell];
};
}

View File

@@ -1,11 +1,9 @@
{
flake.modules.nixos.gaming =
{ pkgs, ... }:
{
flake.modules.nixos.gaming = {pkgs, ...}: {
programs.steam = {
enable = true;
protontricks.enable = true;
extraCompatPackages = with pkgs; [ proton-ge-bin ];
extraCompatPackages = with pkgs; [proton-ge-bin];
};
};
}

View File

@@ -1,5 +1,5 @@
{
flake.modules.nixos.hardware = { pkgs, ... }: {
flake.modules.nixos.hardware = {pkgs, ...}: {
security.rtkit.enable = true;
services.pipewire = {

View File

@@ -1,5 +1,5 @@
{
flake.modules.nixos.hardware = { pkgs, ... }: {
flake.modules.nixos.hardware = {pkgs, ...}: {
hardware.bluetooth = {
enable = true;
};

View File

@@ -1,16 +1,13 @@
{
flake.modules.nixos.networking =
{
flake.modules.nixos.networking = {
config,
lib,
hostName,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.networking.netbird-client;
in
{
in {
options.tnix.networking.netbird-client = {
enable = mkEnableOption "Enable netbird client";
};

View File

@@ -1,15 +1,12 @@
{
flake.modules.nixos.networking =
{
flake.modules.nixos.networking = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.networking.newt;
in
{
in {
options.tnix.networking.newt = {
enable = mkEnableOption "Newt";

View File

@@ -1,25 +1,22 @@
{
flake.modules.nixos.networking =
{
flake.modules.nixos.networking = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.networking.openssh;
# Sops needs acess to the keys before the persist dirs are even mounted; so
# just persisting the keys won't work, we must point at /persist
hasOptinPersistence = config.tnix.boot.impermanence.enable;
in
{
in {
options.tnix.networking.openssh = {
enable = mkEnableOption "Enable OpenSSH server";
ports = mkOption {
type = types.listOf types.port;
default = [ 22 ];
default = [22];
description = ''
Specifies on which ports the SSH daemon listens.
'';

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.aiostreams;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
in {
options.tnix.services.aiostreams = {
enable = mkEnableOption "AIOStreams";

View File

@@ -1,19 +1,16 @@
{ inputs, ... }: {
flake.modules.nixos.services =
{
{inputs, ...}: {
flake.modules.nixos.services = {
config,
lib,
pkgs,
options,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.copyparty;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
in {
imports = [
inputs.copyparty.nixosModules.default
];
@@ -75,7 +72,7 @@
accounts = cfg.accounts;
volumes = cfg.volumes;
package = pkgs.copyparty.override {
extraPackages = [ pkgs.exiftool ];
extraPackages = [pkgs.exiftool];
};
};

View File

@@ -1,16 +1,13 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
pkgs,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.cyber-tux;
in
{
in {
options.tnix.services.cyber-tux = {
enable = mkEnableOption "CyberTux Discord bot";
@@ -41,9 +38,9 @@
config = mkIf cfg.enable {
systemd.services.cyber-tux = {
description = "CyberTux Discord bot";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
after = ["network-online.target"];
wants = ["network-online.target"];
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "simple";
@@ -83,7 +80,7 @@
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
SystemCallFilter = [ "@system-service" ];
SystemCallFilter = ["@system-service"];
UMask = "0077";
};
};
@@ -99,7 +96,7 @@
};
users.groups = mkIf (cfg.group == "cyber-tux") {
${cfg.group} = { };
${cfg.group} = {};
};
};
};

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.gitea;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
in {
options.tnix.services.gitea = {
enable = mkEnableOption "Gitea";
@@ -109,7 +106,7 @@
postgresql = {
enable = true;
ensureDatabases = [ "gitea" ];
ensureDatabases = ["gitea"];
ensureUsers = [
{
name = "gitea";

View File

@@ -1,6 +1,5 @@
{ inputs, ... }: {
flake.modules.nixos.services =
{
{inputs, ...}: {
flake.modules.nixos.services = {
config,
lib,
pkgs,
@@ -8,11 +7,9 @@
userName,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.hermes-agent;
in
{
in {
imports = [
inputs.hermes-agent.nixosModules.default
];
@@ -42,7 +39,7 @@
];
};
users.users.${userName}.extraGroups = [ "hermes" ];
users.users.${userName}.extraGroups = ["hermes"];
};
};
}

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.mediaflow-proxy;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
in {
options.tnix.services.mediaflow-proxy = {
enable = mkEnableOption "MediaFlow Proxy";

View File

@@ -1,16 +1,13 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
userEmail,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.nginx;
in
{
in {
options.tnix.services.nginx = {
enable = mkEnableOption "Nginx";
@@ -30,7 +27,7 @@
"${cfg.domain}" = {
group = "nginx";
domain = "*.${cfg.domain}";
extraDomainNames = [ "${cfg.domain}" ];
extraDomainNames = ["${cfg.domain}"];
dnsProvider = "cloudflare";
credentialFiles = {
CLOUDFLARE_EMAIL_FILE = config.sops.secrets."cloudflare-credentials/email".path;
@@ -41,7 +38,7 @@
};
};
users.users.nginx.extraGroups = [ "acme" ];
users.users.nginx.extraGroups = ["acme"];
services.nginx = {
enable = true;

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
userEmail,
pkgs,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.pangolin;
in
{
in {
options.tnix.services.pangolin = {
enable = mkEnableOption "Pangolin";
@@ -77,7 +74,7 @@
postgresql = {
enable = true;
ensureDatabases = [ "pangolin" ];
ensureDatabases = ["pangolin"];
ensureUsers = [
{
name = "pangolin";

View File

@@ -1,15 +1,12 @@
{ inputs, ... }: {
flake.modules.nixos.services =
{
{inputs, ...}: {
flake.modules.nixos.services = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.trok;
in
{
in {
imports = [
inputs.trok.nixosModules.default
];

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.uptime-kuma;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
in {
options.tnix.services.uptime-kuma = {
enable = mkEnableOption "Uptime Kuma";

View File

@@ -1,17 +1,14 @@
{
flake.modules.nixos.services =
{
flake.modules.nixos.services = {
config,
lib,
...
}:
with lib;
let
with lib; let
cfg = config.tnix.services.vaultwarden;
port = toString cfg.port;
acmeHost = config.tnix.services.nginx.domain;
in
{
in {
options.tnix.services.vaultwarden = {
enable = mkEnableOption "Vaultwarden";
@@ -106,7 +103,7 @@
postgresql = {
enable = true;
ensureDatabases = [ "vaultwarden" ];
ensureDatabases = ["vaultwarden"];
ensureUsers = [
{
name = "vaultwarden";

View File

@@ -1,15 +1,12 @@
{
flake.modules.nixos.virtualisation =
{
flake.modules.nixos.virtualisation = {
config,
lib,
pkgs,
...
}:
let
}: let
cfg = config.tnix.virtualisation;
in
{
in {
options.tnix.virtualisation.distrobox = {
enable = lib.mkEnableOption "Enable DistroBox";
};

View File

@@ -1,16 +1,13 @@
{
flake.modules.nixos.virtualisation =
{
flake.modules.nixos.virtualisation = {
config,
lib,
pkgs,
userName,
...
}:
let
}: let
cfg = config.tnix.virtualisation;
in
{
in {
options.tnix.virtualisation.docker = {
enable = lib.mkEnableOption "Docker container runtime";
nvidia = {
@@ -25,8 +22,8 @@
};
hardware.nvidia-container-toolkit.enable = lib.mkIf cfg.docker.nvidia.enable true;
environment.systemPackages = with pkgs; [ lazydocker ];
users.users.${userName}.extraGroups = [ "docker" ];
environment.systemPackages = with pkgs; [lazydocker];
users.users.${userName}.extraGroups = ["docker"];
};
};
}

View File

@@ -1,16 +1,13 @@
{
flake.modules.nixos.virtualisation =
{
flake.modules.nixos.virtualisation = {
config,
lib,
pkgs,
userName,
...
}:
let
}: let
cfg = config.tnix.virtualisation;
in
{
in {
options.tnix.virtualisation.qemu = {
enable = lib.mkEnableOption "QEMU/KVM virtualization with libvirtd";
};
@@ -26,7 +23,7 @@
spiceUSBRedirection.enable = true;
};
users.users.${userName}.extraGroups = [ "libvirtd" ];
users.users.${userName}.extraGroups = ["libvirtd"];
environment.systemPackages = with pkgs; [
virt-manager
@@ -34,5 +31,4 @@
];
};
};
}

View File

@@ -1,14 +1,11 @@
{
flake.modules.nixos.virtualisation =
{
flake.modules.nixos.virtualisation = {
config,
lib,
...
}:
let
}: let
cfg = config.tnix.virtualisation;
in
{
in {
options.tnix.virtualisation.waydroid = {
enable = lib.mkEnableOption "Waydroid Android container";
};