Format everything with alejandra

This commit is contained in:
Toast 2024-03-20 12:54:25 +01:00
parent 82bbd7ce87
commit 7888103b1e
100 changed files with 2827 additions and 2756 deletions

View file

@ -1,132 +1,136 @@
{ config, lib, pkgs, flakeSelf, ... }:
{
imports = [ flakeSelf.inputs.nur.nixosModules.nur ];
environment = {
# As of the 1st of May 2023, the default packages are nano, perl, rsync and strace
# I don't need any of them, so I just empty the list
defaultPackages = [];
};
config,
lib,
pkgs,
flakeSelf,
...
}: {
imports = [flakeSelf.inputs.nur.nixosModules.nur];
environment = {
# As of the 1st of May 2023, the default packages are nano, perl, rsync and strace
# I don't need any of them, so I just empty the list
defaultPackages = [];
};
# Set up /tmp
boot.tmp = {
useTmpfs = false;
# Cleaning out /tmp at boot if it's a tmpfs is quite stupid
cleanOnBoot = !config.boot.tmp.useTmpfs;
};
# Set up /tmp
boot.tmp = {
useTmpfs = false;
# Cleaning out /tmp at boot if it's a tmpfs is quite stupid
cleanOnBoot = !config.boot.tmp.useTmpfs;
};
# Set up zram
zramSwap = {
enable = true;
priority = 100;
memoryPercent = 60;
# zstd my beloved <3
algorithm = "zstd";
};
# zswap with zram is not a good idea
boot.kernelParams = [ "zswap.enabled=0" ];
# Set up zram
zramSwap = {
enable = true;
priority = 100;
memoryPercent = 60;
# zstd my beloved <3
algorithm = "zstd";
};
# zswap with zram is not a good idea
boot.kernelParams = ["zswap.enabled=0"];
# Set up keyboard layout
services.xserver.xkb.layout = "es";
# Set up keyboard layout
services.xserver.xkb.layout = "es";
# Set up console
console = {
packages = [ pkgs.terminus_font ];
earlySetup = true;
# mkDefault has 1000 priority, so that way I don't conflict with nixos-hardware
font = lib.mkOverride 999 "ter-i16n";
# Make the console use X's keyboard configuration
useXkbConfig = true;
};
# Set up console
console = {
packages = [pkgs.terminus_font];
earlySetup = true;
# mkDefault has 1000 priority, so that way I don't conflict with nixos-hardware
font = lib.mkOverride 999 "ter-i16n";
# Make the console use X's keyboard configuration
useXkbConfig = true;
};
boot.supportedFilesystems = [ "nfs" ];
# Set up localisation
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_NUMERIC = "es_ES.UTF-8";
# am/pm is nice but mm/dd/yy is yucky
LC_TIME = "es_US.UTF-8";
LC_MONETARY = "es_ES.UTF-8";
LC_MEASUREMENT = "es_ES.UTF-8";
LC_PAPER = "es_ES.UTF-8";
LC_ADDRESS = "es_US.UTF-8";
LC_NAME = "es_ES.UTF-8";
LC_TELEPHONE = "es_ES.UTF-8";
};
};
boot.supportedFilesystems = ["nfs"];
services.fwupd.enable = true;
# Set up localisation
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_NUMERIC = "es_ES.UTF-8";
# am/pm is nice but mm/dd/yy is yucky
LC_TIME = "es_US.UTF-8";
LC_MONETARY = "es_ES.UTF-8";
LC_MEASUREMENT = "es_ES.UTF-8";
LC_PAPER = "es_ES.UTF-8";
LC_ADDRESS = "es_US.UTF-8";
LC_NAME = "es_ES.UTF-8";
LC_TELEPHONE = "es_ES.UTF-8";
};
};
# Set up my user
users.users.toast = {
isNormalUser = true;
description = "Toast";
extraGroups = [ "wheel" ];
};
services.fwupd.enable = true;
# Set up time zone.
time.timeZone = "Europe/Madrid";
# Set up my user
users.users.toast = {
isNormalUser = true;
description = "Toast";
extraGroups = ["wheel"];
};
nixpkgs.overlays = [
(
final: prev: {
catppuccin = prev.catppuccin.override {
accent = "mauve";
variant = "mocha";
themeList = [
"bat"
"btop"
"starship"
"grub"
];
};
}
)
];
# Set up time zone.
time.timeZone = "Europe/Madrid";
home-manager = {
backupFileExtension = "hm-backup";
useGlobalPkgs = true;
verbose = true;
users.toast = { config, ... }: {
home.stateVersion = "23.11";
xdg = {
userDirs = {
enable = true;
createDirectories = true;
publicShare = null; # Disable the public folder
};
};
};
};
nixpkgs.overlays = [
(
final: prev: {
catppuccin = prev.catppuccin.override {
accent = "mauve";
variant = "mocha";
themeList = [
"bat"
"btop"
"starship"
"grub"
];
};
}
)
];
# Set up secrets
age = {
identityPaths = [
"/persist/id_host"
];
};
home-manager = {
backupFileExtension = "hm-backup";
useGlobalPkgs = true;
verbose = true;
users.toast = {config, ...}: {
home.stateVersion = "23.11";
xdg = {
userDirs = {
enable = true;
createDirectories = true;
publicShare = null; # Disable the public folder
};
};
};
};
boot.loader.grub = {
theme = "${pkgs.catppuccin}/grub";
backgroundColor = "#1E1E2E";
splashImage = "${pkgs.catppuccin}/grub/background.png";
};
# Set up secrets
age = {
identityPaths = [
"/persist/id_host"
];
};
/*
I used to keep the host keys in the repo as a secret, but since I use the
host keys for decrypting too I'm not sure encrypting a key with itself
is a good idea. Now the host keys will need to be placed manually where they are needed
For first time installs they are generated by services.openssh.hostKeys on servers, and
manually on everything else
*/
system = {
stateVersion = "23.11";
# Nix on nixos 23.05 does not have dirtyRev
configurationRevision = flakeSelf.sourceInfo.rev or flakeSelf.sourceInfo.dirtyRev or "dirty";
nixos.variant_id = lib.strings.toLower config.networking.hostName;
};
boot.loader.grub = {
theme = "${pkgs.catppuccin}/grub";
backgroundColor = "#1E1E2E";
splashImage = "${pkgs.catppuccin}/grub/background.png";
};
/*
I used to keep the host keys in the repo as a secret, but since I use the
host keys for decrypting too I'm not sure encrypting a key with itself
is a good idea. Now the host keys will need to be placed manually where they are needed
For first time installs they are generated by services.openssh.hostKeys on servers, and
manually on everything else
*/
system = {
stateVersion = "23.11";
# Nix on nixos 23.05 does not have dirtyRev
configurationRevision = flakeSelf.sourceInfo.rev or flakeSelf.sourceInfo.dirtyRev or "dirty";
nixos.variant_id = lib.strings.toLower config.networking.hostName;
};
}

View file

@ -1,9 +1,7 @@
{ ... }:
{
imports = [
./programs
./services
./configuration.nix
];
{...}: {
imports = [
./programs
./services
./configuration.nix
];
}

View file

@ -1,10 +1,8 @@
{ config, ... }:
{
home-manager.users.toast = { config, ... }: {
programs.bash = {
enable = true;
enableVteIntegration = true;
};
};
{config, ...}: {
home-manager.users.toast = {config, ...}: {
programs.bash = {
enable = true;
enableVteIntegration = true;
};
};
}

View file

@ -1,21 +1,25 @@
{ config, pkgs, ... }:
let
themeName = if config.system.nixos.release == "23.11" then "Catppuccin-mocha" else "Catppuccin Mocha";
in
{
home-manager = {
users.toast.programs.bat = {
enable = true;
config = {
theme = "catppuccin-mocha";
};
themes = {
catppuccin-mocha = {
src = pkgs.catppuccin;
file = "bat/${themeName}.tmTheme";
};
};
};
};
config,
pkgs,
...
}: let
themeName =
if config.system.nixos.release == "23.11"
then "Catppuccin-mocha"
else "Catppuccin Mocha";
in {
home-manager = {
users.toast.programs.bat = {
enable = true;
config = {
theme = "catppuccin-mocha";
};
themes = {
catppuccin-mocha = {
src = pkgs.catppuccin;
file = "bat/${themeName}.tmTheme";
};
};
};
};
}

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
home-manager = {
users.toast = {
programs.btop = {
@ -14,4 +12,4 @@
};
};
};
}
}

View file

@ -1,8 +1,10 @@
{ config, pkgs, ... }:
{
# Use nix-index-database's comma wrapper
programs.nix-index-database.comma.enable = true;
# Run programs from the system's nixpkgs
environment.variables = { COMMA_NIXPKGS_FLAKE="system"; };
config,
pkgs,
...
}: {
# Use nix-index-database's comma wrapper
programs.nix-index-database.comma.enable = true;
# Run programs from the system's nixpkgs
environment.variables = {COMMA_NIXPKGS_FLAKE = "system";};
}

View file

@ -1,6 +1,4 @@
{ config, ... }:
{
# The nixpkgs command-not-found script does not work with flakes, so I disable it
programs.command-not-found.enable = false;
{config, ...}: {
# The nixpkgs command-not-found script does not work with flakes, so I disable it
programs.command-not-found.enable = false;
}

View file

@ -1,32 +1,34 @@
{ config, pkgs, ... }:
{
imports = [
./htop.nix
./nix.nix
./micro.nix
./nix-index.nix
./command-not-found.nix
./comma.nix
./bash.nix
./git.nix
./starship.nix
./bat.nix
./btop.nix
./helix.nix
./direnv.nix
];
# Some programs dont have a programs.*.enable option, so I install their package here
environment.systemPackages = with pkgs; [
speedtest-cli
# Bat has a home manager module, but I want it to be available system wide
bat
file
nvd
ncdu
tree
btdu
iperf3
restic
];
config,
pkgs,
...
}: {
imports = [
./htop.nix
./nix.nix
./micro.nix
./nix-index.nix
./command-not-found.nix
./comma.nix
./bash.nix
./git.nix
./starship.nix
./bat.nix
./btop.nix
./helix.nix
./direnv.nix
];
# Some programs dont have a programs.*.enable option, so I install their package here
environment.systemPackages = with pkgs; [
speedtest-cli
# Bat has a home manager module, but I want it to be available system wide
bat
file
nvd
ncdu
tree
btdu
iperf3
restic
];
}

View file

@ -1,6 +1,4 @@
{ ... }:
{
{...}: {
programs.direnv = {
enable = true;
nix-direnv = {

View file

@ -1,34 +1,33 @@
{ config, pkgs, ... }:
let
catppuccinDelta = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "delta";
rev = "main";
hash = "sha256-0QQLkfLBVuB2re6tjtPNuOQZNK0MDBAIFgNGHZM8afs=";
};
in
{
home-manager.users.toast = {
programs.git = {
enable = true;
userName = "Toast";
userEmail = "toast003@tutamail.com";
delta = {
enable = true;
options = {
syntax-theme = "catppuccin-mocha";
features = "catppuccin-mocha";
};
};
includes = [{ path = "${catppuccinDelta}/themes/mocha.gitconfig"; }];
extraConfig = {
init.defaultBranch = "main";
diff.colorMoved = "default";
commit.verbose = "true";
};
};
};
config,
pkgs,
...
}: let
catppuccinDelta = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "delta";
rev = "main";
hash = "sha256-0QQLkfLBVuB2re6tjtPNuOQZNK0MDBAIFgNGHZM8afs=";
};
in {
home-manager.users.toast = {
programs.git = {
enable = true;
userName = "Toast";
userEmail = "toast003@tutamail.com";
delta = {
enable = true;
options = {
syntax-theme = "catppuccin-mocha";
features = "catppuccin-mocha";
};
};
includes = [{path = "${catppuccinDelta}/themes/mocha.gitconfig";}];
extraConfig = {
init.defaultBranch = "main";
diff.colorMoved = "default";
commit.verbose = "true";
};
};
};
}

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
home-manager.users.toast = {
programs.helix = {
enable = true;
@ -9,7 +7,7 @@
nixpkgs-fmt
nil
];
settings = {
settings = {
theme = "catppuccin_mocha";
editor = {
mouse = true;

View file

@ -1,15 +1,13 @@
{ config, ... }:
{
programs.htop = {
enable = true;
settings = {
tree_view = 1;
highlight_base_name = 1;
show_program_path = 0;
show_cpu_frequency = 1;
show_cpu_temperature = 1;
hide_userland_threads = 1;
};
};
{config, ...}: {
programs.htop = {
enable = true;
settings = {
tree_view = 1;
highlight_base_name = 1;
show_program_path = 0;
show_cpu_frequency = 1;
show_cpu_temperature = 1;
hide_userland_threads = 1;
};
};
}

View file

@ -1,17 +1,22 @@
{ config, pkgs, ... }:
{
home-manager = {
users.toast = { config, pkgs, ... }:
{
programs.micro = {
enable = true;
settings = {
clipboard = "internal";
indentchar = "|";
softwrap = true;
};
};
};
};
config,
pkgs,
...
}: {
home-manager = {
users.toast = {
config,
pkgs,
...
}: {
programs.micro = {
enable = true;
settings = {
clipboard = "internal";
indentchar = "|";
softwrap = true;
};
};
};
};
}

View file

@ -1,15 +1,15 @@
{ config, ... }:
{
/* environment.systemPackages = [ pkgs.nix-index ];
programs.bash.interactiveShellInit = ''
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
''; */
programs.nix-index = {
enable = true;
enableBashIntegration = true;
# I don't use zsh or fish (yet)
enableZshIntegration = false;
enableFishIntegration = false;
};
{config, ...}: {
/*
environment.systemPackages = [ pkgs.nix-index ];
programs.bash.interactiveShellInit = ''
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
'';
*/
programs.nix-index = {
enable = true;
enableBashIntegration = true;
# I don't use zsh or fish (yet)
enableZshIntegration = false;
enableFishIntegration = false;
};
}

View file

@ -1,25 +1,34 @@
{ config, systemPkgs, ... }:
{
nix = {
settings = {
auto-optimise-store = true;
experimental-features = "nix-command flakes";
};
optimise = {
automatic = true;
dates = [ "weekly" ];
};
registry = {
agenix = {
from = { id = "agenix"; type = "indirect"; };
to = { owner = "ryantm"; repo = "agenix"; type = "github"; };
};
# Write the system's nixpkgs into the registry to avoid mixing nixpkgs versions
# https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html
system.flake = systemPkgs;
};
# I removed this in the past since I thought that I didn't need it, but turns out comma does :)
nixPath = [ "nixpkgs=${systemPkgs}" ];
};
config,
systemPkgs,
...
}: {
nix = {
settings = {
auto-optimise-store = true;
experimental-features = "nix-command flakes";
};
optimise = {
automatic = true;
dates = ["weekly"];
};
registry = {
agenix = {
from = {
id = "agenix";
type = "indirect";
};
to = {
owner = "ryantm";
repo = "agenix";
type = "github";
};
};
# Write the system's nixpkgs into the registry to avoid mixing nixpkgs versions
# https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html
system.flake = systemPkgs;
};
# I removed this in the past since I thought that I didn't need it, but turns out comma does :)
nixPath = ["nixpkgs=${systemPkgs}"];
};
}

View file

@ -1,53 +1,52 @@
{ pkgs, lib, ... }:
with lib;
with builtins;
let
catppuccinFlavour = "mocha";
catppuccinStarship = pkgs.catppuccin + /starship/${catppuccinFlavour}.toml;
presets = {
nerdFontSymbols = pkgs.fetchurl {
url = "https://starship.rs/presets/toml/nerd-font-symbols.toml";
hash = "sha256-BVe5JMSIa3CoY2Wf9pvcF1EUtDVCWCLhW3IyKuwfHug=";
};
};
# -------------------------------- F U N C T I O N S --------------------------------
/*
Gonna be honest, I have no idea how this works, although it seems to work
Stolen from https://gist.github.com/pdalpra/daf339f59288201a6c8ba7dc84e9060e
*/
# Takes a list of attrSets and merges them
mergeAllAttrSets = attrsSets:
foldl' (recursiveUpdate) {} attrsSets;
# Reads a TOML file and parses it
readTomlPreset = file: (fromTOML (readFile file));
in
{
programs.starship = {
enable = true;
settings = mergeAllAttrSets [
(readTomlPreset presets.nerdFontSymbols)
(readTomlPreset catppuccinStarship)
{
nix_shell = {
disabled = false;
heuristic = true;
};
os = {
disabled = false;
};
directory = {
disabled = false;
truncation_length = 6;
truncation_symbol = ".../";
};
palette = "catppuccin_${catppuccinFlavour}";
}
];
};
pkgs,
lib,
...
}:
with lib;
with builtins; let
catppuccinFlavour = "mocha";
catppuccinStarship = pkgs.catppuccin + /starship/${catppuccinFlavour}.toml;
presets = {
nerdFontSymbols = pkgs.fetchurl {
url = "https://starship.rs/presets/toml/nerd-font-symbols.toml";
hash = "sha256-BVe5JMSIa3CoY2Wf9pvcF1EUtDVCWCLhW3IyKuwfHug=";
};
};
# -------------------------------- F U N C T I O N S --------------------------------
/*
Gonna be honest, I have no idea how this works, although it seems to work
Stolen from https://gist.github.com/pdalpra/daf339f59288201a6c8ba7dc84e9060e
*/
# Takes a list of attrSets and merges them
mergeAllAttrSets = attrsSets:
foldl' recursiveUpdate {} attrsSets;
# Reads a TOML file and parses it
readTomlPreset = file: (fromTOML (readFile file));
in {
programs.starship = {
enable = true;
settings = mergeAllAttrSets [
(readTomlPreset presets.nerdFontSymbols)
(readTomlPreset catppuccinStarship)
{
nix_shell = {
disabled = false;
heuristic = true;
};
os = {
disabled = false;
};
directory = {
disabled = false;
truncation_length = 6;
truncation_symbol = ".../";
};
palette = "catppuccin_${catppuccinFlavour}";
}
];
};
}

View file

@ -1,19 +1,23 @@
{ config, ... }:
let
old = {
nssmdns = true;
};
new = {
nssmdns4 = true;
};
in
{
/*
NixOS 24.05 changed the option for mnds to be able to turn on/off IPv6
23.11 doesn't support this, so I need to use the conditional to be able to
use the same config for both
*/
services.avahi = {
enable = true;
} // (if config.system.nixos.release == "23.11" then old else new);
{config, ...}: let
old = {
nssmdns = true;
};
new = {
nssmdns4 = true;
};
in {
/*
NixOS 24.05 changed the option for mnds to be able to turn on/off IPv6
23.11 doesn't support this, so I need to use the conditional to be able to
use the same config for both
*/
services.avahi =
{
enable = true;
}
// (
if config.system.nixos.release == "23.11"
then old
else new
);
}

View file

@ -1,9 +1,7 @@
{ ... }:
{
imports = [
./avahi.nix
./tailscale.nix
./syncthing.nix
];
{...}: {
imports = [
./avahi.nix
./tailscale.nix
./syncthing.nix
];
}

View file

@ -1,60 +1,60 @@
{ config, flakeSelf, ... }:
let
hostSecrets = "${flakeSelf.inputs.secrets}/" + config.networking.hostName;
in
{
# Get secrets
age.secrets = {
syncthingKey.file = hostSecrets + "/syncthingKey.age";
syncthingCert.file = hostSecrets + "/syncthingCert.age";
};
config,
flakeSelf,
...
}: let
hostSecrets = "${flakeSelf.inputs.secrets}/" + config.networking.hostName;
in {
# Get secrets
age.secrets = {
syncthingKey.file = hostSecrets + "/syncthingKey.age";
syncthingCert.file = hostSecrets + "/syncthingCert.age";
};
services.syncthing = {
key = config.age.secrets.syncthingKey.path;
cert = config.age.secrets.syncthingCert.path;
overrideDevices = true;
overrideFolders = true;
openDefaultPorts = true;
settings = {
options = {
urAccepted = 3;
};
# Set up devices and folders common to every device
devices = {
"phone" = {
name = "Xiaomi Redmi Note 10 Pro";
id = "K7KNZ5V-XREUADL-CROQXPV-6AA4H65-2VUD34Z-VQWKJ6S-LWWW4EE-XPNEZQ6";
};
"pc" = {
name = "Archie";
id = "NJPX754-64AQNP3-7GZFIRZ-W2EDRJQ-27ORWYM-X5YXEXQ-ERRTRTQ-BSYD4AY";
};
"steamdeck" = {
name = "Steam Deck";
id = "DNFEGEA-PDEVW5A-O5VBVQK-IUXI7J5-MAHCQAG-2JLEFFM-DSXB6AS-TX6ZHAN";
};
"server" = {
name = "Everest";
id = "2GXFZJZ-CF56ER2-SISBGOF-VNXJIG5-GQC6ECA-NHCHAPX-677RSJT-RI5POAZ";
};
"surface" = {
name = "Surface Go";
id = "HTVSF3O-AHY3TNH-BLVSEGK-HRRSMHC-H5LJWVF-NDKGM6O-ATWZALC-YXNV2Q4";
};
"winmax2" = {
name = "Win Max 2";
id = "X2NILRM-ADRBQ23-AFREAZA-62GVFDF-UVMPR4L-KGHMUNY-BJ2C3CQ-RBT43QS";
};
};
folders = {
"passwords" = {
label = "KeePassXC Passwords";
id = "rdyaq-ex659";
devices = [ "phone" "pc" "steamdeck" "server" "surface" "winmax2"];
};
};
};
};
services.syncthing = {
key = config.age.secrets.syncthingKey.path;
cert = config.age.secrets.syncthingCert.path;
overrideDevices = true;
overrideFolders = true;
openDefaultPorts = true;
settings = {
options = {
urAccepted = 3;
};
# Set up devices and folders common to every device
devices = {
"phone" = {
name = "Xiaomi Redmi Note 10 Pro";
id = "K7KNZ5V-XREUADL-CROQXPV-6AA4H65-2VUD34Z-VQWKJ6S-LWWW4EE-XPNEZQ6";
};
"pc" = {
name = "Archie";
id = "NJPX754-64AQNP3-7GZFIRZ-W2EDRJQ-27ORWYM-X5YXEXQ-ERRTRTQ-BSYD4AY";
};
"steamdeck" = {
name = "Steam Deck";
id = "DNFEGEA-PDEVW5A-O5VBVQK-IUXI7J5-MAHCQAG-2JLEFFM-DSXB6AS-TX6ZHAN";
};
"server" = {
name = "Everest";
id = "2GXFZJZ-CF56ER2-SISBGOF-VNXJIG5-GQC6ECA-NHCHAPX-677RSJT-RI5POAZ";
};
"surface" = {
name = "Surface Go";
id = "HTVSF3O-AHY3TNH-BLVSEGK-HRRSMHC-H5LJWVF-NDKGM6O-ATWZALC-YXNV2Q4";
};
"winmax2" = {
name = "Win Max 2";
id = "X2NILRM-ADRBQ23-AFREAZA-62GVFDF-UVMPR4L-KGHMUNY-BJ2C3CQ-RBT43QS";
};
};
folders = {
"passwords" = {
label = "KeePassXC Passwords";
id = "rdyaq-ex659";
devices = ["phone" "pc" "steamdeck" "server" "surface" "winmax2"];
};
};
};
};
}

View file

@ -1,12 +1,14 @@
{ config, lib, ... }:
{
services.tailscale = {
enable = true;
useRoutingFeatures = lib.mkDefault "client";
};
config,
lib,
...
}: {
services.tailscale = {
enable = true;
useRoutingFeatures = lib.mkDefault "client";
};
systemd.services.tailscaled.environment = {
TS_NO_LOGS_NO_SUPPORT = "true";
};
systemd.services.tailscaled.environment = {
TS_NO_LOGS_NO_SUPPORT = "true";
};
}