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,37 +1,38 @@
{ inputs, config, ... }:
{
flake.modules.nixos.core =
{
hostName,
userName,
userEmail,
...
}:
{
imports = [
inputs.home-manager.nixosModules.home-manager
];
inputs,
config,
...
}: {
flake.modules.nixos.core = {
hostName,
userName,
userEmail,
...
}: {
imports = [
inputs.home-manager.nixosModules.home-manager
];
home-manager = {
backupFileExtension = "bak";
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit
inputs
hostName
userName
userEmail
;
};
home-manager = {
backupFileExtension = "bak";
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit
inputs
hostName
userName
userEmail
;
};
users.${userName} = {
imports = [
config.flake.modules.homeManager.core
config.flake.modules.homeManager.shell
config.flake.modules.homeManager.${hostName}
];
};
users.${userName} = {
imports = [
config.flake.modules.homeManager.core
config.flake.modules.homeManager.shell
config.flake.modules.homeManager.${hostName}
];
};
};
};
}

View File

@@ -1,20 +1,18 @@
{
flake.modules.nixos.core =
{
config,
userName,
...
}:
{
programs.nh = {
enable = true;
flake.modules.nixos.core = {
config,
userName,
...
}: {
programs.nh = {
enable = true;
clean = {
enable = !config.nix.gc.automatic;
dates = "weekly";
};
flake = "/home/${userName}/Projects/nixos-config";
clean = {
enable = !config.nix.gc.automatic;
dates = "weekly";
};
flake = "/home/${userName}/Projects/nixos-config";
};
};
}

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,88 +1,86 @@
{
flake.modules.nixos.core =
{ userName, ... }:
{
nix = {
channel.enable = false;
flake.modules.nixos.core = {userName, ...}: {
nix = {
channel.enable = false;
gc = {
automatic = true;
options = "--delete-older-than 7d";
dates = "weekly";
persistent = true;
};
gc = {
automatic = true;
options = "--delete-older-than 7d";
dates = "weekly";
persistent = true;
};
optimise.automatic = true;
optimise.automatic = true;
settings = {
extra-platforms = [
"aarch64-linux"
"arm-linux"
];
settings = {
extra-platforms = [
"aarch64-linux"
"arm-linux"
];
experimental-features = [
"nix-command"
"flakes"
];
experimental-features = [
"nix-command"
"flakes"
];
max-jobs = "auto";
max-jobs = "auto";
# Make legacy nix commands use the XDG base directories instead of creating directories in $HOME.
use-xdg-base-directories = true;
# Make legacy nix commands use the XDG base directories instead of creating directories in $HOME.
use-xdg-base-directories = true;
# The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads.
# It defaults to 25. 0 means no limit.
http-connections = 128;
# The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads.
# It defaults to 25. 0 means no limit.
http-connections = 128;
# This option defines the maximum number of substitution jobs that Nix will try to run in
# parallel. The default is 16. The minimum value one can choose is 1 and lower values will be
# interpreted as 1.
max-substitution-jobs = 128;
# This option defines the maximum number of substitution jobs that Nix will try to run in
# parallel. The default is 16. The minimum value one can choose is 1 and lower values will be
# interpreted as 1.
max-substitution-jobs = 128;
# The number of lines of the tail of the log to show if a build fails.
log-lines = 25;
# The number of lines of the tail of the log to show if a build fails.
log-lines = 25;
# When free disk space in /nix/store drops below min-free during a build, Nix performs a
# garbage-collection until max-free bytes are available or there is no more garbage.
# A value of 0 (the default) disables this feature.
min-free = 128000000; # 128 MB
max-free = 1000000000; # 1 GB
# When free disk space in /nix/store drops below min-free during a build, Nix performs a
# garbage-collection until max-free bytes are available or there is no more garbage.
# A value of 0 (the default) disables this feature.
min-free = 128000000; # 128 MB
max-free = 1000000000; # 1 GB
# Prevent garbage collection from altering nix-shells managed by nix-direnv
# https://github.com/nix-community/nix-direnv#installation
keep-outputs = true;
keep-derivations = true;
# Prevent garbage collection from altering nix-shells managed by nix-direnv
# https://github.com/nix-community/nix-direnv#installation
keep-outputs = true;
keep-derivations = true;
# If set to true, Nix will keep building derivations even if some fail. The default is false.
keep-going = true;
# If set to true, Nix will keep building derivations even if some fail. The default is false.
keep-going = true;
# Automatically detect files in the store that have identical contents, and replaces
# them with hard links to a single copy. This saves disk space.
auto-optimise-store = true;
# Automatically detect files in the store that have identical contents, and replaces
# them with hard links to a single copy. This saves disk space.
auto-optimise-store = true;
# Whether to warn about dirty Git/Mercurial trees.
warn-dirty = false;
# Whether to warn about dirty Git/Mercurial trees.
warn-dirty = false;
# The timeout (in seconds) for establishing connections in the binary cache substituter.
# It corresponds to curls connect-timeout option. A value of 0 means no limit.
connect-timeout = 5;
# The timeout (in seconds) for establishing connections in the binary cache substituter.
# It corresponds to curls connect-timeout option. A value of 0 means no limit.
connect-timeout = 5;
# Allow the use of cachix
trusted-users = [
"root"
"${userName}"
];
allowed-users = [
"root"
"${userName}"
];
# Allow the use of cachix
trusted-users = [
"root"
"${userName}"
];
allowed-users = [
"root"
"${userName}"
];
builders-use-substitutes = true;
builders-use-substitutes = true;
# If set to true, Nix will fall back to building from source if a binary substitute
# fails. This is equivalent to the fallback flag. The default is false.
fallback = true;
};
# If set to true, Nix will fall back to building from source if a binary substitute
# fails. This is equivalent to the fallback flag. The default is false.
fallback = true;
};
};
};
}

View File

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

View File

@@ -1,25 +1,21 @@
{ inputs, ... }:
{
flake.modules.nixos.core =
{
config,
pkgs,
...
}:
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 ];
{inputs, ...}: {
flake.modules.nixos.core = {
config,
pkgs,
...
}: 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];
sops.age = {
sshKeyPaths = map getKeyPath keys;
keyFile = "/var/lib/sops-nix/key.txt";
generateKey = true;
};
environment.systemPackages = with pkgs; [ sops ];
sops.age = {
sshKeyPaths = map getKeyPath keys;
keyFile = "/var/lib/sops-nix/key.txt";
generateKey = true;
};
environment.systemPackages = with pkgs; [sops];
};
}

View File

@@ -1,51 +1,48 @@
{
flake.modules.nixos.core =
{
pkgs,
lib,
config,
userName,
userEmail,
...
}:
let
hasPasswordSecret = lib.hasAttrByPath [ "sops" "secrets" "tux-password" ] config;
in
{
programs.zsh.enable = true;
flake.modules.nixos.core = {
pkgs,
lib,
config,
userName,
userEmail,
...
}: let
hasPasswordSecret = lib.hasAttrByPath ["sops" "secrets" "tux-password"] config;
in {
programs.zsh.enable = true;
time.timeZone = "Asia/Kolkata";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = lib.genAttrs [
"LC_ADDRESS"
"LC_IDENTIFICATION"
"LC_MEASUREMENT"
"LC_MONETARY"
"LC_NAME"
"LC_NUMERIC"
"LC_PAPER"
"LC_TELEPHONE"
"LC_TIME"
] (_: "en_IN");
};
time.timeZone = "Asia/Kolkata";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = lib.genAttrs [
"LC_ADDRESS"
"LC_IDENTIFICATION"
"LC_MEASUREMENT"
"LC_MONETARY"
"LC_NAME"
"LC_NUMERIC"
"LC_PAPER"
"LC_TELEPHONE"
"LC_TIME"
] (_: "en_IN");
};
users = {
mutableUsers = false;
defaultUserShell = pkgs.zsh;
users.${userName} = {
hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path;
initialPassword = lib.mkIf (!hasPasswordSecret) userName;
isNormalUser = true;
extraGroups = [
"networkmanager"
"wheel"
"storage"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}"
];
};
users = {
mutableUsers = false;
defaultUserShell = pkgs.zsh;
users.${userName} = {
hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path;
initialPassword = lib.mkIf (!hasPasswordSecret) userName;
isNormalUser = true;
extraGroups = [
"networkmanager"
"wheel"
"storage"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}"
];
};
};
};
}