flake: reformat with nixfmt

This commit is contained in:
Infinidoge 2025-01-28 20:33:04 -05:00
parent a79e641851
commit eaf4f56ac0
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A
117 changed files with 2667 additions and 1592 deletions

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
# Borg Backup public key:
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINhldH579ixPRSBtTjnzWoDCNyUxUSl1BjogWN3keYBR borg@universe
# This is used to connect to my rsync.net
@ -7,11 +12,7 @@ with lib.our;
let
append = root: path: (root + "/" + path);
excludes' = concatLists
(mapAttrsToList
(root: map (append root))
cfg.excludes
);
excludes' = concatLists (mapAttrsToList (root: map (append root)) cfg.excludes);
commonArgs = {
environment = {
@ -36,12 +37,19 @@ let
};
};
mkJob = paths: commonArgs // {
inherit paths;
inherit (cfg) repo;
exclude = map (append paths) (excludes' ++ cfg.extraExcludes);
startAt = if cfg.backupTimes ? "${config.networking.hostName}" then "*-*-* ${cfg.backupTimes.${config.networking.hostName}}" else [ ];
};
mkJob =
paths:
commonArgs
// {
inherit paths;
inherit (cfg) repo;
exclude = map (append paths) (excludes' ++ cfg.extraExcludes);
startAt =
if cfg.backupTimes ? "${config.networking.hostName}" then
"*-*-* ${cfg.backupTimes.${config.networking.hostName}}"
else
[ ];
};
cfg = config.modules.backups;
in
@ -106,11 +114,12 @@ in
(mkIf cfg.enable {
services.borgbackup.jobs = mapAttrs (_: mkJob) cfg.jobs;
systemd.timers = lib.mapAttrs'
(n: _: lib.nameValuePair "borgbackup-job-${n}" {
systemd.timers = lib.mapAttrs' (
n: _:
lib.nameValuePair "borgbackup-job-${n}" {
requires = [ "network-online.target" ];
})
cfg.jobs;
}
) cfg.jobs;
persist.directories = [
"/root/.cache/borg"

View file

@ -2,7 +2,9 @@
{
nix.settings = {
substituters = lib.flatten [
(lib.optional (config.networking.hostName != "Infini-DESKTOP" && config.info.loc.home) "ssh://infini-desktop?priority=9")
(lib.optional (
config.networking.hostName != "Infini-DESKTOP" && config.info.loc.home
) "ssh://infini-desktop?priority=9")
"https://hydra.inx.moe?priority=10"
];
trusted-public-keys = [

View file

@ -1,4 +1,10 @@
{ config, common, secrets, lib, ... }:
{
config,
common,
secrets,
lib,
...
}:
{
programs = {
# Enable dconf for programs that need it

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}:
{
home-manager = {
useUserPackages = lib.mkDefault true;
useGlobalPkgs = true;

View file

@ -1,4 +1,9 @@
{ config, pkgs, private, ... }:
{
config,
pkgs,
private,
...
}:
{
imports = [ private.nixosModules.networking ];
@ -27,7 +32,10 @@
#"100.100.100.100"
];
firewall.trustedInterfaces = [ "br-+" "tailscale0" ];
firewall.trustedInterfaces = [
"br-+"
"tailscale0"
];
nftables = {
enable = true;

View file

@ -1,6 +1,17 @@
{ config, inputs, pkgs, lib, ... }:
{
config,
inputs,
pkgs,
lib,
...
}:
let
inherit (lib) mkIf mkDefault filterAttrs mapAttrs';
inherit (lib)
mkIf
mkDefault
filterAttrs
mapAttrs'
;
in
{
nix = {
@ -8,9 +19,19 @@ in
settings = {
allowed-users = [ "*" ];
trusted-users = [ "root" "@wheel" "remotebuild" "nix-ssh" ];
trusted-users = [
"root"
"@wheel"
"remotebuild"
"nix-ssh"
];
system-features = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
system-features = [
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
];
experimental-features = [
"flakes"
"nix-command"
@ -52,7 +73,12 @@ in
let
flakes = filterAttrs (n: v: v ? outputs) inputs;
in
(mapAttrs' (n: v: { name = if n == "self" then "universe" else n; value = { flake = v; }; }) flakes)
(mapAttrs' (n: v: {
name = if n == "self" then "universe" else n;
value = {
flake = v;
};
}) flakes)
// {
nixpkgs-git = {
exact = false;

View file

@ -1,5 +1,10 @@
# Heavily inspired by hlissner: https://github.com/hlissner/dotfiles/blob/master/modules/options.nix
{ config, options, lib, ... }:
{
config,
options,
lib,
...
}:
with lib;
with lib.our;
let
@ -40,7 +45,11 @@ in
universe = {
packages = packageListOpt;
shellAliases = mkOpt (attrsOf str) { };
variables = mkOpt (attrsOf (oneOf [ (listOf str) str path ])) { };
variables = mkOpt (attrsOf (oneOf [
(listOf str)
str
path
])) { };
media.enable = mkBoolOpt false;
minimal.enable = mkBoolOpt false;
};

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
{
# Use the latest Linux kernel
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
@ -7,80 +12,96 @@
environment.defaultPackages = lib.mkForce [ ];
# Packages wanted everywhere
universe.packages = with pkgs; [
universe-cli
universe.packages =
with pkgs;
[
universe-cli
agenix
bat
cloc
cryptsetup
curl
difftastic
direnv
dnsutils
erdtree
eza
fd
fzf
gnumake
gptfdisk
gum
htop
hyfetch
iputils
jq
man-pages
man-pages-posix
nmap
openssl
parallel
parted
pciutils
perl
rhash
ripgrep
rsync
skim
sshfs
strace
tealdeer
unixtools.whereis
unrar-wrapper
unzip
util-linux
wget
whois
xxHash
yq
zip
] ++ (lib.optionals config.universe.media.enable (with pkgs; [
ghostscript
graphviz
imagemagick
pandoc
yt-dlp
]));
agenix
bat
cloc
cryptsetup
curl
difftastic
direnv
dnsutils
erdtree
eza
fd
fzf
gnumake
gptfdisk
gum
htop
hyfetch
iputils
jq
man-pages
man-pages-posix
nmap
openssl
parallel
parted
pciutils
perl
rhash
ripgrep
rsync
skim
sshfs
strace
tealdeer
unixtools.whereis
unrar-wrapper
unzip
util-linux
wget
whois
xxHash
yq
zip
]
++ (lib.optionals config.universe.media.enable (
with pkgs;
[
ghostscript
graphviz
imagemagick
pandoc
yt-dlp
]
));
environment.systemPackages = config.universe.packages ++ (with pkgs; [
binutils
btrfs-progs
bubblewrap
compsize
coreutils-doge
dosfstools
exfat # Windows drives
kitty.terminfo
ntfs3g # Windows drives
smartmontools
usbutils
environment.systemPackages =
config.universe.packages
++ (with pkgs; [
binutils
btrfs-progs
bubblewrap
compsize
coreutils-doge
dosfstools
exfat # Windows drives
kitty.terminfo
ntfs3g # Windows drives
smartmontools
usbutils
# covered by home manager
git
vim
]) ++ (lib.optionals config.info.graphical (with pkgs; [
arandr
])) ++ (lib.optionals config.universe.media.enable (with pkgs; [
ffmpeg-full
mpv
]));
# covered by home manager
git
vim
])
++ (lib.optionals config.info.graphical (
with pkgs;
[
arandr
]
))
++ (lib.optionals config.universe.media.enable (
with pkgs;
[
ffmpeg-full
mpv
]
));
}

View file

@ -6,13 +6,22 @@ in
persist = {
directories = flatten [
"/home"
{ directory = "/etc/nixos"; user = "infinidoge"; }
{ directory = "/etc/nixos-private"; user = "infinidoge"; }
{
directory = "/etc/nixos";
user = "infinidoge";
}
{
directory = "/etc/nixos-private";
user = "infinidoge";
}
"/var/log"
"/var/lib/nixos"
"/var/lib/systemd/"
{ directory = "/var/lib/tailscale"; mode = "0700"; }
{
directory = "/var/lib/tailscale";
mode = "0700";
}
"/root/.ssh"

View file

@ -1,33 +1,39 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) flip;
inherit (lib.our) mkBoolOpt' addPackageLists;
cfg = config.universe.programming;
programmingOpt' = kind: flip mkBoolOpt' "Programming: ${kind}";
programmingOpt = flip programmingOpt' cfg.all.enable;
in
{
options.universe.programming = (addPackageLists {
base.enable = programmingOpt' "Base packages" true;
options.universe.programming =
(addPackageLists {
base.enable = programmingOpt' "Base packages" true;
c.enable = programmingOpt' "C" true;
csharp.enable = programmingOpt "C#";
haskell.enable = programmingOpt "Haskell";
java.enable = programmingOpt "Java";
lua.enable = programmingOpt "Lua";
nim.enable = programmingOpt "Nim";
python.enable = programmingOpt' "Python" true;
racket.enable = programmingOpt "Racket";
rust.enable = programmingOpt "Rust";
zig.enable = programmingOpt "Zig";
latex.enable = programmingOpt "LaTeX";
html.enable = programmingOpt "HTML";
}) // {
all.enable = programmingOpt' "All languages" false;
};
c.enable = programmingOpt' "C" true;
csharp.enable = programmingOpt "C#";
haskell.enable = programmingOpt "Haskell";
java.enable = programmingOpt "Java";
lua.enable = programmingOpt "Lua";
nim.enable = programmingOpt "Nim";
python.enable = programmingOpt' "Python" true;
racket.enable = programmingOpt "Racket";
rust.enable = programmingOpt "Rust";
zig.enable = programmingOpt "Zig";
latex.enable = programmingOpt "LaTeX";
html.enable = programmingOpt "HTML";
})
// {
all.enable = programmingOpt' "All languages" false;
};
config = {
universe.programming = with pkgs; {
@ -60,7 +66,6 @@ in
cabal2nix
];
java.packages = [
openjdk
clang-tools
@ -75,15 +80,17 @@ in
];
python.packages = [
(python312.withPackages (p: with p; [
black
isort
jupyter
mypy
pip
pyflakes
pytest
]))
(python312.withPackages (
p: with p; [
black
isort
jupyter
mypy
pip
pyflakes
pytest
]
))
pipenv
ruff
];
@ -93,12 +100,15 @@ in
];
rust.packages = [
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
}))
(rust-bin.selectLatestNightlyWith (
toolchain:
toolchain.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
}
))
gcc
];
@ -142,9 +152,9 @@ in
];
};
universe.packages = lib.concatMap
(v: lib.optionals (v ? packages && v.enable) v.packages)
(lib.attrValues cfg);
universe.packages = lib.concatMap (v: lib.optionals (v ? packages && v.enable) v.packages) (
lib.attrValues cfg
);
programs.java.enable = cfg.java.enable;

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
let
inherit (config.nixpkgs.hostPlatform) system;
@ -32,8 +37,12 @@ in
hardware = {
enableRedistributableFirmware = mkDefault true;
cpu.intel.updateMicrocode = mkDefault (config.hardware.enableRedistributableFirmware && system == "x86_64-linux");
cpu.amd.updateMicrocode = mkDefault (config.hardware.enableRedistributableFirmware && system == "x86_64-linux");
cpu.intel.updateMicrocode = mkDefault (
config.hardware.enableRedistributableFirmware && system == "x86_64-linux"
);
cpu.amd.updateMicrocode = mkDefault (
config.hardware.enableRedistributableFirmware && system == "x86_64-linux"
);
};
users.mutableUsers = false;

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
ifSudo = lib.mkIf config.security.sudo.enable;
ifSudo' = text: if config.security.sudo.enable then "sudo ${text}" else text;
@ -43,7 +48,6 @@ in
gcd = "cd $(git root || echo \".\")";
ucd = "cd $(uni cd || echo \".\")";
# grep
grep = "rg";
gi = "grep -i";

View file

@ -12,14 +12,19 @@ with lib;
ClientAliveInterval = 60;
TCPKeepAlive = "yes";
};
hostKeys = mkDefault [{
path = "/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}];
hostKeys = mkDefault [
{
path = "/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
];
knownHosts = {
"github.com" = {
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
extraHostNames = [ "ssh.github.com" "ssh.github.com:443" ];
extraHostNames = [
"ssh.github.com"
"ssh.github.com:443"
];
};
};
};

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
with lib.our;
let
@ -16,7 +21,8 @@ in
};
programs.dconf.enable = mkIf cfg.libvirtd.enable true;
environment.systemPackages = (optional cfg.libvirtd.enable pkgs.virt-manager)
environment.systemPackages =
(optional cfg.libvirtd.enable pkgs.virt-manager)
++ (optional cfg.docker.enable pkgs.docker-compose);
persist.directories = optional cfg.libvirtd.enable "/var/lib/libvirt";
};