chore: reformat codebase

This commit is contained in:
Gabriel Arazas 2025-01-29 12:48:19 +08:00
parent e89ea98f8b
commit 71be6e4bc1
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
315 changed files with 5888 additions and 6872 deletions

View File

@ -7,8 +7,7 @@
let let
pkgs = import <nixpkgs> { }; pkgs = import <nixpkgs> { };
lib = pkgs.lib; lib = pkgs.lib;
in in import <nixpkgs/nixos/lib/eval-config.nix> {
import <nixpkgs/nixos/lib/eval-config.nix> {
inherit lib; inherit lib;
specialArgs = { specialArgs = {
foodogsquaredUtils = import <config/lib/utils/nixos.nix> { inherit lib; }; foodogsquaredUtils = import <config/lib/utils/nixos.nix> { inherit lib; };

View File

@ -1,9 +1,4 @@
{ stdenv { stdenv, lib, meson, ninja, inputs ? [ ] }:
, lib
, meson
, ninja
, inputs ? [ ]
}:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "run-workflow-with-vm"; pname = "run-workflow-with-vm";
@ -11,10 +6,7 @@ stdenv.mkDerivation (finalAttrs: {
src = ./.; src = ./.;
nativeBuildInputs = [ nativeBuildInputs = [ meson ninja ];
meson
ninja
];
preConfigure = '' preConfigure = ''
mesonFlagsArray+=("-Dinputs=[${lib.concatStringsSep "," inputs}]") mesonFlagsArray+=("-Dinputs=[${lib.concatStringsSep "," inputs}]")

View File

@ -1,2 +1,4 @@
# It's just be empty like your soul, probably. # It's just be empty like your soul, probably.
{ imports = [ ]; } {
imports = [ ];
}

View File

@ -1,3 +1,5 @@
# Just an extra set of modules, if you count zero modules as one. Or I guess # Just an extra set of modules, if you count zero modules as one. Or I guess
# technically this is one module, just an empty one. # technically this is one module, just an empty one.
{ imports = [ ]; } {
imports = [ ];
}

View File

@ -17,13 +17,8 @@
subvolumes = { subvolumes = {
"/root" = { "/root" = {
mountOptions = [ mountOptions =
"rw" [ "rw" "user" "noauto" "nofail" "compress=zstd:10" ];
"user"
"noauto"
"nofail"
"compress=zstd:10"
];
mountpoint = "/media/laptop-ssd"; mountpoint = "/media/laptop-ssd";
}; };
}; };

View File

@ -28,9 +28,7 @@
defaultSystems = [ "x86_64-linux" ]; defaultSystems = [ "x86_64-linux" ];
}; };
setups.sharedNixpkgsConfig = { setups.sharedNixpkgsConfig = { allowUnfree = true; };
allowUnfree = true;
};
perSystem = { lib, system, ... }: { perSystem = { lib, system, ... }: {
_module.args = { _module.args = {
@ -39,9 +37,8 @@
pkgs = import inputs.nixpkgs { pkgs = import inputs.nixpkgs {
inherit system; inherit system;
config = config.setups.sharedNixpkgsConfig; config = config.setups.sharedNixpkgsConfig;
overlays = lib.attrValues inputs.self.overlays ++ [ overlays = lib.attrValues inputs.self.overlays
inputs.nur.overlays.default ++ [ inputs.nur.overlays.default ];
];
}; };
}; };
}; };

View File

@ -1,11 +1,8 @@
{ inputs { inputs, lib, config
, lib
, config
, defaultNixConf , defaultNixConf
, ... , ... }:
}:
{ {
setups.home-manager = { setups.home-manager = {
@ -42,8 +39,7 @@
{ {
_module.args = { _module.args = {
firstSetupArgs = { firstSetupArgs = {
baseNixvimModules = baseNixvimModules = config.setups.nixvim.configs.fiesta.modules
config.setups.nixvim.configs.fiesta.modules
++ config.setups.nixvim.sharedModules; ++ config.setups.nixvim.sharedModules;
}; };
}; };

View File

@ -2,14 +2,12 @@
, defaultNixConf , defaultNixConf
, ... , ... }:
}:
let let
domain = "foodogsquared.one"; domain = "foodogsquared.one";
subdomain = name: "${name}.${domain}"; subdomain = name: "${name}.${domain}";
in in {
{
setups.nixos = { setups.nixos = {
configs = { configs = {
# The main desktop. # The main desktop.
@ -17,10 +15,8 @@ in
nixpkgs.branch = "nixos-unstable"; nixpkgs.branch = "nixos-unstable";
# This is to make an exception for Archivebox. # This is to make an exception for Archivebox.
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages =
"archiver-3.5.1" [ "archiver-3.5.1" "python3.12-django-3.1.14" ];
"python3.12-django-3.1.14"
];
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];
formats = null; formats = null;
@ -30,10 +26,8 @@ in
inputs.wrapper-manager-fds.nixosModules.wrapper-manager inputs.wrapper-manager-fds.nixosModules.wrapper-manager
{ {
documentation.nixos.extraModules = [ documentation.nixos.extraModules =
../../modules/nixos [ ../../modules/nixos ../../modules/nixos/_private ];
../../modules/nixos/_private
];
wrapper-manager.documentation.manpage.enable = true; wrapper-manager.documentation.manpage.enable = true;
wrapper-manager.documentation.extraModules = [ wrapper-manager.documentation.extraModules = [
../../modules/wrapper-manager ../../modules/wrapper-manager
@ -44,9 +38,8 @@ in
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-cpu-amd-raphael-igpu inputs.nixos-hardware.nixosModules.common-cpu-amd-raphael-igpu
( ({ config, ... }:
{ config, ... }: let let hmCfg = config.home-manager.users;
hmCfg = config.home-manager.users;
in { in {
# Testing out Nushell for a spinerooski. # Testing out Nushell for a spinerooski.
users.users.foo-dogsquared.shell = users.users.foo-dogsquared.shell =
@ -54,8 +47,7 @@ in
hmCfg.foo-dogsquared.programs.nushell.package hmCfg.foo-dogsquared.programs.nushell.package
else else
"/run/current-system/sw/bin/bash"; "/run/current-system/sw/bin/bash";
} })
)
]; ];
home-manager = { home-manager = {
branch = "home-manager-unstable"; branch = "home-manager-unstable";
@ -99,10 +91,8 @@ in
activationTimeout = 1200; activationTimeout = 1200;
}; };
modules = [ modules =
inputs.disko.nixosModules.disko [ inputs.disko.nixosModules.disko inputs.sops-nix.nixosModules.sops ];
inputs.sops-nix.nixosModules.sops
];
}; };
# The barely customized non-graphical installer. # The barely customized non-graphical installer.
@ -126,9 +116,7 @@ in
winnowing = { winnowing = {
nixpkgs = { nixpkgs = {
branch = "nixos-unstable"; branch = "nixos-unstable";
overlays = [ overlays = [ inputs.neovim-nightly-overlay.overlays.default ];
inputs.neovim-nightly-overlay.overlays.default
];
}; };
home-manager.branch = "home-manager-unstable"; home-manager.branch = "home-manager-unstable";
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];

View File

@ -3,16 +3,12 @@
{ {
setups.nixvim.configs = { setups.nixvim.configs = {
fiesta = { fiesta = {
components = [ components = [{
{
nixpkgsBranch = "nixos-unstable"; nixpkgsBranch = "nixos-unstable";
nixvimBranch = "nixvim-unstable"; nixvimBranch = "nixvim-unstable";
neovimPackage = pkgs: pkgs.neovim; neovimPackage = pkgs: pkgs.neovim;
overlays = [ overlays = [ inputs.neovim-nightly-overlay.overlays.default ];
inputs.neovim-nightly-overlay.overlays.default }];
];
}
];
}; };
trovebelt = { trovebelt = {
@ -20,10 +16,7 @@
nixpkgsBranch = [ "nixos-unstable" ]; nixpkgsBranch = [ "nixos-unstable" ];
nixvimBranch = [ "nixvim-unstable" ]; nixvimBranch = [ "nixvim-unstable" ];
neovimPackage = [ (pkgs: pkgs.neovim) ]; neovimPackage = [ (pkgs: pkgs.neovim) ];
overlays = [ overlays = [ [ inputs.neovim-nightly-overlay.overlays.default ] [ ] ];
[ inputs.neovim-nightly-overlay.overlays.default ]
[ ]
];
}; };
}; };
}; };
@ -33,7 +26,5 @@
inputs.self.nixvimModules.bahaghari inputs.self.nixvimModules.bahaghari
]; ];
flake = { flake = { nixvimModules.default = ../../modules/nixvim; };
nixvimModules.default = ../../modules/nixvim;
};
} }

View File

@ -18,13 +18,7 @@
programs.bash = { programs.bash = {
enable = true; enable = true;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
historyIgnore = [ historyIgnore = [ "cd" "exit" "lf" "ls" "nvim" ];
"cd"
"exit"
"lf"
"ls"
"nvim"
];
}; };
home.stateVersion = "23.11"; home.stateVersion = "23.11";

View File

@ -3,8 +3,7 @@
let let
inherit (bahaghariLib.tinted-theming) importScheme; inherit (bahaghariLib.tinted-theming) importScheme;
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
in in {
{
imports = [ ./modules ]; imports = [ ./modules ];
# All of the home-manager-user-specific setup are here. # All of the home-manager-user-specific setup are here.
@ -30,7 +29,8 @@ in
# Merge the upstream since any new files will be overridden. It also # Merge the upstream since any new files will be overridden. It also
# allows us to attach data to it such as new links to the hardcoded # allows us to attach data to it such as new links to the hardcoded
# sections. # sections.
(lib.importTOML "${config.users.foo-dogsquared.programs.custom-homepage.package.src}/data/foodogsquared-homepage/links.toml") (lib.importTOML
"${config.users.foo-dogsquared.programs.custom-homepage.package.src}/data/foodogsquared-homepage/links.toml")
{ {
services = { services = {
@ -48,17 +48,24 @@ in
(lib.mkIf config.services.archivebox.webserver.enable { (lib.mkIf config.services.archivebox.webserver.enable {
services.links = lib.singleton { services.links = lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.archivebox-webserver.value}"; url = "http://localhost:${
builtins.toString
config.state.ports.archivebox-webserver.value
}";
text = "Archive webserver"; text = "Archive webserver";
}; };
YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton { YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.archivebox-webserver.value}"; url = "http://localhost:${
builtins.toString
config.state.ports.archivebox-webserver.value
}";
text = "ArchiveBox webserver"; text = "ArchiveBox webserver";
}); });
}) })
(lib.mkIf (attrs.nixosConfig.suites.filesystem.setups.archive.enable or false) { (lib.mkIf
(attrs.nixosConfig.suites.filesystem.setups.archive.enable or false) {
YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton { YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton {
url = "file://${attrs.nixosConfig.state.paths.archive}"; url = "file://${attrs.nixosConfig.state.paths.archive}";
text = "Personal archive"; text = "Personal archive";
@ -67,7 +74,9 @@ in
(lib.mkIf (attrs.nixosConfig.services.miniflux.enable or false) { (lib.mkIf (attrs.nixosConfig.services.miniflux.enable or false) {
services.links = lib.singleton { services.links = lib.singleton {
url = "http://localhost:${builtins.toString attrs.nixosConfig.state.ports.miniflux.value}"; url = "http://localhost:${
builtins.toString attrs.nixosConfig.state.ports.miniflux.value
}";
text = "RSS reader"; text = "RSS reader";
}; };
}) })
@ -101,13 +110,15 @@ in
# Add our own projects directory since most programs can't decide where it is # Add our own projects directory since most programs can't decide where it is
# properly. # properly.
xdg.userDirs.extraConfig.XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects"; xdg.userDirs.extraConfig.XDG_PROJECTS_DIR =
"${config.home.homeDirectory}/Projects";
# Set nixpkgs config both outside and inside of home-manager. # Set nixpkgs config both outside and inside of home-manager.
nixpkgs.config = import ./config/nixpkgs/config.nix; nixpkgs.config = import ./config/nixpkgs/config.nix;
xdg.configFile."nixpkgs/config.nix".source = ./config/nixpkgs/config.nix; xdg.configFile."nixpkgs/config.nix".source = ./config/nixpkgs/config.nix;
home.packages = with pkgs; [ home.packages = with pkgs;
[
gopass # An improved version of the password manager for hipsters. gopass # An improved version of the password manager for hipsters.
]; ];
@ -122,8 +133,7 @@ in
state.packages = { state.packages = {
diff = pkgs.diffoscope; diff = pkgs.diffoscope;
pager = config.programs.bat.package; pager = config.programs.bat.package;
editor = editor = if config.programs.nixvim.enable then
if config.programs.nixvim.enable then
config.programs.nixvim.finalPackage config.programs.nixvim.finalPackage
else else
config.programs.neovim.package; config.programs.neovim.package;
@ -133,13 +143,15 @@ in
home.mutableFile = { home.mutableFile = {
# ...my gopass secrets,... # ...my gopass secrets,...
".local/share/gopass/stores/personal" = { ".local/share/gopass/stores/personal" = {
url = "gitea@code.foodogsquared.one:foodogsquared/gopass-secrets-personal.git"; url =
"gitea@code.foodogsquared.one:foodogsquared/gopass-secrets-personal.git";
type = "gopass"; type = "gopass";
}; };
# ...and my custom theme to be a showoff. # ...and my custom theme to be a showoff.
"${config.xdg.dataHome}/base16/bark-on-a-tree" = { "${config.xdg.dataHome}/base16/bark-on-a-tree" = {
url = "https://github.com/foo-dogsquared/base16-bark-on-a-tree-scheme.git"; url =
"https://github.com/foo-dogsquared/base16-bark-on-a-tree-scheme.git";
type = "git"; type = "git";
}; };
}; };

View File

@ -1,5 +1,5 @@
{ pkgs ? import <nixpkgs> { { pkgs ?
overlays = [ (import ../../../../../overlays).default ]; import <nixpkgs> { overlays = [ (import ../../../../../overlays).default ]; }
} }: }:
pkgs.callPackage ./package.nix { } pkgs.callPackage ./package.nix { }

View File

@ -1,7 +1,4 @@
{ { buildHugoSite, lib, }:
buildHugoSite,
lib,
}:
buildHugoSite { buildHugoSite {
pname = "foodogsquared-hm-startpage"; pname = "foodogsquared-hm-startpage";
@ -11,8 +8,12 @@ buildHugoSite {
vendorHash = "sha256-Mi61QK1yKWIneZ+i79fpJqP9ew5r5vnv7ptr9YGq0Uk="; vendorHash = "sha256-Mi61QK1yKWIneZ+i79fpJqP9ew5r5vnv7ptr9YGq0Uk=";
preBuild = '' preBuild = ''
install -Dm0644 ${../tinted-theming/base16/bark-on-a-tree.yaml} ./data/foodogsquared-homepage/themes/_dark.yaml install -Dm0644 ${
install -Dm0644 ${../tinted-theming/base16/albino-bark-on-a-tree.yaml} ./data/foodogsquared-homepage/themes/_light.yaml ../tinted-theming/base16/bark-on-a-tree.yaml
} ./data/foodogsquared-homepage/themes/_dark.yaml
install -Dm0644 ${
../tinted-theming/base16/albino-bark-on-a-tree.yaml
} ./data/foodogsquared-homepage/themes/_light.yaml
''; '';
meta = with lib; { meta = with lib; {

View File

@ -1,14 +1,9 @@
{ pkgs ? import <nixpkgs> { { pkgs ?
overlays = [ (import ../../../../../overlays).default ]; import <nixpkgs> { overlays = [ (import ../../../../../overlays).default ]; }
} }: }:
let let site = pkgs.callPackage ./package.nix { };
site = pkgs.callPackage ./package.nix { }; in pkgs.mkShell {
in
pkgs.mkShell {
inputsFrom = [ site ]; inputsFrom = [ site ];
packages = with pkgs; [ packages = with pkgs; [ treefmt npins ];
treefmt
npins
];
} }

View File

@ -7,10 +7,10 @@ let
projectsDir = config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR; projectsDir = config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR;
dotfiles = "${projectsDir}/packages/dotfiles"; dotfiles = "${projectsDir}/packages/dotfiles";
dotfiles' = config.lib.file.mkOutOfStoreSymlink config.home.mutableFile."${dotfiles}".path; dotfiles' = config.lib.file.mkOutOfStoreSymlink
config.home.mutableFile."${dotfiles}".path;
getDotfiles = path: "${dotfiles'}/${path}"; getDotfiles = path: "${dotfiles'}/${path}";
in in {
{
options.users.foo-dogsquared.dotfiles.enable = options.users.foo-dogsquared.dotfiles.enable =
lib.mkEnableOption "custom outside dotfiles for other programs"; lib.mkEnableOption "custom outside dotfiles for other programs";
@ -21,9 +21,7 @@ in
type = "git"; type = "git";
}; };
home.sessionPath = [ home.sessionPath = [ "${config.home.mutableFile.${dotfiles}.path}/bin" ];
"${config.home.mutableFile.${dotfiles}.path}/bin"
];
} }
(lib.mkIf (userCfg.programs.doom-emacs.enable) { (lib.mkIf (userCfg.programs.doom-emacs.enable) {
@ -59,7 +57,8 @@ in
}) })
(lib.mkIf config.programs.nushell.enable { (lib.mkIf config.programs.nushell.enable {
home.file."${config.xdg.dataHome}/nushell/vendor/autoload".source = getDotfiles "nu/autoload"; home.file."${config.xdg.dataHome}/nushell/vendor/autoload".source =
getDotfiles "nu/autoload";
}) })
]); ]);
} }

View File

@ -23,13 +23,14 @@ let
{ id = "palihjnakafgffnompkdfgbgdbcagbko"; } # UpdateSWH { id = "palihjnakafgffnompkdfgbgdbcagbko"; } # UpdateSWH
{ id = "gphhapmejobijbbhgpjhcjognlahblep"; } # GNOME Shell integration { id = "gphhapmejobijbbhgpjhcjognlahblep"; } # GNOME Shell integration
]; ];
in in {
{
options.users.foo-dogsquared.programs.browsers = { options.users.foo-dogsquared.programs.browsers = {
firefox.enable = lib.mkEnableOption "foo-dogsquared's Firefox setup"; firefox.enable = lib.mkEnableOption "foo-dogsquared's Firefox setup";
brave.enable = lib.mkEnableOption "foo-dogsquared's Brave setup"; brave.enable = lib.mkEnableOption "foo-dogsquared's Brave setup";
google-chrome.enable = lib.mkEnableOption "foo-dogsquared's Google Chrome setup"; google-chrome.enable =
misc.enable = lib.mkEnableOption "foo-dogsquared's miscellaneous browsers setup"; lib.mkEnableOption "foo-dogsquared's Google Chrome setup";
misc.enable =
lib.mkEnableOption "foo-dogsquared's miscellaneous browsers setup";
plugins.firenvim.enable = lib.mkEnableOption "setting up Firenvim"; plugins.firenvim.enable = lib.mkEnableOption "setting up Firenvim";
}; };
@ -39,10 +40,8 @@ in
(lib.mkIf cfg.brave.enable { (lib.mkIf cfg.brave.enable {
programs.brave = { programs.brave = {
enable = true; enable = true;
commandLineArgs = [ commandLineArgs =
"--no-default-browser-check" [ "--no-default-browser-check" "--use-system-default-printer" ];
"--use-system-default-printer"
];
extensions = commonExtensions; extensions = commonExtensions;
}; };
@ -63,11 +62,11 @@ in
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = with pkgs; wrapFirefox firefox-unwrapped { package = with pkgs;
nativeMessagingHosts = with pkgs; [ wrapFirefox firefox-unwrapped {
bukubrow nativeMessagingHosts = with pkgs;
tridactyl-native [ bukubrow tridactyl-native ]
] ++ lib.optional config.programs.mpv.enable pkgs.ff2mpv; ++ lib.optional config.programs.mpv.enable pkgs.ff2mpv;
extraPolicies = { extraPolicies = {
AppAutoUpdate = false; AppAutoUpdate = false;
@ -87,9 +86,7 @@ in
NoDefaultBookmarks = true; NoDefaultBookmarks = true;
OfferToSaveLoginsDefault = false; OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false; PasswordManagerEnabled = false;
SanitizeOnShutdown = { SanitizeOnShutdown = { FormData = true; };
FormData = true;
};
UseSystemPrintDialog = true; UseSystemPrintDialog = true;
}; };
}; };
@ -97,7 +94,8 @@ in
profiles.personal = { profiles.personal = {
isDefault = true; isDefault = true;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ extensions = with pkgs.nur.repos.rycee.firefox-addons;
[
aw-watcher-web aw-watcher-web
bitwarden bitwarden
browserpass browserpass
@ -126,8 +124,8 @@ in
zhongwen zhongwen
open-access-helper open-access-helper
rsshub-radar rsshub-radar
]) ]) ++ lib.optionals config.programs.mpv.enable
++ lib.optionals config.programs.mpv.enable (with pkgs.nur.repos.rycee.firefox-addons; [ ff2mpv ]); (with pkgs.nur.repos.rycee.firefox-addons; [ ff2mpv ]);
# Much of the settings are affected by the policies set in the # Much of the settings are affected by the policies set in the
# package. See more information about them in # package. See more information about them in
@ -140,7 +138,8 @@ in
"browser.search.widget.inNavBar" = true; "browser.search.widget.inNavBar" = true;
"browser.search.openintab" = true; "browser.search.openintab" = true;
"browser.startup.homepage" = "browser.startup.homepage" =
lib.mkIf userCfg.programs.custom-homepage.enable "file://${config.xdg.dataHome}/foodogsquared/homepage"; lib.mkIf userCfg.programs.custom-homepage.enable
"file://${config.xdg.dataHome}/foodogsquared/homepage";
# Some privacy settings... # Some privacy settings...
"privacy.donottrackheader.enabled" = true; "privacy.donottrackheader.enabled" = true;
@ -162,22 +161,25 @@ in
search = { search = {
default = "Brave"; default = "Brave";
force = true; force = true;
order = [ order = [ "Brave" "Nix Packages" "Google" ];
"Brave"
"Nix Packages"
"Google"
];
engines = { engines = {
"Brave" = { "Brave" = {
urls = [{ urls = [{
template = "https://search.brave.com/search"; template = "https://search.brave.com/search";
params = [ params = [
{ name = "type"; value = "search"; } {
{ name = "q"; value = "{searchTerms}"; } name = "type";
value = "search";
}
{
name = "q";
value = "{searchTerms}";
}
]; ];
}]; }];
icon = "${config.programs.brave.package}/share/icons/hicolor/64x64/apps/brave-browser.png"; icon =
"${config.programs.brave.package}/share/icons/hicolor/64x64/apps/brave-browser.png";
definedAliases = [ "@brave" "@b" ]; definedAliases = [ "@brave" "@b" ];
}; };
@ -185,12 +187,19 @@ in
urls = [{ urls = [{
template = "https://search.nixos.org/packages"; template = "https://search.nixos.org/packages";
params = [ params = [
{ name = "type"; value = "packages"; } {
{ name = "query"; value = "{searchTerms}"; } name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
]; ];
}]; }];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; icon =
"${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ]; definedAliases = [ "@np" ];
}; };
@ -239,10 +248,8 @@ in
(lib.mkIf cfg.google-chrome.enable { (lib.mkIf cfg.google-chrome.enable {
programs.google-chrome.enable = true; programs.google-chrome.enable = true;
programs.google-chrome.commandLineArgs = [ programs.google-chrome.commandLineArgs =
"--no-default-browser-check" [ "--no-default-browser-check" "--use-system-default-printer" ];
"--use-system-default-printer"
];
services.bleachbit.cleaners = [ services.bleachbit.cleaners = [
"google_chrome.cookies" "google_chrome.cookies"
@ -257,30 +264,19 @@ in
}) })
# Goes with whatever you want to. # Goes with whatever you want to.
(lib.mkIf cfg.misc.enable { (lib.mkIf cfg.misc.enable { home.packages = with pkgs; [ nyxt ]; })
home.packages = with pkgs; [
nyxt
];
})
(lib.mkIf cfg.plugins.firenvim.enable (lib.mkIf cfg.plugins.firenvim.enable (let
(let supportedBrowsers = [ "brave" "chromium" "google-chrome" "vivaldi" ];
supportedBrowsers = [ enableSupportedBrowser = acc: name:
"brave" acc // {
"chromium" programs.${name}.extensions =
"google-chrome" [{ id = "egpjdkipkomnmjhjmdamaniclmdlobbo"; }];
"vivaldi"
];
enableSupportedBrowser = acc: name: acc // {
programs.${name}.extensions = [
{ id = "egpjdkipkomnmjhjmdamaniclmdlobbo"; }
];
}; };
in in lib.foldl' enableSupportedBrowser { } supportedBrowsers // {
lib.foldl' enableSupportedBrowser { } supportedBrowsers // { programs.firefox.profiles.personal.extensions =
programs.firefox.profiles.personal.extensions = with pkgs.nur.repos.rycee.firefox-addons; [ with pkgs.nur.repos.rycee.firefox-addons;
firenvim [ firenvim ];
];
})) }))
]; ];
} }

View File

@ -6,8 +6,7 @@ let
settingsFormat = pkgs.formats.toml { }; settingsFormat = pkgs.formats.toml { };
themesSettingsFormat = pkgs.formats.yaml { }; themesSettingsFormat = pkgs.formats.yaml { };
in in {
{
options.users.foo-dogsquared.programs.custom-homepage = { options.users.foo-dogsquared.programs.custom-homepage = {
enable = lib.mkEnableOption "addition of custom homepage"; enable = lib.mkEnableOption "addition of custom homepage";
@ -97,10 +96,10 @@ in
}; };
config = { config = {
users.foo-dogsquared.programs.custom-homepage.finalPackage = users.foo-dogsquared.programs.custom-homepage.finalPackage = let
let data = lib.mapAttrs
data = lib.mapAttrs (n: v: (n: v: settingsFormat.generate "fds-homepage-section-${n}" v)
settingsFormat.generate "fds-homepage-section-${n}" v) cfg.sections; cfg.sections;
installDataDir = lib.foldlAttrs (acc: n: v: '' installDataDir = lib.foldlAttrs (acc: n: v: ''
${acc} ${acc}
@ -111,8 +110,7 @@ in
${acc} ${acc}
install -Dm0644 ${v} './data/foodogsquared-homepage/themes/${n}}.yaml install -Dm0644 ${v} './data/foodogsquared-homepage/themes/${n}}.yaml
'') "" cfg.themes; '') "" cfg.themes;
in in cfg.package.overrideAttrs (prevAttrs: {
cfg.package.overrideAttrs (prevAttrs: {
preBuild = (prevAttrs.preBuild or "") + '' preBuild = (prevAttrs.preBuild or "") + ''
${installDataDir} ${installDataDir}
${installThemes} ${installThemes}

View File

@ -4,8 +4,7 @@ let
inherit (config.xdg) userDirs; inherit (config.xdg) userDirs;
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.dconf; cfg = userCfg.programs.dconf;
in in {
{
options.users.foo-dogsquared.programs.dconf.enable = options.users.foo-dogsquared.programs.dconf.enable =
lib.mkEnableOption "dconf configuration"; lib.mkEnableOption "dconf configuration";
@ -13,10 +12,11 @@ in
dconf.settings = { dconf.settings = {
# My GNOME Shell and programs configuration. # My GNOME Shell and programs configuration.
"org/gnome/shell" = { "org/gnome/shell" = {
favorite-apps = favorite-apps = lib.optional userCfg.programs.browsers.firefox.enable
lib.optional userCfg.programs.browsers.firefox.enable "firefox.desktop" "firefox.desktop"
++ lib.optional userCfg.setups.desktop.enable "thunderbird.desktop" ++ lib.optional userCfg.setups.desktop.enable "thunderbird.desktop"
++ lib.optional userCfg.setups.development.enable "org.wezfurlong.wezterm.desktop" ++ lib.optional userCfg.setups.development.enable
"org.wezfurlong.wezterm.desktop"
++ lib.optional userCfg.programs.doom-emacs.enable "emacs.desktop" ++ lib.optional userCfg.programs.doom-emacs.enable "emacs.desktop"
++ lib.optional userCfg.programs.vs-code.enable "code.desktop"; ++ lib.optional userCfg.programs.vs-code.enable "code.desktop";
}; };

View File

@ -9,8 +9,7 @@ let
cfg = userCfg.programs.doom-emacs; cfg = userCfg.programs.doom-emacs;
doomEmacsInstallation = "${config.xdg.configHome}/emacs"; doomEmacsInstallation = "${config.xdg.configHome}/emacs";
in in {
{
options.users.foo-dogsquared.programs.doom-emacs.enable = options.users.foo-dogsquared.programs.doom-emacs.enable =
lib.mkEnableOption "foo-dogsquared's Doom Emacs configuration"; lib.mkEnableOption "foo-dogsquared's Doom Emacs configuration";
@ -18,7 +17,8 @@ in
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacs; package = pkgs.emacs;
extraPackages = epkgs: with epkgs; [ extraPackages = epkgs:
with epkgs; [
org-noter-pdftools org-noter-pdftools
org-pdftools org-pdftools
pdf-tools pdf-tools
@ -58,16 +58,13 @@ in
# :lang org +roam2 # :lang org +roam2
texlive.combined.scheme-medium texlive.combined.scheme-medium
sqlite sqlite
anystyle-cli #anystyle-cli
]; ];
programs.python = { programs.python = {
enable = true; enable = true;
package = pkgs.python3; package = pkgs.python3;
modules = ps: with ps; [ modules = ps: with ps; [ jupyter jupyter-book ];
jupyter
jupyter-book
];
}; };
# Enable Emacs server for them quicknotes. # Enable Emacs server for them quicknotes.

View File

@ -8,7 +8,8 @@ let
address = "${name}@${domain}"; address = "${name}@${domain}";
userName = "${name}@${domain}"; userName = "${name}@${domain}";
realName = lib.mkDefault "${name}@${domain}"; realName = lib.mkDefault "${name}@${domain}";
passwordCommand = lib.mkDefault "gopass show email/${domain}/${name} | head -n 1"; passwordCommand =
lib.mkDefault "gopass show email/${domain}/${name} | head -n 1";
imap = { imap = {
host = "heracles.mxrouting.net"; host = "heracles.mxrouting.net";
@ -23,11 +24,11 @@ let
tls.enable = true; tls.enable = true;
}; };
}; };
in in {
{
options.users.foo-dogsquared.programs.email = { options.users.foo-dogsquared.programs.email = {
enable = lib.mkEnableOption "foo-dogsquared's email setup"; enable = lib.mkEnableOption "foo-dogsquared's email setup";
thunderbird.enable = lib.mkEnableOption "foo-dogsquared's Thunderbird configuration"; thunderbird.enable =
lib.mkEnableOption "foo-dogsquared's Thunderbird configuration";
}; };
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
@ -64,7 +65,8 @@ in
realName = config.accounts.email.accounts.personal.realName; realName = config.accounts.email.accounts.personal.realName;
userName = "foo.dogsquared@gmail.com"; userName = "foo.dogsquared@gmail.com";
flavor = "gmail.com"; flavor = "gmail.com";
passwordCommand = "gopass show websites/accounts.google.com/foo.dogsquared | head -n 1"; passwordCommand =
"gopass show websites/accounts.google.com/foo.dogsquared | head -n 1";
}; };
}; };
} }

View File

@ -3,16 +3,15 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.git; cfg = userCfg.programs.git;
in in {
{
options.users.foo-dogsquared.programs.git = { options.users.foo-dogsquared.programs.git = {
enable = lib.mkEnableOption "foo-dogsquared's Git setup"; enable = lib.mkEnableOption "foo-dogsquared's Git setup";
instaweb.enable = lib.mkEnableOption "install additional files for instaweb setup"; instaweb.enable =
lib.mkEnableOption "install additional files for instaweb setup";
}; };
config = lib.mkIf cfg.enable ( config = lib.mkIf cfg.enable (lib.mkMerge [
lib.mkMerge [
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
mergiraf # Merging giraffes are no small task. mergiraf # Merging giraffes are no small task.
@ -36,8 +35,10 @@ in
alias = { alias = {
unstage = "reset HEAD --"; unstage = "reset HEAD --";
quick-rebase = "rebase --interactive --autostash --committer-date-is-author-date"; quick-rebase =
quick-clone = "clone --depth=1 --recurse-submodules --shallow-submodules"; "rebase --interactive --autostash --committer-date-is-author-date";
quick-clone =
"clone --depth=1 --recurse-submodules --shallow-submodules";
}; };
init.defaultBranch = "main"; init.defaultBranch = "main";
@ -50,7 +51,8 @@ in
"https://gitlab.gnome.org/".insteadOf = [ "gnome:" ]; "https://gitlab.gnome.org/".insteadOf = [ "gnome:" ];
"https://invent.kde.org/".insteadOf = [ "kde:" ]; "https://invent.kde.org/".insteadOf = [ "kde:" ];
"https://git.sr.ht/".insteadOf = [ "sh:" "sourcehut:" ]; "https://git.sr.ht/".insteadOf = [ "sh:" "sourcehut:" ];
"https://git.savannah.nongnu.org/git/".insteadOf = [ "sv:" "savannah:" ]; "https://git.savannah.nongnu.org/git/".insteadOf =
[ "sv:" "savannah:" ];
}; };
pull.rebase = "interactive"; pull.rebase = "interactive";
@ -67,11 +69,7 @@ in
# So you don't have to use GitHub, I guess. # So you don't have to use GitHub, I guess.
programs.gh = { programs.gh = {
enable = true; enable = true;
extensions = with pkgs; [ extensions = with pkgs; [ gh-eco gh-dash gh-actions-cache ];
gh-eco
gh-dash
gh-actions-cache
];
settings = { settings = {
git_protocol = "ssh"; git_protocol = "ssh";
@ -88,9 +86,7 @@ in
(lib.mkIf cfg.instaweb.enable { (lib.mkIf cfg.instaweb.enable {
state.ports.git-instaweb.value = 15432; state.ports.git-instaweb.value = 15432;
home.packages = with pkgs; [ home.packages = with pkgs; [ lighttpd ];
lighttpd
];
programs.git.extraConfig.instaweb = { programs.git.extraConfig.instaweb = {
local = true; local = true;
@ -101,7 +97,9 @@ in
users.foo-dogsquared.programs.custom-homepage.sections.quicklinks.links = users.foo-dogsquared.programs.custom-homepage.sections.quicklinks.links =
lib.mkBefore (lib.singleton { lib.mkBefore (lib.singleton {
text = "Current git repo"; text = "Current git repo";
url = "http://localhost:${builtins.toString config.state.ports.git-instaweb.value}"; url = "http://localhost:${
builtins.toString config.state.ports.git-instaweb.value
}";
}); });
}) })
]); ]);

View File

@ -3,17 +3,11 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.hledger; cfg = userCfg.programs.hledger;
in in {
{
options.users.foo-dogsquared.programs.hledger.enable = options.users.foo-dogsquared.programs.hledger.enable =
lib.mkEnableOption "hledger setup"; lib.mkEnableOption "hledger setup";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [ hledger hledger-ui hledger-web hledger-utils ];
hledger
hledger-ui
hledger-web
hledger-utils
];
}; };
} }

View File

@ -3,8 +3,7 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.jujutsu; cfg = userCfg.programs.jujutsu;
in in {
{
options.users.foo-dogsquared.programs.jujutsu.enable = options.users.foo-dogsquared.programs.jujutsu.enable =
lib.mkEnableOption "foo-dogsquared's Jujutsu configuration"; lib.mkEnableOption "foo-dogsquared's Jujutsu configuration";

View File

@ -3,8 +3,7 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.keys; cfg = userCfg.programs.keys;
in in {
{
options.users.foo-dogsquared.programs.keys = { options.users.foo-dogsquared.programs.keys = {
ssh.enable = lib.mkEnableOption "foo-dogsquared's SSH config"; ssh.enable = lib.mkEnableOption "foo-dogsquared's SSH config";
gpg.enable = lib.mkEnableOption "foo-dogsquared's GPG config"; gpg.enable = lib.mkEnableOption "foo-dogsquared's GPG config";

View File

@ -9,12 +9,12 @@ let
''; '';
sym = query: ''sym("${query}")''; sym = query: ''sym("${query}")'';
in in {
{
colorscheme = colorscheme =
if config.bahaghari.tinted-theming.schemes?"bark-on-a-tree" if config.bahaghari.tinted-theming.schemes ? "bark-on-a-tree" then
then (lib.mkForce "bark-on-a-tree") (lib.mkForce "bark-on-a-tree")
else (lib.mkDefault "default"); else
(lib.mkDefault "default");
colorschemes.lush = { colorschemes.lush = {
enable = true; enable = true;
@ -23,9 +23,7 @@ in
local hsl = lush.hsl local hsl = lush.hsl
local hsluv = lush.hsluv local hsluv = lush.hsluv
''; '';
themes = themes = lib.mapAttrs (name: metadata: {
lib.mapAttrs
(name: metadata: {
extraConfigLua = '' extraConfigLua = ''
${lib.foldlAttrs initLushBase16 "" metadata.palette} ${lib.foldlAttrs initLushBase16 "" metadata.palette}
@ -54,7 +52,10 @@ in
highlights = lib.mkMerge [ highlights = lib.mkMerge [
rec { rec {
Normal = { fg = mkRaw "base05"; bg = mkRaw "base00"; }; Normal = {
fg = mkRaw "base05";
bg = mkRaw "base00";
};
NormalFloat = { NormalFloat = {
fg = mkRaw "Normal.fg.saturate(15).lighten(5)"; fg = mkRaw "Normal.fg.saturate(15).lighten(5)";
bg = mkRaw "Normal.bg.saturate(15).lighten(5)"; bg = mkRaw "Normal.bg.saturate(15).lighten(5)";
@ -62,7 +63,10 @@ in
Bold.gui = "bold"; Bold.gui = "bold";
Debug.fg = mkRaw "base08"; Debug.fg = mkRaw "base08";
Directory.fg = mkRaw "base0D"; Directory.fg = mkRaw "base0D";
Error = { fg = mkRaw "base01"; bg = mkRaw "base08"; }; Error = {
fg = mkRaw "base01";
bg = mkRaw "base08";
};
ErrorMsg.fg = mkRaw "base08"; ErrorMsg.fg = mkRaw "base08";
Exception.fg = mkRaw "base08"; Exception.fg = mkRaw "base08";
FoldColumn.fg = mkRaw "base03"; FoldColumn.fg = mkRaw "base03";
@ -91,18 +95,42 @@ in
TooLong.fg = mkRaw "base08"; TooLong.fg = mkRaw "base08";
Underlined = { fg = mkRaw "base08"; }; Underlined = { fg = mkRaw "base08"; };
WarningMsg = { fg = mkRaw "base08"; }; WarningMsg = { fg = mkRaw "base08"; };
WildMenu = { fg = mkRaw "base08"; bg = mkRaw "base0A"; }; WildMenu = {
fg = mkRaw "base08";
bg = mkRaw "base0A";
};
Title.fg = mkRaw "base0D"; Title.fg = mkRaw "base0D";
Conceal.fg = mkRaw "base0D"; Conceal.fg = mkRaw "base0D";
Cursor = { fg = mkRaw "base00"; bg = mkRaw "base05"; }; Cursor = {
fg = mkRaw "base00";
bg = mkRaw "base05";
};
NonText = { fg = mkRaw "base03"; }; NonText = { fg = mkRaw "base03"; };
LineNr = { fg = mkRaw "base02.lighten(25)"; bg = mkRaw "base00"; }; LineNr = {
LineNrNC = { fg = mkRaw "base02.lighten(25)"; bg = mkRaw "base01"; }; fg = mkRaw "base02.lighten(25)";
bg = mkRaw "base00";
};
LineNrNC = {
fg = mkRaw "base02.lighten(25)";
bg = mkRaw "base01";
};
SignColumn = { fg = mkRaw "base01.lighten(40)"; }; SignColumn = { fg = mkRaw "base01.lighten(40)"; };
StatusLine = { fg = mkRaw "base02"; bg = mkRaw "base01.darken(60)"; }; StatusLine = {
StatusLineNC = { fg = mkRaw "base02"; bg = mkRaw "base01.darken(30)"; }; fg = mkRaw "base02";
VertSplit = { fg = mkRaw "base02"; bg = mkRaw "base00"; }; bg = mkRaw "base01.darken(60)";
ColorColumn = { fg = mkRaw "base01.lighten(25)"; bg = mkRaw "base01.darken(25)"; }; };
StatusLineNC = {
fg = mkRaw "base02";
bg = mkRaw "base01.darken(30)";
};
VertSplit = {
fg = mkRaw "base02";
bg = mkRaw "base00";
};
ColorColumn = {
fg = mkRaw "base01.lighten(25)";
bg = mkRaw "base01.darken(25)";
};
CursorLine = { bg = mkRaw "base01.saturate(-5).darken(15)"; }; CursorLine = { bg = mkRaw "base01.saturate(-5).darken(15)"; };
CursorColumn = CursorLine; CursorColumn = CursorLine;
CursorLineNr.fg = mkRaw "base0A"; CursorLineNr.fg = mkRaw "base0A";
@ -114,17 +142,38 @@ in
QuickFixLine = { bg = mkRaw "base00"; }; QuickFixLine = { bg = mkRaw "base00"; };
QFFileName = { fg = mkRaw "base0A"; }; QFFileName = { fg = mkRaw "base0A"; };
QFLineNr = { fg = mkRaw "base04"; }; QFLineNr = { fg = mkRaw "base04"; };
PMenu = { fg = mkRaw "base05"; bg = mkRaw "base01"; }; PMenu = {
PMenuSel = { fg = mkRaw "base01"; bg = mkRaw "base05"; }; fg = mkRaw "base05";
TabLineSel = { fg = mkRaw "base00"; bg = mkRaw "base0A"; }; bg = mkRaw "base01";
TabLine = { fg = mkRaw "base03"; bg = mkRaw "base00.darken(15)"; }; };
TabLineFill = { fg = mkRaw "base03"; bg = mkRaw "base00.darken(25)"; }; PMenuSel = {
EndOfBuffer = { fg = mkRaw "base01.lighten(20)"; bg = mkRaw "base01.darken(20)"; }; fg = mkRaw "base01";
bg = mkRaw "base05";
};
TabLineSel = {
fg = mkRaw "base00";
bg = mkRaw "base0A";
};
TabLine = {
fg = mkRaw "base03";
bg = mkRaw "base00.darken(15)";
};
TabLineFill = {
fg = mkRaw "base03";
bg = mkRaw "base00.darken(25)";
};
EndOfBuffer = {
fg = mkRaw "base01.lighten(20)";
bg = mkRaw "base01.darken(20)";
};
# Standard syntax highlighting # Standard syntax highlighting
Boolean = { fg = mkRaw "base09"; }; Boolean = { fg = mkRaw "base09"; };
Character = { fg = mkRaw "base08"; }; Character = { fg = mkRaw "base08"; };
Comment = { fg = mkRaw "base03"; gui = "italic"; }; Comment = {
fg = mkRaw "base03";
gui = "italic";
};
Conditional = { fg = mkRaw "base0E"; }; Conditional = { fg = mkRaw "base0E"; };
Constant = { fg = mkRaw "base09"; }; Constant = { fg = mkRaw "base09"; };
Define = { fg = mkRaw "base0E"; }; Define = { fg = mkRaw "base0E"; };
@ -146,13 +195,23 @@ in
String = { fg = mkRaw "base0B"; }; String = { fg = mkRaw "base0B"; };
Structure = { fg = mkRaw "base0E"; }; Structure = { fg = mkRaw "base0E"; };
Tag = { fg = mkRaw "base0A"; }; Tag = { fg = mkRaw "base0A"; };
Todo = { fg = mkRaw "base0A"; bg = mkRaw "base01"; }; Todo = {
fg = mkRaw "base0A";
bg = mkRaw "base01";
};
Type = { fg = mkRaw "base0A"; }; Type = { fg = mkRaw "base0A"; };
Typedef = { fg = mkRaw "base0A"; }; Typedef = { fg = mkRaw "base0A"; };
# Help # Help
HelpDoc = { fg = mkRaw "base05"; bg = mkRaw "base0D"; gui = "bold;italic"; }; HelpDoc = {
HelpIgnore = { fg = mkRaw "base0B"; gui = "bold;italic"; }; fg = mkRaw "base05";
bg = mkRaw "base0D";
gui = "bold;italic";
};
HelpIgnore = {
fg = mkRaw "base0B";
gui = "bold;italic";
};
# C highlighting # C highlighting
cOperator = { fg = mkRaw "base0C"; }; cOperator = { fg = mkRaw "base0C"; };
@ -173,17 +232,44 @@ in
cssColor = { fg = mkRaw "base0C"; }; cssColor = { fg = mkRaw "base0C"; };
# Diff highlighting # Diff highlighting
DiffAdd = { fg = mkRaw "base0B"; bg = mkRaw "base0B.darken(80)"; }; DiffAdd = {
DiffAdded = { fg = mkRaw "base0B"; bg = mkRaw "base0B.darken(80)"; }; fg = mkRaw "base0B";
DiffNewFile = { fg = mkRaw "base0B"; bg = mkRaw "base0B.darken(80)"; }; bg = mkRaw "base0B.darken(80)";
};
DiffAdded = {
fg = mkRaw "base0B";
bg = mkRaw "base0B.darken(80)";
};
DiffNewFile = {
fg = mkRaw "base0B";
bg = mkRaw "base0B.darken(80)";
};
DiffDelete = { fg = mkRaw "base08"; bg = mkRaw "base08.darken(80)"; }; DiffDelete = {
DiffRemoved = { fg = mkRaw "base08"; bg = mkRaw "base08.darken(80)"; }; fg = mkRaw "base08";
bg = mkRaw "base08.darken(80)";
};
DiffRemoved = {
fg = mkRaw "base08";
bg = mkRaw "base08.darken(80)";
};
DiffChange = { fg = mkRaw "base03"; bg = mkRaw "base03.darken(60)"; }; DiffChange = {
DiffFile = { fg = mkRaw "base03"; bg = mkRaw "base03.darken(60)"; }; fg = mkRaw "base03";
DiffLine = { fg = mkRaw "base03"; bg = mkRaw "base03.darken(60)"; }; bg = mkRaw "base03.darken(60)";
DiffText = { fg = mkRaw "base03"; bg = mkRaw "base03.darken(60)"; }; };
DiffFile = {
fg = mkRaw "base03";
bg = mkRaw "base03.darken(60)";
};
DiffLine = {
fg = mkRaw "base03";
bg = mkRaw "base03.darken(60)";
};
DiffText = {
fg = mkRaw "base03";
bg = mkRaw "base03.darken(60)";
};
# Git highlighting # Git highlighting
gitcommitOverflow = { fg = mkRaw "base08"; }; gitcommitOverflow = { fg = mkRaw "base08"; };
@ -196,11 +282,23 @@ in
gitcommitSelectedType = { fg = mkRaw "base0D"; }; gitcommitSelectedType = { fg = mkRaw "base0D"; };
gitcommitUnmergedType = { fg = mkRaw "base0D"; }; gitcommitUnmergedType = { fg = mkRaw "base0D"; };
gitcommitDiscardedType = { fg = mkRaw "base0D"; }; gitcommitDiscardedType = { fg = mkRaw "base0D"; };
gitcommitBranch = { fg = mkRaw "base09"; gui = "bold"; }; gitcommitBranch = {
fg = mkRaw "base09";
gui = "bold";
};
gitcommitUntrackedFile = { fg = mkRaw "base0A"; }; gitcommitUntrackedFile = { fg = mkRaw "base0A"; };
gitcommitUnmergedFile = { fg = mkRaw "base08"; gui = "bold"; }; gitcommitUnmergedFile = {
gitcommitDiscardedFile = { fg = mkRaw "base08"; gui = "bold"; }; fg = mkRaw "base08";
gitcommitSelectedFile = { fg = mkRaw "base0B"; gui = "bold"; }; gui = "bold";
};
gitcommitDiscardedFile = {
fg = mkRaw "base08";
gui = "bold";
};
gitcommitSelectedFile = {
fg = mkRaw "base0B";
gui = "bold";
};
# HTML highlighting # HTML highlighting
htmlBold = { fg = mkRaw "base0A"; }; htmlBold = { fg = mkRaw "base0A"; };
@ -241,28 +339,85 @@ in
mailEmail = { fg = mkRaw "base0D"; }; mailEmail = { fg = mkRaw "base0D"; };
# Markdown highlighting # Markdown highlighting
markdownh1 = { fg = mkRaw "base0D"; gui = "bold"; }; markdownh1 = {
markdownh2 = { fg = mkRaw "base0D"; gui = "bold"; }; fg = mkRaw "base0D";
markdownh3 = { fg = mkRaw "base0D"; gui = "bold"; }; gui = "bold";
markdownh4 = { fg = mkRaw "base0D"; gui = "bold"; }; };
markdownh5 = { fg = mkRaw "base0D"; gui = "bold"; }; markdownh2 = {
markdownh6 = { fg = mkRaw "base0A"; gui = "bold"; }; fg = mkRaw "base0D";
markdownRule = { fg = mkRaw "markdownh2.bg"; gui = "bold"; }; gui = "bold";
markdownItalic = { fg = mkRaw "base05"; gui = "italic"; }; };
markdownBold = { fg = mkRaw "base05"; gui = "bold"; }; markdownh3 = {
markdownBoldItalic = { fg = mkRaw "base05"; gui = "bold;italic"; }; fg = mkRaw "base0D";
markdownCodeDelimiter = { fg = mkRaw "base0B"; gui = "bold"; }; gui = "bold";
markdownCode = { fg = mkRaw "base07"; bg = mkRaw "base00"; }; };
markdownh4 = {
fg = mkRaw "base0D";
gui = "bold";
};
markdownh5 = {
fg = mkRaw "base0D";
gui = "bold";
};
markdownh6 = {
fg = mkRaw "base0A";
gui = "bold";
};
markdownRule = {
fg = mkRaw "markdownh2.bg";
gui = "bold";
};
markdownItalic = {
fg = mkRaw "base05";
gui = "italic";
};
markdownBold = {
fg = mkRaw "base05";
gui = "bold";
};
markdownBoldItalic = {
fg = mkRaw "base05";
gui = "bold;italic";
};
markdownCodeDelimiter = {
fg = mkRaw "base0B";
gui = "bold";
};
markdownCode = {
fg = mkRaw "base07";
bg = mkRaw "base00";
};
markdownCodeBlock = { fg = mkRaw "base0B"; }; markdownCodeBlock = { fg = mkRaw "base0B"; };
markdownFootnoteDefinition = { fg = mkRaw "base05"; gui = "italic"; }; markdownFootnoteDefinition = {
markdownListMarker = { fg = mkRaw "base05"; gui = "bold"; }; fg = mkRaw "base05";
markdownLineBreak = { fg = mkRaw "base08"; gui = "underline"; }; gui = "italic";
markdownError = { fg = mkRaw "base05"; bg = mkRaw "base00"; }; };
markdownListMarker = {
fg = mkRaw "base05";
gui = "bold";
};
markdownLineBreak = {
fg = mkRaw "base08";
gui = "underline";
};
markdownError = {
fg = mkRaw "base05";
bg = mkRaw "base00";
};
markdownHeadingDelimiter = { fg = mkRaw "base0D"; }; markdownHeadingDelimiter = { fg = mkRaw "base0D"; };
markdownUrl = { fg = mkRaw "base09"; }; markdownUrl = { fg = mkRaw "base09"; };
markdownFootnote = { fg = mkRaw "base0E"; gui = "italic"; }; markdownFootnote = {
markdownBlockquote = { fg = mkRaw "base0C"; gui = "bold"; }; fg = mkRaw "base0E";
markdownLinkText = { fg = mkRaw "base08"; gui = "italic"; }; gui = "italic";
};
markdownBlockquote = {
fg = mkRaw "base0C";
gui = "bold";
};
markdownLinkText = {
fg = mkRaw "base08";
gui = "italic";
};
# PHP highlighting # PHP highlighting
phpMemberSelector = { fg = mkRaw "base05"; }; phpMemberSelector = { fg = mkRaw "base05"; };
@ -306,10 +461,16 @@ in
xmlCdataCdata = { fg = mkRaw "xmlCdatastart.bg"; }; xmlCdataCdata = { fg = mkRaw "xmlCdatastart.bg"; };
# MatchParen # MatchParen
MatchParen = { fg = mkRaw "base07"; bg = mkRaw "base08"; }; MatchParen = {
fg = mkRaw "base07";
bg = mkRaw "base08";
};
# CodeQL # CodeQL
CodeqlAstFocus = { fg = mkRaw "base00"; bg = mkRaw "base03"; }; CodeqlAstFocus = {
fg = mkRaw "base00";
bg = mkRaw "base03";
};
# Diff highlighting # Diff highlighting
GitSignsAdd = { fg = mkRaw "base0B"; }; GitSignsAdd = { fg = mkRaw "base0B"; };
@ -318,12 +479,30 @@ in
} }
(lib.mkIf config.plugins.telescope.enable { (lib.mkIf config.plugins.telescope.enable {
TelescopeNormal = { fg = mkRaw "base05"; bg = mkRaw "base01"; }; TelescopeNormal = {
TelescopeBorder = { fg = mkRaw "base00"; bg = mkRaw "base01"; }; fg = mkRaw "base05";
TelescopePromptPrefix = { fg = mkRaw "base0A"; bg = mkRaw "base01"; }; bg = mkRaw "base01";
TelescopeMatching = { fg = mkRaw "base0D"; bg = mkRaw "base01"; }; };
TelescopeSelection = { fg = mkRaw "base0A"; bg = mkRaw "base01"; }; TelescopeBorder = {
TelescopeSelectionCaret = { fg = mkRaw "base0A"; bg = mkRaw "base01"; }; fg = mkRaw "base00";
bg = mkRaw "base01";
};
TelescopePromptPrefix = {
fg = mkRaw "base0A";
bg = mkRaw "base01";
};
TelescopeMatching = {
fg = mkRaw "base0D";
bg = mkRaw "base01";
};
TelescopeSelection = {
fg = mkRaw "base0A";
bg = mkRaw "base01";
};
TelescopeSelectionCaret = {
fg = mkRaw "base0A";
bg = mkRaw "base01";
};
}) })
# See `rb-delimiters-colors` help section for more details. # See `rb-delimiters-colors` help section for more details.
@ -349,17 +528,21 @@ in
(lib.mkIf config.plugins.treesitter.enable { (lib.mkIf config.plugins.treesitter.enable {
${sym "@variable"} = helpers.listToUnkeyedAttrs [ (mkRaw "Normal") ]; ${sym "@variable"} = helpers.listToUnkeyedAttrs [ (mkRaw "Normal") ];
${sym "@tag.delimiter"} = { fg = mkRaw "base0A"; }; ${sym "@tag.delimiter"} = { fg = mkRaw "base0A"; };
${sym "@text.emphasis"} = helpers.listToUnkeyedAttrs [ (mkRaw "Italic") ]; ${sym "@text.emphasis"} =
${sym "@text.underline"} = helpers.listToUnkeyedAttrs [ (mkRaw "Underlined") ]; helpers.listToUnkeyedAttrs [ (mkRaw "Italic") ];
${sym "@text.underline"} =
helpers.listToUnkeyedAttrs [ (mkRaw "Underlined") ];
${sym "@text.strike"} = { gui = "strikethrough"; }; ${sym "@text.strike"} = { gui = "strikethrough"; };
${sym "@text.uri"} = { fg = mkRaw "base0C"; }; ${sym "@text.uri"} = { fg = mkRaw "base0C"; };
}) })
(lib.mkIf config.plugins.indent-blankline.enable { (lib.mkIf config.plugins.indent-blankline.enable {
IblScope = { fg = mkRaw "base0C"; gui = "bold"; } ; IblScope = {
fg = mkRaw "base0C";
gui = "bold";
};
}) })
]; ];
}) }) config.bahaghari.tinted-theming.schemes;
config.bahaghari.tinted-theming.schemes;
}; };
} }

View File

@ -11,9 +11,7 @@
args = [ "-i" "dap" ]; args = [ "-i" "dap" ];
}; };
lldb = { lldb = { command = "lldb-dap"; };
command = "lldb-dap";
};
dart = { dart = {
command = "dart"; command = "dart";

View File

@ -14,8 +14,7 @@ let
module.imports = firstSetupArgs.baseNixvimModules ++ [ module ]; module.imports = firstSetupArgs.baseNixvimModules ++ [ module ];
extraSpecialArgs.hmConfig = config; extraSpecialArgs.hmConfig = config;
}; };
in in {
{
options.users.foo-dogsquared.programs.nixvim.enable = options.users.foo-dogsquared.programs.nixvim.enable =
lib.mkEnableOption "NixVim setup"; lib.mkEnableOption "NixVim setup";
@ -29,14 +28,12 @@ in
wrapper-manager.packages.neovim-flavors = { wrapper-manager.packages.neovim-flavors = {
wrappers.nvim-fiesta.arg0 = let wrappers.nvim-fiesta.arg0 = let
nvimPkg = createNixvimFlavor { nvimPkg = createNixvimFlavor {
imports = imports = [
[
./colorschemes.nix ./colorschemes.nix
./fuzzy-finding.nix ./fuzzy-finding.nix
./misc.nix ./misc.nix
./note-taking.nix ./note-taking.nix
] ] ++ lib.optionals userCfg.setups.development.enable [
++ lib.optionals userCfg.setups.development.enable [
./dev.nix ./dev.nix
./lsp.nix ./lsp.nix
./dap.nix ./dap.nix
@ -44,7 +41,8 @@ in
config = { config = {
# Inherit all of the schemes. # Inherit all of the schemes.
bahaghari.tinted-theming.schemes = hmCfg.bahaghari.tinted-theming.schemes; bahaghari.tinted-theming.schemes =
hmCfg.bahaghari.tinted-theming.schemes;
}; };
}; };
in lib.getExe' nvimPkg "nvim"; in lib.getExe' nvimPkg "nvim";

View File

@ -22,7 +22,8 @@
# Give language "support" through tree-sitter. # Give language "support" through tree-sitter.
plugins.treesitter.grammarPackages = plugins.treesitter.grammarPackages =
with config.plugins.treesitter.package.builtGrammars; [ with config.plugins.treesitter.package.builtGrammars;
[
agda agda
arduino arduino
astro astro
@ -54,6 +55,7 @@
kotlin kotlin
make make
nickel nickel
nix
perl perl
ruby ruby
rust rust
@ -64,15 +66,7 @@
wgsl wgsl
wgsl_bevy wgsl_bevy
zig zig
] ] ++ (with pkgs.tree-sitter-grammars; [ tree-sitter-elisp tree-sitter-nu ]);
++ (with pkgs.tree-sitter-grammars; [
tree-sitter-elisp
tree-sitter-nu
]);
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [ vim-nickel vim-nix zig-vim ];
vim-nickel
vim-nix
zig-vim
];
} }

View File

@ -3,8 +3,7 @@
let let
inherit (hmConfig.xdg) userDirs; inherit (hmConfig.xdg) userDirs;
telescopeExtensions = config.plugins.telescope.extensions; telescopeExtensions = config.plugins.telescope.extensions;
in in {
{
plugins.telescope.extensions.frecency = { plugins.telescope.extensions.frecency = {
enable = true; enable = true;
settings = { settings = {
@ -18,15 +17,14 @@ in
}; };
}; };
plugins.telescope.extensions.live-grep-args = { plugins.telescope.extensions.live-grep-args = { enable = true; };
enable = true;
};
keymaps = keymaps = lib.optionals telescopeExtensions.live-grep-args.enable
lib.optionals telescopeExtensions.live-grep-args.enable (lib.singleton { (lib.singleton {
mode = "n"; mode = "n";
key = "<leader>fG"; key = "<leader>fG";
options.desc = "Live grep (with args) for the whole project"; options.desc = "Live grep (with args) for the whole project";
action = helpers.mkRaw "require('telescope').extensions.live_grep_args.live_grep_args"; action = helpers.mkRaw
"require('telescope').extensions.live_grep_args.live_grep_args";
}); });
} }

View File

@ -1,16 +1,12 @@
{ config, lib, pkgs, hmConfig, ... }: { config, lib, pkgs, hmConfig, ... }:
let let userConfig = hmConfig.users.foo-dogsquared;
userConfig = hmConfig.users.foo-dogsquared; in {
in extraPlugins = builtins.map (path:
{
extraPlugins = builtins.map
(path:
pkgs.runCommand "vim-plugin-bare" { } '' pkgs.runCommand "vim-plugin-bare" { } ''
mkdir -p "$out" mkdir -p "$out"
cp -r ${path}/* "$out" cp -r ${path}/* "$out"
'') '') (with pkgs; [
(with pkgs; [
"${decker}/share/vim-plugins/decker" "${decker}/share/vim-plugins/decker"
"${fzf}/share/vim-plugins/fzf" "${fzf}/share/vim-plugins/fzf"
]); ]);

View File

@ -5,8 +5,7 @@ let
cfg = userCfg.programs.nushell; cfg = userCfg.programs.nushell;
nushellAutoloadScriptDir = "${config.xdg.dataHome}/nushell/vendor/autoload"; nushellAutoloadScriptDir = "${config.xdg.dataHome}/nushell/vendor/autoload";
in in {
{
options.users.foo-dogsquared.programs.nushell.enable = options.users.foo-dogsquared.programs.nushell.enable =
lib.mkEnableOption "Nushell setup"; lib.mkEnableOption "Nushell setup";
@ -20,7 +19,6 @@ in
skim skim
polars polars
units units
net
formats formats
highlight highlight
]; ];
@ -35,8 +33,7 @@ in
} }
} }
''; '';
environmentVariables.NU_LIB_DIRS = environmentVariables.NU_LIB_DIRS = lib.concatStringsSep ":" [
lib.concatStringsSep ":" [
"${config.xdg.cacheHome}/nushell/modules" "${config.xdg.cacheHome}/nushell/modules"
"${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/nushell" "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/nushell"
]; ];
@ -76,9 +73,11 @@ in
} }
match $spans.0 { match $spans.0 {
${lib.optionalString config.programs.zoxide.enable '' ${
lib.optionalString config.programs.zoxide.enable ''
__zoxide_z | __zoxide_zi => $zoxide_completer __zoxide_z | __zoxide_zi => $zoxide_completer
''} ''
}
_ => $carapace_completer _ => $carapace_completer
} | do $in $spans } | do $in $spans
} }

View File

@ -4,10 +4,9 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.shell; cfg = userCfg.programs.shell;
in in {
{ options.users.foo-dogsquared.programs.shell.enable = lib.mkEnableOption
options.users.foo-dogsquared.programs.shell.enable = "configuration of foo-dogsquared's shell of choice and its toolbelt";
lib.mkEnableOption "configuration of foo-dogsquared's shell of choice and its toolbelt";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
suites.dev.shell.enable = lib.mkDefault true; suites.dev.shell.enable = lib.mkDefault true;
@ -15,21 +14,12 @@ in
programs.bash = { programs.bash = {
enable = true; enable = true;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
historyIgnore = [ historyIgnore = [ "cd" "exit" "lf" "ls" "nvim" ];
"cd"
"exit"
"lf"
"ls"
"nvim"
];
}; };
# Additional formatting thingies for your fuzzy finder. # Additional formatting thingies for your fuzzy finder.
programs.fzf.defaultOptions = [ programs.fzf.defaultOptions =
"--height=40%" [ "--height=40%" "--bind=ctrl-z:ignore" "--reverse" ];
"--bind=ctrl-z:ignore"
"--reverse"
];
# Compile all of the completions. # Compile all of the completions.
programs.carapace.enable = true; programs.carapace.enable = true;

View File

@ -10,8 +10,7 @@ let
''; '';
hasNixosModuleEnable = attrs.nixosConfig.programs.wezterm.enable or false; hasNixosModuleEnable = attrs.nixosConfig.programs.wezterm.enable or false;
in in {
{
options.users.foo-dogsquared.programs.terminal-emulator.enable = options.users.foo-dogsquared.programs.terminal-emulator.enable =
lib.mkEnableOption "foo-dogsquared's terminal emulator setup"; lib.mkEnableOption "foo-dogsquared's terminal emulator setup";
@ -19,8 +18,7 @@ in
{ {
# We're just making a version of Wezterm with the default arguments if # We're just making a version of Wezterm with the default arguments if
# the user has them. # the user has them.
home.packages = home.packages = let
let
inherit (pkgs) wezterm hiPrio; inherit (pkgs) wezterm hiPrio;
weztermUserDefaultDesktop = pkgs.makeDesktopItem { weztermUserDefaultDesktop = pkgs.makeDesktopItem {
name = "org.wezfurlong.wezterm"; name = "org.wezfurlong.wezterm";
@ -46,12 +44,7 @@ in
type = "Application"; type = "Application";
categories = [ "System" "TerminalEmulator" "Utility" ]; categories = [ "System" "TerminalEmulator" "Utility" ];
}; };
in in [ wezterm (hiPrio weztermUserDefaultDesktop) weztermTypicalDesktop ];
[
wezterm
(hiPrio weztermUserDefaultDesktop)
weztermTypicalDesktop
];
} }
(lib.mkIf (!hasNixosModuleEnable) { (lib.mkIf (!hasNixosModuleEnable) {

View File

@ -3,8 +3,7 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.terminal-multiplexer; cfg = userCfg.programs.terminal-multiplexer;
in in {
{
options.users.foo-dogsquared.programs.terminal-multiplexer.enable = options.users.foo-dogsquared.programs.terminal-multiplexer.enable =
lib.mkEnableOption "foo-dogsquared's terminal multiplexer setup"; lib.mkEnableOption "foo-dogsquared's terminal multiplexer setup";

View File

@ -3,15 +3,15 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.vs-code; cfg = userCfg.programs.vs-code;
in in {
{
options.users.foo-dogsquared.programs.vs-code.enable = options.users.foo-dogsquared.programs.vs-code.enable =
lib.mkEnableOption "foo-dogsquared's Visual Studio Code setup"; lib.mkEnableOption "foo-dogsquared's Visual Studio Code setup";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
suites.editors.vscode.enable = true; suites.editors.vscode.enable = true;
programs.vscode = { programs.vscode = {
extensions = with pkgs.vscode-extensions; [ extensions = with pkgs.vscode-extensions;
[
# Additional language support. # Additional language support.
bbenoist.nix bbenoist.nix
graphql.vscode-graphql graphql.vscode-graphql
@ -31,14 +31,10 @@ in
editorconfig.editorconfig editorconfig.editorconfig
alefragnani.project-manager alefragnani.project-manager
fill-labs.dependi fill-labs.dependi
] ] ++ lib.optionals userCfg.programs.browsers.firefox.enable
++ lib.optionals userCfg.programs.browsers.firefox.enable [ [ firefox-devtools.vscode-firefox-debug ];
firefox-devtools.vscode-firefox-debug
];
userSettings = { userSettings = { "extensions.ignoreRecommendations" = true; };
"extensions.ignoreRecommendations" = true;
};
}; };
# We're using Visual Studio Code as a git difftool and mergetool which is # We're using Visual Studio Code as a git difftool and mergetool which is

View File

@ -47,8 +47,7 @@ let
}; };
}; };
}; };
in in {
{
options.users.foo-dogsquared.services.archivebox = { options.users.foo-dogsquared.services.archivebox = {
enable = lib.mkEnableOption "ArchiveBox web UI server (through Podman)"; enable = lib.mkEnableOption "ArchiveBox web UI server (through Podman)";
@ -97,14 +96,20 @@ in
}; };
services.podman.containers = lib.mkMerge [ services.podman.containers = lib.mkMerge [
(lib.mapAttrs' (name: value: lib.nameValuePair (jobUnitName name) { (lib.mapAttrs' (name: value:
lib.nameValuePair (jobUnitName name) {
image = "docker.io/archivebox/archivebox:latest"; image = "docker.io/archivebox/archivebox:latest";
description = "ArchiveBox job '${name}'"; description = "ArchiveBox job '${name}'";
volumes = [ "${archiveboxDir}:/data" ]; volumes = [ "${archiveboxDir}:/data" ];
autoUpdate = "registry"; autoUpdate = "registry";
exec = ''echo "${lib.concatStringsSep "\n" value.links}" | archivebox add ${lib.concatStringsSep " " value.extraArgs}''; exec = ''
environmentFile = config.services.podman.containers.archivebox-webui.environmentFile; echo "${lib.concatStringsSep "\n" value.links}" | archivebox add ${
environment = config.services.podman.containers.archivebox-webui.environment; lib.concatStringsSep " " value.extraArgs
}'';
environmentFile =
config.services.podman.containers.archivebox-webui.environmentFile;
environment =
config.services.podman.containers.archivebox-webui.environment;
}) cfg.jobs) }) cfg.jobs)
{ {
@ -112,9 +117,7 @@ in
image = "docker.io/archivebox/archivebox:latest"; image = "docker.io/archivebox/archivebox:latest";
description = "ArchiveBox web server"; description = "ArchiveBox web server";
ports = [ "${port}:${port}" ]; ports = [ "${port}:${port}" ];
volumes = [ volumes = [ "${archiveboxDir}:/data" ];
"${archiveboxDir}:/data"
];
autoUpdate = "registry"; autoUpdate = "registry";
exec = "archivebox server ${url}"; exec = "archivebox server ${url}";
environmentFile = [ "${config.sops.secrets."archivebox/env".path}" ]; environmentFile = [ "${config.sops.secrets."archivebox/env".path}" ];
@ -135,8 +138,7 @@ in
archivebox-sonic-search = { archivebox-sonic-search = {
image = "docker.io/archivebox/sonic:latest"; image = "docker.io/archivebox/sonic:latest";
description = "Sonic search instance for ArchiveBox"; description = "Sonic search instance for ArchiveBox";
ports = let ports = let port = builtins.toString config.state.ports.sonic.value;
port = builtins.toString config.state.ports.sonic.value;
in [ "${port}:${port}" ]; in [ "${port}:${port}" ];
environmentFile = [ "${config.sops.secrets."sonic/env".path}" ]; environmentFile = [ "${config.sops.secrets."sonic/env".path}" ];
volumes = [ volumes = [
@ -148,7 +150,8 @@ in
} }
]; ];
users.foo-dogsquared.programs.custom-homepage.sections.services.links = lib.singleton { users.foo-dogsquared.programs.custom-homepage.sections.services.links =
lib.singleton {
url = "${url}/public"; url = "${url}/public";
text = "Link archive"; text = "Link archive";
}; };

View File

@ -5,19 +5,20 @@ let
cfg = userCfg.services.backup; cfg = userCfg.services.backup;
pathPrefix = "borg-backup"; pathPrefix = "borg-backup";
getPath = path: getPath = path: config.sops.secrets."${pathPrefix}/${path}".path;
config.sops.secrets."${pathPrefix}/${path}".path;
isFilesystemSet = setupName: isFilesystemSet = setupName:
attrs.nixosConfig.suites.filesystem.setups.${setupName}.enable or false; attrs.nixosConfig.suites.filesystem.setups.${setupName}.enable or false;
hetznerBoxesUser = "u332477"; hetznerBoxesUser = "u332477";
hetznerBoxesServer = "${hetznerBoxesUser}.your-storagebox.de"; hetznerBoxesServer = "${hetznerBoxesUser}.your-storagebox.de";
borgmaticCommonConfig = module: lib.mkMerge [ borgmaticCommonConfig = module:
lib.mkMerge [
module module
{ {
archive_name_format = lib.mkDefault "{fqdn}-home-manager-personal-{now}"; archive_name_format =
lib.mkDefault "{fqdn}-home-manager-personal-{now}";
patterns = lib.mkBefore [ patterns = lib.mkBefore [
"R ${config.home.homeDirectory}" "R ${config.home.homeDirectory}"
"! ${config.xdg.dataHome}" "! ${config.xdg.dataHome}"
@ -35,17 +36,9 @@ let
"+ ${config.xdg.configHome}/age" "+ ${config.xdg.configHome}/age"
"+ ${config.xdg.configHome}/sops" "+ ${config.xdg.configHome}/sops"
]; ];
exclude_if_present = [ exclude_if_present = [ ".nobackup" ".exclude.bak" ];
".nobackup" exclude_patterns =
".exclude.bak" [ "node_modules/" "*.pyc" "result*/" "*/.vim*.tmp" "target/" ];
];
exclude_patterns = [
"node_modules/"
"*.pyc"
"result*/"
"*/.vim*.tmp"
"target/"
];
store_config_files = true; store_config_files = true;
@ -61,17 +54,17 @@ let
} }
]; ];
checkRemovableMountScript = pkgs.writeShellScript "check-for-removable-storage" '' checkRemovableMountScript =
pkgs.writeShellScript "check-for-removable-storage" ''
{ findmnt "$(dirname "$1")" > /dev/null && [ -d "$1" ]; } || exit 75 { findmnt "$(dirname "$1")" > /dev/null && [ -d "$1" ]; } || exit 75
''; '';
in in {
{
options.users.foo-dogsquared.services.backup.enable = options.users.foo-dogsquared.services.backup.enable =
lib.mkEnableOption "preferred backup service"; lib.mkEnableOption "preferred backup service";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml ( sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml
foodogsquaredLib.sops-nix.attachSopsPathPrefix pathPrefix { (foodogsquaredLib.sops-nix.attachSopsPathPrefix pathPrefix {
"repos/remote-hetzner-boxes-personal/password" = { }; "repos/remote-hetzner-boxes-personal/password" = { };
"repos/local-external-hdd-personal/password" = { }; "repos/local-external-hdd-personal/password" = { };
"repos/local-archive-personal/password" = { }; "repos/local-archive-personal/password" = { };
@ -84,15 +77,18 @@ in
initService.enable = true; initService.enable = true;
initService.startAt = "06:30"; initService.startAt = "06:30";
settings = borgmaticCommonConfig { settings = borgmaticCommonConfig {
encryption_passcommand = "cat ${getPath "repos/remote-hetzner-boxes-personal/password"}"; encryption_passcommand =
"cat ${getPath "repos/remote-hetzner-boxes-personal/password"}";
repositories = lib.singleton { repositories = lib.singleton {
path = "ssh://${hetznerBoxesUser}@${hetznerBoxesServer}:23/./borg/users/${config.home.username}"; path =
"ssh://${hetznerBoxesUser}@${hetznerBoxesServer}:23/./borg/users/${config.home.username}";
label = "remote-hetzner-boxes"; label = "remote-hetzner-boxes";
}; };
extra_borg_options = { extra_borg_options = {
init = builtins.toString [ init = builtins.toString [
"--make-parent-dirs" "--make-parent-dirs"
"--encryption" "repokey-blake2" "--encryption"
"repokey-blake2"
]; ];
}; };
}; };
@ -104,14 +100,17 @@ in
initService.enable = true; initService.enable = true;
initService.startAt = "04:30"; initService.startAt = "04:30";
settings = let settings = let
removablePath = "${attrs.nixosConfig.state.paths.external-hdd}/Backups"; removablePath =
"${attrs.nixosConfig.state.paths.external-hdd}/Backups";
in borgmaticCommonConfig { in borgmaticCommonConfig {
encryption_passcommand = "cat ${getPath "repos/local-external-hdd-personal/password"}"; encryption_passcommand =
"cat ${getPath "repos/local-external-hdd-personal/password"}";
repositories = lib.singleton { repositories = lib.singleton {
path = removablePath; path = removablePath;
label = "local-external-hdd"; label = "local-external-hdd";
}; };
before_backup = lib.singleton "${checkRemovableMountScript} ${removablePath}"; before_backup =
lib.singleton "${checkRemovableMountScript} ${removablePath}";
}; };
}; };
}) })
@ -121,9 +120,11 @@ in
initService.enable = true; initService.enable = true;
initService.startAt = "04:30"; initService.startAt = "04:30";
settings = borgmaticCommonConfig { settings = borgmaticCommonConfig {
encryption_passcommand = "cat ${getPath "repos/local-archive-personal/password"}"; encryption_passcommand =
"cat ${getPath "repos/local-archive-personal/password"}";
repositories = lib.singleton { repositories = lib.singleton {
path = "\${BORG_PERSONAL_FDS_PATH:-${attrs.nixosConfig.state.paths.laptop-ssd}/Backups/foodogsquared}"; path =
"\${BORG_PERSONAL_FDS_PATH:-${attrs.nixosConfig.state.paths.laptop-ssd}/Backups/foodogsquared}";
label = "local-archive"; label = "local-archive";
}; };
}; };
@ -136,13 +137,18 @@ in
enable = true; enable = true;
startAt = "daily"; startAt = "daily";
settings = let settings = let backup_path = "${config.xdg.cacheHome}/ludusavi/backups";
backup_path = "${config.xdg.cacheHome}/ludusavi/backups";
in { in {
manifest.enable = true; manifest.enable = true;
roots = [ roots = [
{ path = "${config.home.homeDirectory}/.steam"; store = "steam"; } {
{ path = "${config.xdg.dataHome}/lutris"; store = "lutris"; } path = "${config.home.homeDirectory}/.steam";
store = "steam";
}
{
path = "${config.xdg.dataHome}/lutris";
store = "lutris";
}
]; ];
backup.path = backup_path; backup.path = backup_path;
restore.path = backup_path; restore.path = backup_path;

View File

@ -3,16 +3,11 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.setups.business; cfg = userCfg.setups.business;
in in {
{
options.users.foo-dogsquared.setups.business.enable = options.users.foo-dogsquared.setups.business.enable =
lib.mkEnableOption "business setup"; lib.mkEnableOption "business setup";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [ collabora-online libreoffice zoom-us ];
collabora-online
libreoffice
zoom-us
];
}; };
} }

View File

@ -4,18 +4,14 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.setups.desktop; cfg = userCfg.setups.desktop;
in in {
{
options.users.foo-dogsquared.setups.desktop.enable = options.users.foo-dogsquared.setups.desktop.enable =
lib.mkEnableOption "a set of usual desktop productivity services"; lib.mkEnableOption "a set of usual desktop productivity services";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
state.ports.activitywatch.value = 5600; state.ports.activitywatch.value = 5600;
home.packages = with pkgs; [ home.packages = with pkgs; [ bitwarden-cli bitwarden-desktop ];
bitwarden-cli
bitwarden-desktop
];
# Install all of the desktop stuff. # Install all of the desktop stuff.
suites.desktop = { suites.desktop = {
@ -66,19 +62,14 @@ in
startAt = "daily"; startAt = "daily";
settings = { settings = {
topdirs = "~/Downloads ~/Documents ~/library"; topdirs = "~/Downloads ~/Documents ~/library";
"skippedNames+" = "skippedNames+" = let inherit (config.state.paths) ignoreDirectories;
let in lib.concatStringsSep " " ignoreDirectories;
inherit (config.state.paths) ignoreDirectories;
in
lib.concatStringsSep " " ignoreDirectories;
"~/library/projects" = { "~/library/projects" = {
"skippedNames+" = ".editorconfig .gitignore result flake.lock go.sum"; "skippedNames+" = ".editorconfig .gitignore result flake.lock go.sum";
}; };
"~/library/projects/software" = { "~/library/projects/software" = { "skippedNames+" = "target result"; };
"skippedNames+" = "target result";
};
}; };
}; };
@ -92,8 +83,11 @@ in
startAt = "daily"; startAt = "daily";
}; };
users.foo-dogsquared.programs.custom-homepage.sections.services.links = lib.singleton { users.foo-dogsquared.programs.custom-homepage.sections.services.links =
url = "http://localhost:${builtins.toString config.state.ports.activitywatch.value}"; lib.singleton {
url = "http://localhost:${
builtins.toString config.state.ports.activitywatch.value
}";
text = "Telemetry server"; text = "Telemetry server";
}; };
}; };

View File

@ -5,8 +5,7 @@ let
cfg = userCfg.setups.development; cfg = userCfg.setups.development;
in { in {
options.users.foo-dogsquared.setups.development = { options.users.foo-dogsquared.setups.development = {
enable = enable = lib.mkEnableOption "foo-dogsquared's software development setup";
lib.mkEnableOption "foo-dogsquared's software development setup";
creative-coding.enable = creative-coding.enable =
lib.mkEnableOption "foo-dogsquared's creative coding setup"; lib.mkEnableOption "foo-dogsquared's creative coding setup";
@ -54,10 +53,12 @@ in {
users.foo-dogsquared.programs.custom-homepage.sections.services.links = users.foo-dogsquared.programs.custom-homepage.sections.services.links =
let let
hasCockpitEnabled = attrs.nixosConfig.services.cockpit.enable or false; hasCockpitEnabled =
in attrs.nixosConfig.services.cockpit.enable or false;
lib.optionals hasCockpitEnabled (lib.singleton { in lib.optionals hasCockpitEnabled (lib.singleton {
url = "http://localhost:${builtins.toString attrs.nixosConfig.services.cockpit.port}"; url = "http://localhost:${
builtins.toString attrs.nixosConfig.services.cockpit.port
}";
text = "Cockpit WebUI"; text = "Cockpit WebUI";
}); });
@ -69,7 +70,7 @@ in {
home.packages = with pkgs; [ home.packages = with pkgs; [
cachix # Compile no more by using someone's binary cache! cachix # Compile no more by using someone's binary cache!
regex-cli # Save some face of confusion for yourself. regex-cli # Save some face of confusion for yourself.
dt # Get that functional gawk. #dt # Get that functional gawk.
jq # Get that JSON querying tool. jq # Get that JSON querying tool.
recode # Convert between different encodings. recode # Convert between different encodings.
go-migrate # Go potential migraines. go-migrate # Go potential migraines.
@ -91,10 +92,9 @@ in {
]; ];
} }
(lib.mkIf (!userCfg.programs.nixvim.enable) { (lib.mkIf (!config.programs.nixvim.enable or false) {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
package = pkgs.neovim-nightly;
vimAlias = true; vimAlias = true;
vimdiffAlias = true; vimdiffAlias = true;
@ -105,9 +105,7 @@ in {
}) })
(lib.mkIf userCfg.programs.browsers.firefox.enable { (lib.mkIf userCfg.programs.browsers.firefox.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [ (lowPrio firefox-devedition) ];
(lowPrio firefox-devedition)
];
}) })
(lib.mkIf userCfg.programs.git.enable { (lib.mkIf userCfg.programs.git.enable {
@ -145,7 +143,7 @@ in {
home.packages = with pkgs; [ home.packages = with pkgs; [
supercollider-with-plugins supercollider-with-plugins
processing processing
(puredata-with-plugins (with pkgs; [ zexy cyclone ])) #(puredata-with-plugins (with pkgs; [ zexy cyclone ]))
]; ];
}) })
]); ]);

View File

@ -3,8 +3,7 @@
let let
userCfg = config.users.foo-dogsquared; userCfg = config.users.foo-dogsquared;
cfg = userCfg.setups.fonts; cfg = userCfg.setups.fonts;
in in {
{
options.users.foo-dogsquared.setups.fonts.enable = options.users.foo-dogsquared.setups.fonts.enable =
lib.mkEnableOption "foo-dogsquared's font setup"; lib.mkEnableOption "foo-dogsquared's font setup";

View File

@ -10,8 +10,7 @@ let
musicDir = config.xdg.userDirs.music; musicDir = config.xdg.userDirs.music;
playlistsDir = "${musicDir}/playlists"; playlistsDir = "${musicDir}/playlists";
in in {
{
options.users.foo-dogsquared.setups.music = { options.users.foo-dogsquared.setups.music = {
enable = lib.mkEnableOption "foo-dogsquared's music setup"; enable = lib.mkEnableOption "foo-dogsquared's music setup";
mpd.enable = lib.mkEnableOption "foo-dogsquared's MPD server setup"; mpd.enable = lib.mkEnableOption "foo-dogsquared's MPD server setup";
@ -28,9 +27,7 @@ in
wrapper-manager.packages.music-setup = { wrapper-manager.packages.music-setup = {
wrappers.yt-dlp-audio = { wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp"; arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [ prependArgs = [ "--config-location" ../../config/yt-dlp/audio.conf ];
"--config-location" ../../config/yt-dlp/audio.conf
];
}; };
}; };
@ -107,12 +104,15 @@ in
users.foo-dogsquared.programs.custom-homepage.sections = lib.mkMerge [ users.foo-dogsquared.programs.custom-homepage.sections = lib.mkMerge [
(lib.mkIf (attrs.nixosConfig.services.gonic.enable or false) (let (lib.mkIf (attrs.nixosConfig.services.gonic.enable or false) (let
subsonicLink = { subsonicLink = {
url = "http://localhost:${builtins.toString attrs.nixosConfig.state.ports.gonic.value}"; url = "http://localhost:${
builtins.toString attrs.nixosConfig.state.ports.gonic.value
}";
text = "Jukebox server"; text = "Jukebox server";
}; };
in { in {
services.links = lib.singleton subsonicLink; services.links = lib.singleton subsonicLink;
music.links = lib.mkBefore [ (subsonicLink // { text = "Subsonic music server"; }) ]; music.links = lib.mkBefore
[ (subsonicLink // { text = "Subsonic music server"; }) ];
})) }))
]; ];
} }
@ -120,12 +120,14 @@ in
(lib.mkIf cfg.spotify.enable { (lib.mkIf cfg.spotify.enable {
home.packages = with pkgs; [ spotify ]; home.packages = with pkgs; [ spotify ];
state.ports.spotifyd.value = attrs.nixosConfig.services.spotifyd.value or 9009; state.ports.spotifyd.value =
attrs.nixosConfig.services.spotifyd.value or 9009;
services.mopidy.extensionPackages = [ pkgs.mopidy-spotify ]; services.mopidy.extensionPackages = [ pkgs.mopidy-spotify ];
}) })
(lib.mkIf (cfg.spotify.enable && !(attrs.nixosConfig.services.spotifyd.enable or false)) { (lib.mkIf (cfg.spotify.enable
&& !(attrs.nixosConfig.services.spotifyd.enable or false)) {
services.spotifyd = { services.spotifyd = {
enable = true; enable = true;
settings.global = { settings.global = {
@ -136,7 +138,10 @@ in
zeroconf_port = config.state.ports.spotifyd.value; zeroconf_port = config.state.ports.spotifyd.value;
cache_path = "${config.xdg.cacheHome}/spotifyd"; cache_path = "${config.xdg.cacheHome}/spotifyd";
max_cache_size = unitsToInt { size = 4; prefix = "G"; }; max_cache_size = unitsToInt {
size = 4;
prefix = "G";
};
}; };
}; };
}) })
@ -165,10 +170,7 @@ in
file = { file = {
enabled = true; enabled = true;
media_dirs = [ media_dirs = [ "$XDG_MUSIC_DIR|Music" "~/library/music|Library" ]
"$XDG_MUSIC_DIR|Music"
"~/library/music|Library"
]
++ lib.optional (isFilesystemSet "external-hdd") ++ lib.optional (isFilesystemSet "external-hdd")
"${attrs.nixosConfig.state.paths.external-hdd}/Music|External storage" "${attrs.nixosConfig.state.paths.external-hdd}/Music|External storage"
++ lib.optional (isFilesystemSet "archive") ++ lib.optional (isFilesystemSet "archive")
@ -207,12 +209,15 @@ in
# Set this to the custom homepage. # Set this to the custom homepage.
users.foo-dogsquared.programs.custom-homepage.sections = let users.foo-dogsquared.programs.custom-homepage.sections = let
mopidyLink = { mopidyLink = {
url = "http://localhost:${builtins.toString config.state.ports.mopidy.value}"; url = "http://localhost:${
builtins.toString config.state.ports.mopidy.value
}";
text = "Music streaming server"; text = "Music streaming server";
}; };
in { in {
services.links = lib.singleton mopidyLink; services.links = lib.singleton mopidyLink;
music.links = lib.mkBefore [ (mopidyLink // { text = "Mopidy server"; }) ]; music.links =
lib.mkBefore [ (mopidyLink // { text = "Mopidy server"; }) ];
}; };
}) })
]); ]);

View File

@ -10,29 +10,37 @@ let
# `services.gallery-dl`, and `services.archivebox`. # `services.gallery-dl`, and `services.archivebox`.
mkJobs = { extraArgs ? [ ], db }: mkJobs = { extraArgs ? [ ], db }:
let let
days = [ "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" ]; days = [
categories = lib.zipListsWith "Monday"
(index: category: { inherit index; data = category; }) "Tuesday"
(lib.lists.range 1 (lib.length (lib.attrValues db))) "Wednesday"
(lib.mapAttrsToList (name: value: { inherit name; inherit (value) subscriptions extraArgs; }) db); "Thursday"
jobsList = builtins.map "Friday"
(category: "Saturday"
let "Sunday"
jobExtraArgs = lib.attrByPath [ "data" "extraArgs" ] [ ] category; ];
in categories = lib.zipListsWith (index: category: {
{ inherit index;
data = category;
}) (lib.lists.range 1 (lib.length (lib.attrValues db)))
(lib.mapAttrsToList (name: value: {
inherit name;
inherit (value) subscriptions extraArgs;
}) db);
jobsList = builtins.map (category:
let jobExtraArgs = lib.attrByPath [ "data" "extraArgs" ] [ ] category;
in {
name = category.data.name; name = category.data.name;
value = { value = {
extraArgs = extraArgs ++ jobExtraArgs; extraArgs = extraArgs ++ jobExtraArgs;
urls = builtins.map (subscription: subscription.url) category.data.subscriptions; urls = builtins.map (subscription: subscription.url)
startAt = lib.elemAt days (lib.mod category.index (lib.length days)); category.data.subscriptions;
startAt =
lib.elemAt days (lib.mod category.index (lib.length days));
}; };
}) }) categories;
categories; in lib.listToAttrs jobsList;
in in {
lib.listToAttrs jobsList;
in
{
options.users.foo-dogsquared.setups.research.enable = options.users.foo-dogsquared.setups.research.enable =
lib.mkEnableOption "foo-dogsquared's usual toolbelt for research"; lib.mkEnableOption "foo-dogsquared's usual toolbelt for research";
@ -60,7 +68,9 @@ in
services.syncthing = { services.syncthing = {
enable = true; enable = true;
extraOptions = [ extraOptions = [
"--gui-address=http://localhost:${builtins.toString config.state.ports.syncthing.value}" "--gui-address=http://localhost:${
builtins.toString config.state.ports.syncthing.value
}"
]; ];
}; };
@ -70,7 +80,9 @@ in
users.foo-dogsquared.programs.custom-homepage.sections.services.links = users.foo-dogsquared.programs.custom-homepage.sections.services.links =
lib.singleton { lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.syncthing.value}"; url = "http://localhost:${
builtins.toString config.state.ports.syncthing.value
}";
text = "Local sync server"; text = "Local sync server";
}; };
} }

View File

@ -24,13 +24,7 @@
programs.bash = { programs.bash = {
enable = true; enable = true;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
historyIgnore = [ historyIgnore = [ "cd" "exit" "lf" "ls" "nvim" ];
"cd"
"exit"
"lf"
"ls"
"nvim"
];
}; };
home.stateVersion = "23.11"; home.stateVersion = "23.11";

View File

@ -1,5 +1 @@
{ { imports = [ ./programs/terminal-multiplexer.nix ]; }
imports = [
./programs/terminal-multiplexer.nix
];
}

View File

@ -4,8 +4,7 @@
let let
userCfg = config.users.nixos; userCfg = config.users.nixos;
cfg = userCfg.programs.terminal-multiplexer; cfg = userCfg.programs.terminal-multiplexer;
in in {
{
options.users.nixos.programs.terminal-multiplexer.enable = options.users.nixos.programs.terminal-multiplexer.enable =
lib.mkEnableOption "terminal multiplexer"; lib.mkEnableOption "terminal multiplexer";

View File

@ -2,23 +2,13 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [ glances wireshark-cli jq ];
glances
wireshark-cli
jq
];
# My user shell of choice because I'm not a hipster. # My user shell of choice because I'm not a hipster.
programs.bash = { programs.bash = {
enable = true; enable = true;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
historyIgnore = [ historyIgnore = [ "cd" "exit" "lf" "ls" "nvim" ];
"cd"
"exit"
"lf"
"ls"
"nvim"
];
}; };
suites = { suites = {
@ -39,10 +29,7 @@
services.bleachbit = { services.bleachbit = {
enable = true; enable = true;
cleaners = [ cleaners = [ "bash.history" "vim.history" ];
"bash.history"
"vim.history"
];
startAt = "weekly"; startAt = "weekly";
}; };

View File

@ -1,10 +1,8 @@
# Mainly used for managing the installations with deploy-rs. # Mainly used for managing the installations with deploy-rs.
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let name = "admin";
name = "admin"; in {
in
{
users.users.${name} = { users.users.${name} = {
description = "The administrator account for the servers."; description = "The administrator account for the servers.";
isNormalUser = true; isNormalUser = true;

View File

@ -24,10 +24,8 @@
sandbox = true; sandbox = true;
# Set several binary caches. # Set several binary caches.
substituters = [ substituters =
"https://cache.nixos.org/" [ "https://cache.nixos.org/" "https://nix-community.cachix.org" ];
"https://nix-community.cachix.org"
];
trusted-public-keys = [ trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];

View File

@ -4,11 +4,11 @@
let let
user = "plover"; user = "plover";
homeManagerUser = foodogsquaredUtils.getConfig "home-manager" user; homeManagerUser = foodogsquaredUtils.getConfig "home-manager" user;
in in {
{
users.users.${user} = { users.users.${user} = {
home = "/home/${user}"; home = "/home/${user}";
hashedPassword = "$y$j9T$43ExH5GLbEGwgnNGhmcTD/$qXoZE5Cm9O2Z3zMM/VyCZ18qN2Hc9.KvCnVz6tmjVVD"; hashedPassword =
"$y$j9T$43ExH5GLbEGwgnNGhmcTD/$qXoZE5Cm9O2Z3zMM/VyCZ18qN2Hc9.KvCnVz6tmjVVD";
extraGroups = [ "wheel" "kanidm" ]; extraGroups = [ "wheel" "kanidm" ];
useDefaultShell = true; useDefaultShell = true;
isNormalUser = true; isNormalUser = true;
@ -24,7 +24,5 @@ in
]; ];
}; };
home-manager.users.${user} = { home-manager.users.${user} = { imports = [ homeManagerUser ]; };
imports = [ homeManagerUser ];
};
} }

View File

@ -6,9 +6,7 @@
# #
# This means, there will be a "nixos" user among other things. # This means, there will be a "nixos" user among other things.
{ {
imports = [ imports = [ "${foodogsquaredModulesPath}/profiles/installer.nix" ];
"${foodogsquaredModulesPath}/profiles/installer.nix"
];
config = lib.mkMerge [ config = lib.mkMerge [
{ {

View File

@ -1,8 +1,4 @@
{ lib { lib, config, pkgs, foodogsquaredLib, foodogsquaredUtils
, config
, pkgs
, foodogsquaredLib
, foodogsquaredUtils
, foodogsquaredModulesPath , foodogsquaredModulesPath
, ... }: , ... }:
@ -34,9 +30,7 @@
# closure size smaller. # closure size smaller.
workflows = { workflows = {
enable = [ "a-happy-gnome" ]; enable = [ "a-happy-gnome" ];
workflows.a-happy-gnome = { workflows.a-happy-gnome = { extraApps = lib.mkForce [ ]; };
extraApps = lib.mkForce [ ];
};
}; };
# Install the web browser of course. What would be a graphical installer # Install the web browser of course. What would be a graphical installer
@ -63,8 +57,7 @@
system.stateVersion = "23.11"; system.stateVersion = "23.11";
} }
(lib.mkIf (lib.mkIf (foodogsquaredLib.nixos.isFormat config "isoImage") {
(foodogsquaredLib.nixos.isFormat config "isoImage") {
isoImage = { isoImage = {
isoBaseName = config.networking.hostName; isoBaseName = config.networking.hostName;
edition = "a-happy-gnome"; edition = "a-happy-gnome";

View File

@ -1,3 +1 @@
{ { allowUnfree = true; }
allowUnfree = true;
}

View File

@ -1,8 +1,7 @@
{ primaryDisk ? "/dev/nvme0n1", config, lib, ... }: { primaryDisk ? "/dev/nvme0n1", config, lib, ... }:
{ {
disko.devices = lib.mkMerge [ disko.devices = lib.mkMerge [{
{
disk."${config.networking.hostName}-primary" = { disk."${config.networking.hostName}-primary" = {
device = primaryDisk; device = primaryDisk;
type = "disk"; type = "disk";
@ -67,6 +66,5 @@
}; };
}; };
}; };
} }];
];
} }

View File

@ -1,12 +1,11 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = [ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_12; boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_12;
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "uas" "sd_mod" ]; boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "thunderbolt" "usbhid" "uas" "sd_mod" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];

View File

@ -4,8 +4,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.hardware.qol; cfg = hostCfg.hardware.qol;
in in {
{
options.hosts.ni.hardware.qol.enable = options.hosts.ni.hardware.qol.enable =
lib.mkEnableOption "quality-of-life hardware features"; lib.mkEnableOption "quality-of-life hardware features";
@ -17,10 +16,7 @@ in
services.printing = { services.printing = {
enable = true; enable = true;
browsing = true; browsing = true;
drivers = with pkgs; [ drivers = with pkgs; [ gutenprint splix ];
gutenprint
splix
];
}; };
# Extend the life of an SSD. # Extend the life of an SSD.

View File

@ -3,8 +3,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.networking; cfg = hostCfg.networking;
in in {
{
options.hosts.ni.networking = { options.hosts.ni.networking = {
enable = lib.mkEnableOption "networking setup"; enable = lib.mkEnableOption "networking setup";
@ -31,9 +30,7 @@ in
::: :::
''; '';
default = default =
if config.networking.useNetworkd if config.networking.useNetworkd then "networkd" else "networkmanager";
then "networkd"
else "networkmanager";
defaultText = '' defaultText = ''
When networkd is enabled, `networkd`, otherwise `networkmanager` as the When networkd is enabled, `networkd`, otherwise `networkmanager` as the
general fallback value. general fallback value.
@ -54,11 +51,8 @@ in
}; };
# Add these timeservers. # Add these timeservers.
networking.timeServers = lib.mkBefore [ networking.timeServers =
"ntp.nict.jp" lib.mkBefore [ "ntp.nict.jp" "time.nist.gov" "time.facebook.com" ];
"time.nist.gov"
"time.facebook.com"
];
# Put on your cloak, kid. # Put on your cloak, kid.
suites.vpn.personal.enable = true; suites.vpn.personal.enable = true;
@ -148,9 +142,7 @@ in
dhcp = lib.mkIf (config.networking.dhcpcd.enable) "dhcpcd"; dhcp = lib.mkIf (config.networking.dhcpcd.enable) "dhcpcd";
} }
(lib.mkIf config.services.resolved.enable { (lib.mkIf config.services.resolved.enable { dns = "systemd-resolved"; })
dns = "systemd-resolved";
})
]; ];
# We'll configure individual network interfaces to use DHCP since it can # We'll configure individual network interfaces to use DHCP since it can

View File

@ -8,14 +8,10 @@ let
inherit (builtins) toString; inherit (builtins) toString;
inherit (import ../../../plover/modules/hardware/networks.nix) inherit (import ../../../plover/modules/hardware/networks.nix)
interfaces interfaces wireguardPort wireguardPeers;
wireguardPort
wireguardPeers;
wireguardAllowedIPs = [ wireguardAllowedIPs =
"${interfaces.lan.IPv4.address}/16" [ "${interfaces.lan.IPv4.address}/16" "${interfaces.lan.IPv6.address}/64" ];
"${interfaces.lan.IPv6.address}/64"
];
wireguardIFName = "wireguard0"; wireguardIFName = "wireguard0";
internalDomains = [ internalDomains = [
@ -23,15 +19,16 @@ let
"~0.27.172.in-addr.arpa" "~0.27.172.in-addr.arpa"
"~0.28.172.in-addr.arpa" "~0.28.172.in-addr.arpa"
]; ];
in in {
{ options.hosts.ni.networking.wireguard.enable =
options.hosts.ni.networking.wireguard.enable = lib.mkEnableOption "Wireguard setup"; lib.mkEnableOption "Wireguard setup";
config = lib.mkIf (hostCfg.networking.enable && cfg.enable) (lib.mkMerge [ config = lib.mkIf (hostCfg.networking.enable && cfg.enable) (lib.mkMerge [
{ {
environment.systemPackages = with pkgs; [ wireguard-tools ]; environment.systemPackages = with pkgs; [ wireguard-tools ];
networking.firewall.allowedUDPPorts = [ wireguardPort ]; networking.firewall.allowedUDPPorts = [ wireguardPort ];
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ../../secrets/secrets.yaml { sops.secrets =
foodogsquaredLib.sops-nix.getSecrets ../../secrets/secrets.yaml {
"wireguard/private-key" = { }; "wireguard/private-key" = { };
"wireguard/preshared-keys/plover" = { }; "wireguard/preshared-keys/plover" = { };
"wireguard/preshared-keys/phone" = { }; "wireguard/preshared-keys/phone" = { };
@ -60,35 +57,36 @@ in
privateKeyFile = config.sops.secrets."wireguard/private-key".path; privateKeyFile = config.sops.secrets."wireguard/private-key".path;
listenPort = wireguardPort; listenPort = wireguardPort;
dns = with interfaces.lan; [ IPv4.address IPv6.address ]; dns = with interfaces.lan; [ IPv4.address IPv6.address ];
postUp = postUp = let resolvectl = "${lib.getBin pkgs.systemd}/bin/resolvectl";
let in ''
resolvectl = "${lib.getBin pkgs.systemd}/bin/resolvectl"; ${resolvectl} domain ${wireguardIFName} ${
in lib.concatStringsSep " " internalDomains
'' }
${resolvectl} domain ${wireguardIFName} ${lib.concatStringsSep " " internalDomains}
${resolvectl} dnssec ${wireguardIFName} no ${resolvectl} dnssec ${wireguardIFName} no
''; '';
address = with wireguardPeers.desktop; [ address = with wireguardPeers.desktop; [ "${IPv4}/32" "${IPv6}/128" ];
"${IPv4}/32"
"${IPv6}/128"
];
# Take note wg-quick doesn't trim the files so we have to trim it ourselves. # Take note wg-quick doesn't trim the files so we have to trim it ourselves.
peers = [ peers = [
# The "server" peer. # The "server" peer.
{ {
publicKey = lib.removeSuffix "\n" (lib.readFile ../../../plover/files/wireguard/wireguard-public-key-plover); publicKey = lib.removeSuffix "\n" (lib.readFile
presharedKeyFile = config.sops.secrets."wireguard/preshared-keys/plover".path; ../../../plover/files/wireguard/wireguard-public-key-plover);
presharedKeyFile =
config.sops.secrets."wireguard/preshared-keys/plover".path;
allowedIPs = wireguardAllowedIPs; allowedIPs = wireguardAllowedIPs;
endpoint = "${interfaces.wan.IPv4.address}:${toString wireguardPort}"; endpoint =
"${interfaces.wan.IPv4.address}:${toString wireguardPort}";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
# The "phone" peer. # The "phone" peer.
{ {
publicKey = lib.removeSuffix "\n" (lib.readFile ../../../plover/files/wireguard/wireguard-public-key-phone); publicKey = lib.removeSuffix "\n" (lib.readFile
presharedKeyFile = config.sops.secrets."wireguard/preshared-keys/phone".path; ../../../plover/files/wireguard/wireguard-public-key-phone);
presharedKeyFile =
config.sops.secrets."wireguard/preshared-keys/phone".path;
allowedIPs = wireguardAllowedIPs; allowedIPs = wireguardAllowedIPs;
} }
]; ];
@ -97,18 +95,17 @@ in
(lib.mkIf (networkSetup == "networkd") { (lib.mkIf (networkSetup == "networkd") {
# Just apply the appropriate permissions for systemd-networkd. # Just apply the appropriate permissions for systemd-networkd.
sops.secrets = sops.secrets = let
let
systemdNetworkFileAttrs = { systemdNetworkFileAttrs = {
group = config.users.users.systemd-network.group; group = config.users.users.systemd-network.group;
reloadUnits = [ "systemd-networkd.service" ]; reloadUnits = [ "systemd-networkd.service" ];
mode = "0640"; mode = "0640";
}; };
applySystemdAttr = secretPaths: lib.listToAttrs applySystemdAttr = secretPaths:
lib.listToAttrs
(builtins.map (path: lib.nameValuePair path systemdNetworkFileAttrs)) (builtins.map (path: lib.nameValuePair path systemdNetworkFileAttrs))
secretPaths; secretPaths;
in in applySystemdAttr [
applySystemdAttr [
"wireguard/private-key" "wireguard/private-key"
"wireguard/preshared-keys/phone" "wireguard/preshared-keys/phone"
"wireguard/preshared-keys/plover" "wireguard/preshared-keys/plover"
@ -129,17 +126,22 @@ in
wireguardPeers = [ wireguardPeers = [
# The "server" peer. # The "server" peer.
{ {
PublicKey = lib.readFile ../../../plover/files/wireguard/wireguard-public-key-plover; PublicKey = lib.readFile
PresharedKeyFile = config.sops.secrets."wireguard/preshared-keys/plover".path; ../../../plover/files/wireguard/wireguard-public-key-plover;
PresharedKeyFile =
config.sops.secrets."wireguard/preshared-keys/plover".path;
AllowedIPs = lib.concatStringsSep "," wireguardAllowedIPs; AllowedIPs = lib.concatStringsSep "," wireguardAllowedIPs;
Endpoint = "${interfaces.wan.IPv4.address}:${toString wireguardPort}"; Endpoint =
"${interfaces.wan.IPv4.address}:${toString wireguardPort}";
PersistentKeepalive = 25; PersistentKeepalive = 25;
} }
# The "phone" peer. # The "phone" peer.
{ {
PublicKey = lib.readFile ../../../plover/files/wireguard/wireguard-public-key-phone; PublicKey = lib.readFile
PresharedKeyFile = config.sops.secrets."wireguard/preshared-keys/phone".path; ../../../plover/files/wireguard/wireguard-public-key-phone;
PresharedKeyFile =
config.sops.secrets."wireguard/preshared-keys/phone".path;
AllowedIPs = lib.concatStringsSep "," wireguardAllowedIPs; AllowedIPs = lib.concatStringsSep "," wireguardAllowedIPs;
} }
]; ];
@ -148,10 +150,7 @@ in
networks."99-${wireguardIFName}" = { networks."99-${wireguardIFName}" = {
matchConfig.Name = wireguardIFName; matchConfig.Name = wireguardIFName;
address = with wireguardPeers.desktop; [ address = with wireguardPeers.desktop; [ "${IPv4}/32" "${IPv6}/128" ];
"${IPv4}/32"
"${IPv6}/128"
];
dns = with interfaces.lan; [ IPv4.address IPv6.address ]; dns = with interfaces.lan; [ IPv4.address IPv6.address ];
domains = internalDomains; domains = internalDomains;

View File

@ -6,10 +6,8 @@ let
cfg = hostCfg.services.backup; cfg = hostCfg.services.backup;
borgJobCommonSetting = { patterns ? [ ], passCommand, ... }@args: borgJobCommonSetting = { patterns ? [ ], passCommand, ... }@args:
let let args' = lib.attrsets.removeAttrs args [ "patterns" "passCommand" ];
args' = lib.attrsets.removeAttrs args [ "patterns" "passCommand" ]; in {
in
{
compression = "zstd,12"; compression = "zstd,12";
dateFormat = "+%F-%H-%M-%S-%z"; dateFormat = "+%F-%H-%M-%S-%z";
doInit = false; doInit = false;
@ -45,14 +43,12 @@ let
hetzner-boxes-server = "${hetzner-boxes-user}.your-storagebox.de"; hetzner-boxes-server = "${hetzner-boxes-user}.your-storagebox.de";
pathPrefix = "borg-backup"; pathPrefix = "borg-backup";
in in {
{
options.hosts.ni.services.backup.enable = options.hosts.ni.services.backup.enable =
lib.mkEnableOption "backup setup with BorgBackup"; lib.mkEnableOption "backup setup with BorgBackup";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops.secrets = foodogsquaredLib.sops-nix.getSecrets sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml
./secrets.yaml
(foodogsquaredLib.sops-nix.attachSopsPathPrefix pathPrefix { (foodogsquaredLib.sops-nix.attachSopsPathPrefix pathPrefix {
"patterns/home" = { }; "patterns/home" = { };
"patterns/root" = { }; "patterns/root" = { };
@ -63,9 +59,7 @@ in
"repos/hetzner-box/ssh-key" = { }; "repos/hetzner-box/ssh-key" = { };
}); });
suites.filesystem.setups = { suites.filesystem.setups = { laptop-ssd.enable = true; };
laptop-ssd.enable = true;
};
services.borgbackup.jobs = { services.borgbackup.jobs = {
local-external-storage = borgJobCommonSetting { local-external-storage = borgJobCommonSetting {
@ -73,21 +67,27 @@ in
secrets."${pathPrefix}/patterns/root".path secrets."${pathPrefix}/patterns/root".path
secrets."${pathPrefix}/patterns/keys".path secrets."${pathPrefix}/patterns/keys".path
]; ];
passCommand = "cat ${config.sops.secrets."${pathPrefix}/repos/external-hdd/password".path}"; passCommand = "cat ${
config.sops.secrets."${pathPrefix}/repos/external-hdd/password".path
}";
removableDevice = true; removableDevice = true;
doInit = true; doInit = true;
repo = "${config.state.paths.laptop-ssd}/Backups"; repo = "${config.state.paths.laptop-ssd}/Backups";
}; };
remote-backup-hetzner-box = borgJobCommonSetting { remote-backup-hetzner-box = borgJobCommonSetting {
patterns = with config.sops; [ patterns = with config.sops;
secrets."${pathPrefix}/patterns/home".path [ secrets."${pathPrefix}/patterns/home".path ];
]; passCommand = "cat ${
passCommand = "cat ${config.sops.secrets."${pathPrefix}/repos/hetzner-box/password".path}"; config.sops.secrets."${pathPrefix}/repos/hetzner-box/password".path
}";
doInit = true; doInit = true;
repo = "ssh://${hetzner-boxes-user}@${hetzner-boxes-server}:23/./borg/desktop/ni"; repo =
"ssh://${hetzner-boxes-user}@${hetzner-boxes-server}:23/./borg/desktop/ni";
startAt = "04:30"; startAt = "04:30";
environment.BORG_RSH = "ssh -i ${config.sops.secrets."${pathPrefix}/repos/hetzner-box/ssh-key".path}"; environment.BORG_RSH = "ssh -i ${
config.sops.secrets."${pathPrefix}/repos/hetzner-box/ssh-key".path
}";
}; };
}; };
}; };

View File

@ -3,8 +3,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.services.dns-server; cfg = hostCfg.services.dns-server;
in in {
{
options.hosts.ni.services.dns-server.enable = options.hosts.ni.services.dns-server.enable =
lib.mkEnableOption "preferred DNS server"; lib.mkEnableOption "preferred DNS server";

View File

@ -11,13 +11,11 @@ let
newgrounds = name: "https://${name}.newgrounds.com"; newgrounds = name: "https://${name}.newgrounds.com";
pathPrefix = "download-media"; pathPrefix = "download-media";
in in {
{
options.hosts.ni.services.download-media.enable = options.hosts.ni.services.download-media.enable =
lib.mkEnableOption "automated multimedia download services"; lib.mkEnableOption "automated multimedia download services";
config = lib.mkIf cfg.enable ( config = lib.mkIf cfg.enable (let
let
ytdlpArgs = [ ytdlpArgs = [
# No overwriting of videos and related files. # No overwriting of videos and related files.
"--no-force-overwrites" "--no-force-overwrites"
@ -30,7 +28,8 @@ in
# Write the subtitle file with the preferred languages. # Write the subtitle file with the preferred languages.
"--write-subs" "--write-subs"
"--sub-langs" "en.*,ja,ko,zh.*,fr,pt.*" "--sub-langs"
"en.*,ja,ko,zh.*,fr,pt.*"
# Write the description in a separate file. # Write the description in a separate file.
"--write-description" "--write-description"
@ -44,12 +43,15 @@ in
"(webm,mkv,mp4)[height<=?1280]" "(webm,mkv,mp4)[height<=?1280]"
# Prefer MKV whenever possible for video formats. # Prefer MKV whenever possible for video formats.
"--merge-output-format" "mkv" "--merge-output-format"
"mkv"
# Don't download any videos that are originally live streams. # Don't download any videos that are originally live streams.
"--match-filters" "!was_live" "--match-filters"
"!was_live"
"--audio-quality" "1" "--audio-quality"
"1"
# Not much error since it will always fail. # Not much error since it will always fail.
"--no-abort-on-error" "--no-abort-on-error"
@ -73,29 +75,37 @@ in
# `services.gallery-dl`, and `services.archivebox`. # `services.gallery-dl`, and `services.archivebox`.
mkJobs = { extraArgs ? [ ], db }: mkJobs = { extraArgs ? [ ], db }:
let let
days = [ "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" ]; days = [
categories = lib.zipListsWith "Monday"
(index: category: { inherit index; data = category; }) "Tuesday"
(lib.lists.range 1 (lib.length (lib.attrValues db))) "Wednesday"
(lib.mapAttrsToList (name: value: { inherit name; inherit (value) subscriptions extraArgs; }) db); "Thursday"
jobsList = builtins.map "Friday"
(category: "Saturday"
let "Sunday"
jobExtraArgs = lib.attrByPath [ "data" "extraArgs" ] [ ] category; ];
in categories = lib.zipListsWith (index: category: {
{ inherit index;
data = category;
}) (lib.lists.range 1 (lib.length (lib.attrValues db)))
(lib.mapAttrsToList (name: value: {
inherit name;
inherit (value) subscriptions extraArgs;
}) db);
jobsList = builtins.map (category:
let jobExtraArgs = lib.attrByPath [ "data" "extraArgs" ] [ ] category;
in {
name = category.data.name; name = category.data.name;
value = { value = {
extraArgs = extraArgs ++ jobExtraArgs; extraArgs = extraArgs ++ jobExtraArgs;
urls = builtins.map (subscription: subscription.url) category.data.subscriptions; urls = builtins.map (subscription: subscription.url)
startAt = lib.elemAt days (lib.mod category.index (lib.length days)); category.data.subscriptions;
startAt =
lib.elemAt days (lib.mod category.index (lib.length days));
}; };
}) }) categories;
categories; in lib.listToAttrs jobsList;
in in {
lib.listToAttrs jobsList;
in
{
suites.filesystem.setups.archive.enable = true; suites.filesystem.setups.archive.enable = true;
services.yt-dlp = { services.yt-dlp = {
@ -106,7 +116,8 @@ in
# possible for this. # possible for this.
extraArgs = ytdlpArgs ++ [ extraArgs = ytdlpArgs ++ [
# Make a global list of successfully downloaded videos as a cache for yt-dlp. # Make a global list of successfully downloaded videos as a cache for yt-dlp.
"--download-archive" "videos" "--download-archive"
"videos"
]; ];
jobs = mkJobs { jobs = mkJobs {
@ -119,10 +130,7 @@ in
enable = true; enable = true;
webserver.enable = true; webserver.enable = true;
jobs = mkJobs jobs = mkJobs { db = lib.importJSON ./data/jobs.archivebox.json; } // {
{
db = lib.importJSON ./data/jobs.archivebox.json;
} // {
computer = { computer = {
urls = [ urls = [
"https://blog.mozilla.org/en/feed/" "https://blog.mozilla.org/en/feed/"
@ -151,9 +159,7 @@ in
"${config.services.gallery-dl.downloadPath}/photos" "${config.services.gallery-dl.downloadPath}/photos"
]; ];
settings.extractor = { settings.extractor = { filename = "{date:%F}-{title}.{extension}"; };
filename = "{date:%F}-{title}.{extension}";
};
jobs = { jobs = {
arts = { arts = {
@ -202,6 +208,5 @@ in
}; };
environment.systemPackages = with pkgs; [ archivebox ]; environment.systemPackages = with pkgs; [ archivebox ];
} });
);
} }

View File

@ -17,8 +17,7 @@ let
newsgroup = "inbox.comp.systemd.devel"; newsgroup = "inbox.comp.systemd.devel";
}; };
}; };
in in {
{
options.hosts.ni.services.mail-archive.enable = options.hosts.ni.services.mail-archive.enable =
lib.mkEnableOption "preferred mail archiving service"; lib.mkEnableOption "preferred mail archiving service";
@ -30,9 +29,7 @@ in
http = { http = {
enable = true; enable = true;
port = "/run/public-inbox-http.sock"; port = "/run/public-inbox-http.sock";
mounts = [ mounts = [ "https://mail.ni.internal/inbox" ];
"https://mail.ni.internal/inbox"
];
}; };
imap.enable = true; imap.enable = true;
nntp.enable = true; nntp.enable = true;
@ -54,7 +51,8 @@ in
services.nginx.virtualHosts."mail.ni.internal" = { services.nginx.virtualHosts."mail.ni.internal" = {
locations."/".return = "302 /inbox"; locations."/".return = "302 /inbox";
locations."= /inbox".return = "302 /inbox/"; locations."= /inbox".return = "302 /inbox/";
locations."/inbox".proxyPass = "http://unix:${config.services.public-inbox.http.port}:/inbox"; locations."/inbox".proxyPass =
"http://unix:${config.services.public-inbox.http.port}:/inbox";
locations."= /style/light.css".alias = pkgs.writeText "light.css" '' locations."= /style/light.css".alias = pkgs.writeText "light.css" ''
* { background:#fff; color:#000 } * { background:#fff; color:#000 }

View File

@ -3,8 +3,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.services.monitoring; cfg = hostCfg.services.monitoring;
in in {
{
options.hosts.ni.services.monitoring.enable = options.hosts.ni.services.monitoring.enable =
lib.mkEnableOption "enable local desktop monitoring service"; lib.mkEnableOption "enable local desktop monitoring service";
@ -13,9 +12,8 @@ in
services.grafana.enable = true; services.grafana.enable = true;
services.grafana.declarativePlugins = with pkgs.grafanaPlugins; [ services.grafana.declarativePlugins = with pkgs.grafanaPlugins;
grafana-piechart-panel [ grafana-piechart-panel ];
];
services.grafana.settings = { services.grafana.settings = {
database.type = "sqlite3"; database.type = "sqlite3";

View File

@ -5,15 +5,12 @@ let
cfg = hostCfg.services.penpot; cfg = hostCfg.services.penpot;
port = builtins.toString config.state.ports.penpot-frontend.value; port = builtins.toString config.state.ports.penpot-frontend.value;
in in {
{
options.hosts.ni.services.penpot.enable = options.hosts.ni.services.penpot.enable =
lib.mkEnableOption "self-hosted Penpot design tool"; lib.mkEnableOption "self-hosted Penpot design tool";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
state.ports = { state.ports = { penpot-frontend.value = 9001; };
penpot-frontend.value = 9001;
};
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml { sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml {
"penpot/env" = { }; "penpot/env" = { };
@ -26,17 +23,10 @@ in
virtualisation.oci-containers.containers.penpot-frontend = { virtualisation.oci-containers.containers.penpot-frontend = {
image = "docker.io/penpotapp/frontend:latest"; image = "docker.io/penpotapp/frontend:latest";
dependsOn = [ dependsOn = [ "penpot-backend" "penpot-exporter" ];
"penpot-backend"
"penpot-exporter"
];
ports = lib.singleton "127.0.0.1:${port}:${port}"; ports = lib.singleton "127.0.0.1:${port}:${port}";
extraOptions = [ extraOptions = [ "--network=penpot" ];
"--network=penpot" volumes = [ "penpot_assets:/opt/data/assets" ];
];
volumes = [
"penpot_assets:/opt/data/assets"
];
environment.PENPOT_FLAGS = lib.concatStringsSep " " [ environment.PENPOT_FLAGS = lib.concatStringsSep " " [
"enable-login-with-password" "enable-login-with-password"
"enable-webhooks" "enable-webhooks"
@ -48,19 +38,10 @@ in
virtualisation.oci-containers.containers.penpot-backend = { virtualisation.oci-containers.containers.penpot-backend = {
image = "docker.io/penpotapp/backend:latest"; image = "docker.io/penpotapp/backend:latest";
volumes = [ volumes = [ "penpot_assets:/opt/data/assets" ];
"penpot_assets:/opt/data/assets" extraOptions = [ "--network=penpot" ];
]; dependsOn = [ "penpot-postgres" "penpot-redis" ];
extraOptions = [ environmentFiles = [ config.sops.secrets."penpot/env".path ];
"--network=penpot"
];
dependsOn = [
"penpot-postgres"
"penpot-redis"
];
environmentFiles = [
config.sops.secrets."penpot/env".path
];
environment = { environment = {
PENPOT_FLAGS = lib.concatStringsSep " " [ PENPOT_FLAGS = lib.concatStringsSep " " [
"enable-registration" "enable-registration"
@ -77,9 +58,7 @@ in
virtualisation.oci-containers.containers.penpot-exporter = { virtualisation.oci-containers.containers.penpot-exporter = {
image = "docker.io/penpotapp/exporter:latest"; image = "docker.io/penpotapp/exporter:latest";
extraOptions = [ extraOptions = [ "--network=penpot" ];
"--network=penpot"
];
environment = { environment = {
PENPOT_PUBLIC_URI = "http://penpot-frontend"; PENPOT_PUBLIC_URI = "http://penpot-frontend";
PENPOT_REDIS_URI = "redis://penpot-redis/0"; PENPOT_REDIS_URI = "redis://penpot-redis/0";
@ -88,24 +67,16 @@ in
virtualisation.oci-containers.containers.penpot-redis = { virtualisation.oci-containers.containers.penpot-redis = {
image = "docker.io/redis:7"; image = "docker.io/redis:7";
extraOptions = [ extraOptions = [ "--network=penpot" ];
"--network=penpot"
];
}; };
virtualisation.oci-containers.containers.penpot-postgres = { virtualisation.oci-containers.containers.penpot-postgres = {
image = "docker.io/postgres:15"; image = "docker.io/postgres:15";
volumes = [ volumes = [ "penpot_postgres_v15:/var/lib/postgresql/data" ];
"penpot_postgres_v15:/var/lib/postgresql/data"
];
extraOptions = [ "--network=penpot" ]; extraOptions = [ "--network=penpot" ];
environmentFiles = [ environmentFiles = [ config.sops.secrets."penpot/postgres_env".path ];
config.sops.secrets."penpot/postgres_env".path
];
environment = { environment = {
POSTGRES_INITDB_ARGS = lib.concatStringsSep " " [ POSTGRES_INITDB_ARGS = lib.concatStringsSep " " [ "--data-checksums" ];
"--data-checksums"
];
POSTGRES_DB = "penpot"; POSTGRES_DB = "penpot";
}; };
}; };

View File

@ -4,8 +4,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.services.reverse-proxy; cfg = hostCfg.services.reverse-proxy;
in in {
{
options.hosts.ni.services.reverse-proxy.enable = options.hosts.ni.services.reverse-proxy.enable =
lib.mkEnableOption "private-use reverse proxy setup"; lib.mkEnableOption "private-use reverse proxy setup";

View File

@ -5,8 +5,7 @@ let
cfg = hostCfg.services.rss-reader; cfg = hostCfg.services.rss-reader;
port = config.state.ports.miniflux.value; port = config.state.ports.miniflux.value;
in in {
{
options.hosts.ni.services.rss-reader.enable = options.hosts.ni.services.rss-reader.enable =
lib.mkEnableOption "preferred RSS reader service"; lib.mkEnableOption "preferred RSS reader service";
@ -35,7 +34,8 @@ in
wrapper-manager.packages.miniflux-helper = { wrapper-manager.packages.miniflux-helper = {
wrappers.miniflux-helper = { wrappers.miniflux-helper = {
arg0 = lib.getExe' config.services.miniflux.package "miniflux"; arg0 = lib.getExe' config.services.miniflux.package "miniflux";
env = lib.mapAttrs (_: value: { value = builtins.toString value; }) config.services.miniflux.config; env = lib.mapAttrs (_: value: { value = builtins.toString value; })
config.services.miniflux.config;
}; };
}; };
}; };

View File

@ -5,9 +5,9 @@ let
cfg = hostCfg.setups.desktop; cfg = hostCfg.setups.desktop;
hasAnyWorkflowEnabled = workflows: hasAnyWorkflowEnabled = workflows:
lib.lists.any (workflow: lib.elem workflow config.workflows.enable) workflows; lib.lists.any (workflow: lib.elem workflow config.workflows.enable)
in workflows;
{ in {
options.hosts.ni.setups.desktop.enable = options.hosts.ni.setups.desktop.enable =
lib.mkEnableOption "desktop environment setup"; lib.mkEnableOption "desktop environment setup";

View File

@ -3,8 +3,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.setups.development; cfg = hostCfg.setups.development;
in in {
{
options.hosts.ni.setups.development.enable = options.hosts.ni.setups.development.enable =
lib.mkEnableOption "software development setup"; lib.mkEnableOption "software development setup";
@ -33,8 +32,7 @@ in
logDriver = "journald"; logDriver = "journald";
}; };
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs; [
[
# For debugging build environments in Nix packages. # For debugging build environments in Nix packages.
cntr cntr
@ -60,10 +58,7 @@ in
}; };
# Adding a bunch of emulated systems for cross-system building. # Adding a bunch of emulated systems for cross-system building.
boot.binfmt.emulatedSystems = [ boot.binfmt.emulatedSystems = [ "aarch64-linux" "riscv64-linux" ];
"aarch64-linux"
"riscv64-linux"
];
} }
(lib.mkIf config.suites.dev.containers.enable { (lib.mkIf config.suites.dev.containers.enable {
@ -72,9 +67,7 @@ in
services.cockpit = { services.cockpit = {
enable = true; enable = true;
port = config.state.ports.cockpit.value; port = config.state.ports.cockpit.value;
settings = { settings = { WebService.AllowUnencrypted = true; };
WebService.AllowUnencrypted = true;
};
}; };
# Setting up a single-node k3s cluster for learning purposes. # Setting up a single-node k3s cluster for learning purposes.

View File

@ -3,10 +3,8 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.setups.gaming; cfg = hostCfg.setups.gaming;
in in {
{ options.hosts.ni.setups.gaming.enable = lib.mkEnableOption "gaming setup";
options.hosts.ni.setups.gaming.enable =
lib.mkEnableOption "gaming setup";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Bring all of the goodies. # Bring all of the goodies.
@ -16,12 +14,7 @@ in
retro-computing.enable = true; retro-computing.enable = true;
}; };
programs.retroarch.cores = with pkgs.libretro; [ programs.retroarch.cores = with pkgs.libretro; [ pcsx2 dolphin citra mame ];
pcsx2
dolphin
citra
mame
];
# Bring more of them games. # Bring more of them games.
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@ -3,8 +3,7 @@
let let
hostCfg = config.hosts.ni; hostCfg = config.hosts.ni;
cfg = hostCfg.setups.music; cfg = hostCfg.setups.music;
in in {
{
options.hosts.ni.setups.music.enable = options.hosts.ni.setups.music.enable =
lib.mkEnableOption "music streaming and organizing setup"; lib.mkEnableOption "music streaming and organizing setup";
@ -29,7 +28,8 @@ in
}; };
uxplay = { uxplay = {
value = 10001; value = 10001;
openFirewall = true; }; openFirewall = true;
};
uxplayClients = { uxplayClients = {
value = foodogsquaredLib.nixos.makeRange' uxplay.value 10; value = foodogsquaredLib.nixos.makeRange' uxplay.value 10;
openFirewall = true; openFirewall = true;
@ -40,12 +40,10 @@ in
services.gonic = { services.gonic = {
enable = true; enable = true;
settings = rec { settings = rec {
listen-addr = "localhost:${builtins.toString config.state.ports.gonic.value}"; listen-addr =
"localhost:${builtins.toString config.state.ports.gonic.value}";
cache-path = "${config.state.paths.cacheDir}/gonic"; cache-path = "${config.state.paths.cacheDir}/gonic";
music-path = music-path = [ "/srv/Music" ];
[
"/srv/Music"
];
podcast-path = "${cache-path}/podcasts"; podcast-path = "${cache-path}/podcasts";
playlists-path = "${cache-path}/playlists"; playlists-path = "${cache-path}/playlists";
@ -102,9 +100,7 @@ in
airplay = { airplay = {
type = "airplay"; type = "airplay";
location = lib.getExe' pkgs.shairport-sync "shairport-sync"; location = lib.getExe' pkgs.shairport-sync "shairport-sync";
query = { query = { devicename = "Snapcast"; };
devicename = "Snapcast";
};
}; };
spotify = { spotify = {

View File

@ -39,7 +39,8 @@
}; };
# Overriding the kernel version for ourselves. # Overriding the kernel version for ourselves.
boot.kernelPackages = lib.mkOverride 500 pkgs.linuxKernel.packages.linux_6_11_hardened; boot.kernelPackages =
lib.mkOverride 500 pkgs.linuxKernel.packages.linux_6_11_hardened;
# We're using our own VPN configuration for this one. # We're using our own VPN configuration for this one.
suites.vpn.personal.enable = true; suites.vpn.personal.enable = true;

View File

@ -1,10 +1,8 @@
# It just contains a set of network-related variables mainly used for # It just contains a set of network-related variables mainly used for
# network-related services. Make sure to change this every time you migrate to # network-related services. Make sure to change this every time you migrate to
# a new server. # a new server.
let let inherit (builtins) toString;
inherit (builtins) toString; in rec {
in
rec {
# This is expected to be /48 block (i.e., `fc00:b0de:5685::/48`). # This is expected to be /48 block (i.e., `fc00:b0de:5685::/48`).
# The thing is generated using a ULA generator. # The thing is generated using a ULA generator.
privateIPv6Prefix = "fd89:c181:8016"; privateIPv6Prefix = "fd89:c181:8016";

View File

@ -1,9 +1,7 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
imports = [ imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
(modulesPath + "/profiles/qemu-guest.nix")
];
# Hetzner can only support non-UEFI bootloader (or at least it doesn't with # Hetzner can only support non-UEFI bootloader (or at least it doesn't with
# systemd-boot). # systemd-boot).
@ -13,12 +11,14 @@
efiInstallAsRemovable = true; efiInstallAsRemovable = true;
}; };
boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules =
[ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ "nvme" ]; boot.initrd.kernelModules = [ "nvme" ];
zramSwap.enable = true; zramSwap.enable = true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
systemd.services.qemu-guest-agent.path = [ pkgs.shadow ]; systemd.services.qemu-guest-agent.path = [ pkgs.shadow ];

View File

@ -11,8 +11,7 @@ let
atuinInternalDomain = "atuin.${config.networking.fqdn}"; atuinInternalDomain = "atuin.${config.networking.fqdn}";
host = interfaces.lan.IPv4.address; host = interfaces.lan.IPv4.address;
in in {
{
options.hosts.plover.services.atuin.enable = options.hosts.plover.services.atuin.enable =
lib.mkEnableOption "Atuin sync server setup"; lib.mkEnableOption "Atuin sync server setup";

View File

@ -7,9 +7,11 @@ let
# The head of the Borgbase hostname. # The head of the Borgbase hostname.
hetzner-boxes-user = "u332477"; hetzner-boxes-user = "u332477";
hetzner-boxes-server = "${hetzner-boxes-user}.your-storagebox.de"; hetzner-boxes-server = "${hetzner-boxes-user}.your-storagebox.de";
borgRepo = path: "ssh://${hetzner-boxes-user}@${hetzner-boxes-server}:23/./borg/plover/${path}"; borgRepo = path:
"ssh://${hetzner-boxes-user}@${hetzner-boxes-server}:23/./borg/plover/${path}";
jobCommonSettings = { patternFiles ? [ ], patterns ? [ ], paths ? [ ], repo, passCommand }: { jobCommonSettings =
{ patternFiles ? [ ], patterns ? [ ], paths ? [ ], repo, passCommand }: {
inherit paths repo; inherit paths repo;
compression = "zstd,11"; compression = "zstd,11";
dateFormat = "+%F-%H-%M-%S-%z"; dateFormat = "+%F-%H-%M-%S-%z";
@ -18,18 +20,15 @@ let
inherit passCommand; inherit passCommand;
mode = "repokey-blake2"; mode = "repokey-blake2";
}; };
extraCreateArgs = extraCreateArgs = let
let
args = lib.flatten [ args = lib.flatten [
(builtins.map (builtins.map
(patternFile: "--patterns-from ${lib.escapeShellArg patternFile}") (patternFile: "--patterns-from ${lib.escapeShellArg patternFile}")
patternFiles) patternFiles)
(builtins.map (builtins.map (pattern: "--pattern ${lib.escapeShellArg pattern}")
(pattern: "--pattern ${lib.escapeShellArg pattern}")
patterns) patterns)
]; ];
in in lib.concatStringsSep " " args;
lib.concatStringsSep " " args;
extraInitArgs = "--make-parent-dirs"; extraInitArgs = "--make-parent-dirs";
persistentTimer = true; persistentTimer = true;
preHook = '' preHook = ''
@ -43,27 +42,29 @@ let
startAt = "monthly"; startAt = "monthly";
environment.BORG_RSH = "ssh -i ${config.sops.secrets."ssh-key".path}"; environment.BORG_RSH = "ssh -i ${config.sops.secrets."ssh-key".path}";
}; };
in in {
{
options.hosts.plover.services.backup.enable = options.hosts.plover.services.backup.enable =
lib.mkEnableOption "backup service"; lib.mkEnableOption "backup service";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ../../secrets/secrets.yaml { sops.secrets =
foodogsquaredLib.sops-nix.getSecrets ../../secrets/secrets.yaml {
"borg/repos/services/password" = { }; "borg/repos/services/password" = { };
}; };
services.borgbackup.jobs = { services.borgbackup.jobs = {
# Backups for various services. # Backups for various services.
services-backup = jobCommonSettings services-backup = jobCommonSettings {
{
paths = [ paths = [
# ACME accounts and TLS certificates # ACME accounts and TLS certificates
"/var/lib/acme" "/var/lib/acme"
]; ];
repo = borgRepo "services"; repo = borgRepo "services";
passCommand = "cat ${config.sops.secrets."borg/repos/services/password".path}"; passCommand =
} // { startAt = "daily"; }; "cat ${config.sops.secrets."borg/repos/services/password".path}";
} // {
startAt = "daily";
};
}; };
programs.ssh.extraConfig = '' programs.ssh.extraConfig = ''

View File

@ -3,8 +3,7 @@
let let
hostCfg = config.hosts.plover; hostCfg = config.hosts.plover;
cfg = hostCfg.services.crowdsec; cfg = hostCfg.services.crowdsec;
in in {
{
options.hosts.plover.services.crowdsec.enable = options.hosts.plover.services.crowdsec.enable =
lib.mkEnableOption "Crowdsec service"; lib.mkEnableOption "Crowdsec service";

View File

@ -7,8 +7,7 @@ let
cfg = hostCfg.services.database; cfg = hostCfg.services.database;
postgresqlDomain = "postgres.${config.networking.domain}"; postgresqlDomain = "postgres.${config.networking.domain}";
in in {
{
options.hosts.plover.services.database.enable = options.hosts.plover.services.database.enable =
lib.mkEnableOption "preferred service SQL database"; lib.mkEnableOption "preferred service SQL database";
@ -22,10 +21,8 @@ in
enableTCPIP = true; enableTCPIP = true;
settings = settings =
let let credsDir = path: "/run/credentials/postgresql.service/${path}";
credsDir = path: "/run/credentials/postgresql.service/${path}"; in {
in
{
port = config.state.ports.postgresql.value; port = config.state.ports.postgresql.value;
# Still doing the secure schema usage pattern. # Still doing the secure schema usage pattern.
@ -50,12 +47,11 @@ in
# Setting this up for TLS. # Setting this up for TLS.
systemd.services.postgresql = { systemd.services.postgresql = {
requires = [ "acme-finished-${postgresqlDomain}.target" ]; requires = [ "acme-finished-${postgresqlDomain}.target" ];
serviceConfig.LoadCredential = serviceConfig.LoadCredential = let
let certDirectory =
certDirectory = config.security.acme.certs."${postgresqlDomain}".directory; config.security.acme.certs."${postgresqlDomain}".directory;
certCredentialPath = path: "${path}:${certDirectory}/${path}"; certCredentialPath = path: "${path}:${certDirectory}/${path}";
in in [
[
(certCredentialPath "cert.pem") (certCredentialPath "cert.pem")
(certCredentialPath "key.pem") (certCredentialPath "key.pem")
(certCredentialPath "fullchain.pem") (certCredentialPath "fullchain.pem")
@ -69,7 +65,8 @@ in
(lib.mkIf hostCfg.services.backup.enable { (lib.mkIf hostCfg.services.backup.enable {
# Add the dumps to be backed up. # Add the dumps to be backed up.
services.borgbackup.jobs.services-backup.paths = [ config.services.postgresqlBackup.location ]; services.borgbackup.jobs.services-backup.paths =
[ config.services.postgresqlBackup.location ];
}) })
]); ]);
} }

View File

@ -26,8 +26,7 @@ let
}; };
dnsSubdomain = "ns1.${domain}"; dnsSubdomain = "ns1.${domain}";
in in {
{
options.hosts.plover.services.dns-server.enable = options.hosts.plover.services.dns-server.enable =
lib.mkEnableOption "preferred DNS server"; lib.mkEnableOption "preferred DNS server";
@ -39,15 +38,13 @@ in
dnsOverTLS.value = 853; dnsOverTLS.value = 853;
}; };
sops.secrets = sops.secrets = let
let
dnsFileAttribute = { dnsFileAttribute = {
owner = config.users.users.named.name; owner = config.users.users.named.name;
group = config.users.users.named.group; group = config.users.users.named.group;
mode = "0400"; mode = "0400";
}; };
in in foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml {
foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml {
"dns/${domain}/rfc2136-key" = dnsFileAttribute // { "dns/${domain}/rfc2136-key" = dnsFileAttribute // {
reloadUnits = [ "bind.service" ]; reloadUnits = [ "bind.service" ];
}; };
@ -60,34 +57,23 @@ in
enable = true; enable = true;
forward = "first"; forward = "first";
cacheNetworks = [ cacheNetworks = [ "127.0.0.1" "::1" ];
"127.0.0.1"
"::1"
];
listenOn = [ listenOn = [ "127.0.0.1" wan.ipv4 lan.ipv4 ];
"127.0.0.1"
wan.ipv4
lan.ipv4
];
listenOnIpv6 = [ listenOnIpv6 = [ "::1" wan.ipv6 lan.ipv6 ];
"::1"
wan.ipv6
lan.ipv6
];
# Welp, since the template is pretty limited, we'll have to go with our # Welp, since the template is pretty limited, we'll have to go with our
# own. This is partially based from the NixOS Bind module except without # own. This is partially based from the NixOS Bind module except without
# the template for filling in zones since we use views. # the template for filling in zones since we use views.
configFile = configFile = let
let
cfg = config.services.bind; cfg = config.services.bind;
certDir = path: "/run/credentials/bind.service/${path}"; certDir = path: "/run/credentials/bind.service/${path}";
listenInterfaces = lib.concatMapStrings (entry: " ${entry}; ") cfg.listenOn; listenInterfaces =
listenInterfacesIpv6 = lib.concatMapStrings (entry: " ${entry}; ") cfg.listenOnIpv6; lib.concatMapStrings (entry: " ${entry}; ") cfg.listenOn;
in listenInterfacesIpv6 =
pkgs.writeText "named.conf" '' lib.concatMapStrings (entry: " ${entry}; ") cfg.listenOnIpv6;
in pkgs.writeText "named.conf" ''
include "/etc/bind/rndc.key"; include "/etc/bind/rndc.key";
include "${config.sops.secrets."dns/${domain}/rfc2136-key".path}"; include "${config.sops.secrets."dns/${domain}/rfc2136-key".path}";
@ -108,9 +94,15 @@ in
endpoints { "/dns-query"; }; endpoints { "/dns-query"; };
}; };
acl trusted { ${lib.concatStringsSep "; " [ "10.0.0.0/8" ]}; localhost; }; acl trusted { ${
acl cachenetworks { ${lib.concatMapStrings (entry: " ${entry}; ") cfg.cacheNetworks} }; lib.concatStringsSep "; " [ "10.0.0.0/8" ]
acl badnetworks { ${lib.concatMapStrings (entry: " ${entry}; ") cfg.blockedNetworks} }; }; localhost; };
acl cachenetworks { ${
lib.concatMapStrings (entry: " ${entry}; ") cfg.cacheNetworks
} };
acl badnetworks { ${
lib.concatMapStrings (entry: " ${entry}; ") cfg.blockedNetworks
} };
options { options {
# Native DNS. # Native DNS.
@ -123,14 +115,18 @@ in
# DNS-over-HTTPS. # DNS-over-HTTPS.
tls-port ${builtins.toString config.state.ports.dnsOverTLS.value}; tls-port ${builtins.toString config.state.ports.dnsOverTLS.value};
https-port ${builtins.toString config.state.ports.dnsOverHTTPS.value}; https-port ${
builtins.toString config.state.ports.dnsOverHTTPS.value
};
listen-on tls ${dnsSubdomain} http ${dnsSubdomain} { ${listenInterfaces} }; listen-on tls ${dnsSubdomain} http ${dnsSubdomain} { ${listenInterfaces} };
listen-on-v6 tls ${dnsSubdomain} http ${dnsSubdomain} { ${listenInterfacesIpv6} }; listen-on-v6 tls ${dnsSubdomain} http ${dnsSubdomain} { ${listenInterfacesIpv6} };
allow-query { cachenetworks; }; allow-query { cachenetworks; };
blackhole { badnetworks; }; blackhole { badnetworks; };
forward ${cfg.forward}; forward ${cfg.forward};
forwarders { ${lib.concatMapStrings (entry: " ${entry}; ") cfg.forwarders} }; forwarders { ${
lib.concatMapStrings (entry: " ${entry}; ") cfg.forwarders
} };
directory "${cfg.directory}"; directory "${cfg.directory}";
pid-file "/run/named/named.pid"; pid-file "/run/named/named.pid";
}; };
@ -153,7 +149,10 @@ in
type primary; type primary;
file "${getZoneFile domain}"; file "${getZoneFile domain}";
allow-transfer { ${lib.concatStringsSep "; " config.state.network.secondaryNameservers}; }; allow-transfer { ${
lib.concatStringsSep "; "
config.state.network.secondaryNameservers
}; };
update-policy { update-policy {
grant rfc2136key.${domain}. zonesub TXT; grant rfc2136key.${domain}. zonesub TXT;
}; };
@ -179,17 +178,19 @@ in
systemd.services.bind = { systemd.services.bind = {
path = with pkgs; [ replace-secret ]; path = with pkgs; [ replace-secret ];
preStart = preStart = let
let
domainZone' = getZoneFile domain; domainZone' = getZoneFile domain;
fqdnZone' = getZoneFile fqdn; fqdnZone' = getZoneFile fqdn;
in in lib.mkAfter ''
lib.mkAfter ''
# Install the domain zone. # Install the domain zone.
[ -f ${lib.escapeShellArg domainZone'} ] || install -Dm0600 ${zonefile} ${lib.escapeShellArg domainZone'} [ -f ${
lib.escapeShellArg domainZone'
} ] || install -Dm0600 ${zonefile} ${lib.escapeShellArg domainZone'}
# Install the internal DNS zones. # Install the internal DNS zones.
[ -f ${lib.escapeShellArg fqdnZone'} ] || install -Dm0600 '${fqdnZone}' ${lib.escapeShellArg fqdnZone'} [ -f ${
lib.escapeShellArg fqdnZone'
} ] || install -Dm0600 '${fqdnZone}' ${lib.escapeShellArg fqdnZone'}
''; '';
serviceConfig = { serviceConfig = {
@ -200,12 +201,11 @@ in
UMask = "0037"; UMask = "0037";
# Get the credentials into the service. # Get the credentials into the service.
LoadCredential = LoadCredential = let
let certDirectory =
certDirectory = config.security.acme.certs."${dnsSubdomain}".directory; config.security.acme.certs."${dnsSubdomain}".directory;
certCredentialPath = path: "${path}:${certDirectory}/${path}"; certCredentialPath = path: "${path}:${certDirectory}/${path}";
in in [
[
(certCredentialPath "cert.pem") (certCredentialPath "cert.pem")
(certCredentialPath "key.pem") (certCredentialPath "key.pem")
(certCredentialPath "fullchain.pem") (certCredentialPath "fullchain.pem")
@ -232,10 +232,7 @@ in
# Make the filesystem invisible to the service. # Make the filesystem invisible to the service.
ProtectSystem = "strict"; ProtectSystem = "strict";
ReadWritePaths = [ ReadWritePaths = [ config.services.bind.directory "/etc/bind" ];
config.services.bind.directory
"/etc/bind"
];
ReadOnlyPaths = [ ReadOnlyPaths = [
config.security.dhparams.params.bind.path config.security.dhparams.params.bind.path
config.security.acme.certs."${dnsSubdomain}".directory config.security.acme.certs."${dnsSubdomain}".directory
@ -262,13 +259,8 @@ in
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ]; AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
# Restrict what address families can it access. # Restrict what address families can it access.
RestrictAddressFamilies = [ RestrictAddressFamilies =
"AF_LOCAL" [ "AF_LOCAL" "AF_NETLINK" "AF_BRIDGE" "AF_INET" "AF_INET6" ];
"AF_NETLINK"
"AF_BRIDGE"
"AF_INET"
"AF_INET6"
];
# Restricting what namespaces it can create. # Restricting what namespaces it can create.
RestrictNamespaces = true; RestrictNamespaces = true;
@ -284,14 +276,18 @@ in
services.bind.extraConfig = '' services.bind.extraConfig = ''
statistics-channels { statistics-channels {
inet 127.0.0.1 port ${builtins.toString config.state.ports.bindStatistics.value} allow { 127.0.0.1; }; inet 127.0.0.1 port ${
builtins.toString config.state.ports.bindStatistics.value
} allow { 127.0.0.1; };
}; };
''; '';
services.prometheus.exporters = { services.prometheus.exporters = {
bind = { bind = {
enable = true; enable = true;
bindURI = "http://127.0.0.1/${builtins.toString config.state.ports.bindStatistics.value}"; bindURI = "http://127.0.0.1/${
builtins.toString config.state.ports.bindStatistics.value
}";
}; };
}; };
}) })
@ -303,7 +299,9 @@ in
zone dns 64k; zone dns 64k;
''; '';
servers = { servers = {
"127.0.0.1:${builtins.toString config.state.ports.dnsOverHTTPS.value}" = { }; "127.0.0.1:${
builtins.toString config.state.ports.dnsOverHTTPS.value
}" = { };
}; };
}; };

View File

@ -5,8 +5,7 @@ let
cfg = hostCfg.services.fail2ban; cfg = hostCfg.services.fail2ban;
inherit (import ../hardware/networks.nix) interfaces; inherit (import ../hardware/networks.nix) interfaces;
in in {
{
options.hosts.plover.services.fail2ban.enable = options.hosts.plover.services.fail2ban.enable =
lib.mkEnableOption "fail2ban monitoring"; lib.mkEnableOption "fail2ban monitoring";

View File

@ -3,9 +3,9 @@
let let
hostCfg = config.hosts.plover; hostCfg = config.hosts.plover;
cfg = hostCfg.services.firewall; cfg = hostCfg.services.firewall;
in in {
{ options.hosts.plover.services.firewall.enable =
options.hosts.plover.services.firewall.enable = lib.mkEnableOption "firewall setup"; lib.mkEnableOption "firewall setup";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking = { networking = {

View File

@ -10,9 +10,9 @@ let
certsDir = config.security.acme.certs."${authDomain}".directory; certsDir = config.security.acme.certs."${authDomain}".directory;
backupsDir = "${config.state.paths.dataDir}/kanidm/backups"; backupsDir = "${config.state.paths.dataDir}/kanidm/backups";
in in {
{ options.hosts.plover.services.idm.enable =
options.hosts.plover.services.idm.enable = lib.mkEnableOption "preferred IDM server"; lib.mkEnableOption "preferred IDM server";
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
@ -61,7 +61,10 @@ in
# Integrating kanidm-unixd. # Integrating kanidm-unixd.
UsePAM = true; UsePAM = true;
PubkeyAuthentication = true; PubkeyAuthentication = true;
AuthorizedKeysCommand = "${lib.getExe' config.services.kanidm.package "kanidm_ssh_authorizedkeys"} %u"; AuthorizedKeysCommand = "${
lib.getExe' config.services.kanidm.package
"kanidm_ssh_authorizedkeys"
} %u";
AuthorizedKeysCommandUser = "nobody"; AuthorizedKeysCommandUser = "nobody";
}; };
@ -73,7 +76,8 @@ in
mkdir -p "${backupsDir}" mkdir -p "${backupsDir}"
''; '';
serviceConfig = { serviceConfig = {
SupplementaryGroups = [ config.security.acme.certs."${authDomain}".group ]; SupplementaryGroups =
[ config.security.acme.certs."${authDomain}".group ];
}; };
}; };
} }
@ -91,9 +95,7 @@ in
extraConfig = '' extraConfig = ''
zone services; zone services;
''; '';
servers = { servers = { "localhost:${builtins.toString port}" = { }; };
"localhost:${builtins.toString port}" = { };
};
}; };
}) })

View File

@ -5,13 +5,11 @@ let
cfg = hostCfg.services.monitoring; cfg = hostCfg.services.monitoring;
prometheusExports = config.services.prometheus.exporters; prometheusExports = config.services.prometheus.exporters;
in in {
{
options.hosts.plover.services.monitoring.enable = options.hosts.plover.services.monitoring.enable =
lib.mkEnableOption "preferred monitoring stack"; lib.mkEnableOption "preferred monitoring stack";
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [{
{
services.prometheus = { services.prometheus = {
enable = true; enable = true;
@ -22,15 +20,13 @@ in
}; };
}; };
scrapeConfigs = [ scrapeConfigs = [{
{
job_name = config.networking.hostName; job_name = config.networking.hostName;
static_configs = [{ static_configs = [{
targets = [ "127.0.0.1:${builtins.toString prometheusExports.node.port}" ]; targets =
[ "127.0.0.1:${builtins.toString prometheusExports.node.port}" ];
}];
}]; }];
}
];
}; };
} }]);
]);
} }

View File

@ -8,8 +8,7 @@ let
mainEthernetInterfaceNames = [ "eth0" "enp1s0" ]; mainEthernetInterfaceNames = [ "eth0" "enp1s0" ];
internalEthernetInterfaceNames = [ "enp7s0" ]; internalEthernetInterfaceNames = [ "enp7s0" ];
inherit (config.state.network) interfaces; inherit (config.state.network) interfaces;
in in {
{
options.hosts.plover.services.networking = { options.hosts.plover.services.networking = {
enable = lib.mkEnableOption "preferred networking setup"; enable = lib.mkEnableOption "preferred networking setup";
@ -67,8 +66,7 @@ in
# For more information, you can look at Hetzner documentation from # For more information, you can look at Hetzner documentation from
# https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/ # https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/
networks = { networks = {
"10-wan" = let "10-wan" = let inherit (interfaces) wan;
inherit (interfaces) wan;
in { in {
matchConfig = { matchConfig = {
Name = lib.concatStringsSep " " mainEthernetInterfaceNames; Name = lib.concatStringsSep " " mainEthernetInterfaceNames;
@ -87,10 +85,7 @@ in
}; };
address = [ "${wan.ipv6}/64" ]; address = [ "${wan.ipv6}/64" ];
dns = [ dns = [ "2a01:4ff:ff00::add:2" "2a01:4ff:ff00::add:1" ];
"2a01:4ff:ff00::add:2"
"2a01:4ff:ff00::add:1"
];
routes = [ routes = [
{ {
@ -102,8 +97,7 @@ in
Gateway = wan.ipv6Gateway; Gateway = wan.ipv6Gateway;
GatewayOnLink = true; GatewayOnLink = true;
} }
] ] ++ lib.optionals cfg.restrictLocalOnWAN [
++ lib.optionals cfg.restrictLocalOnWAN [
{ {
Destination = "176.16.0.0/12"; Destination = "176.16.0.0/12";
Type = "unreachable"; Type = "unreachable";

View File

@ -13,8 +13,7 @@ let
src = ../../config/wezterm/config.lua; src = ../../config/wezterm/config.lua;
listen_address = listenAddress; listen_address = listenAddress;
}; };
in in {
{
options.hosts.plover.services.wezterm-mux-server.enable = options.hosts.plover.services.wezterm-mux-server.enable =
lib.mkEnableOption "Wezterm mux server setup"; lib.mkEnableOption "Wezterm mux server setup";
@ -29,12 +28,10 @@ in
requires = [ "acme-finished-${weztermDomain}.target" ]; requires = [ "acme-finished-${weztermDomain}.target" ];
environment.WEZTERM_LOG = "info"; environment.WEZTERM_LOG = "info";
serviceConfig = { serviceConfig = {
LoadCredential = LoadCredential = let
let
certDir = config.security.acme.certs."${weztermDomain}".directory; certDir = config.security.acme.certs."${weztermDomain}".directory;
credentialCertPath = path: "${path}:${certDir}/${path}"; credentialCertPath = path: "${path}:${certDir}/${path}";
in in [
[
(credentialCertPath "key.pem") (credentialCertPath "key.pem")
(credentialCertPath "cert.pem") (credentialCertPath "cert.pem")
(credentialCertPath "fullchain.pem") (credentialCertPath "fullchain.pem")

View File

@ -1,4 +1,4 @@
variable zone_id { variable "zone_id" {
description = "Hetzner DNS zone ID to be configured with." description = "Hetzner DNS zone ID to be configured with."
} }
@ -16,7 +16,7 @@ resource "hetznerdns_record" "plover_ipv6" {
value = hcloud_server.plover.ipv6_address value = hcloud_server.plover.ipv6_address
} }
variable services { variable "services" {
type = list(string) type = list(string)
default = ["auth", "pass", "code"] default = ["auth", "pass", "code"]
} }

View File

@ -5,11 +5,7 @@
"${modulesPath}/profiles/minimal.nix" "${modulesPath}/profiles/minimal.nix"
(foodogsquaredLib.mapHomeManagerUser "winnow" { (foodogsquaredLib.mapHomeManagerUser "winnow" {
extraGroups = [ extraGroups = [ "wheel" "docker" "podman" ];
"wheel"
"docker"
"podman"
];
hashedPassword = hashedPassword =
"$y$j9T$UFzEKZZZrmbJ05CTY8QAW0$X2RD4m.xswyJlXZC6AlmmuubPaWPQZg/Q1LDgHpXHx1"; "$y$j9T$UFzEKZZZrmbJ05CTY8QAW0$X2RD4m.xswyJlXZC6AlmmuubPaWPQZg/Q1LDgHpXHx1";
isNormalUser = true; isNormalUser = true;

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.completion; cfg = nixvimCfg.setups.completion;
in in {
{
options.nixvimConfigs.fiesta.setups.completion.enable = options.nixvimConfigs.fiesta.setups.completion.enable =
lib.mkEnableOption "debugging setup for Fiesta NixVim"; lib.mkEnableOption "debugging setup for Fiesta NixVim";
@ -26,11 +25,8 @@ in
"<S-Tab>" = "cmp.mapping.select_prev_item()"; "<S-Tab>" = "cmp.mapping.select_prev_item()";
}; };
settings.sources = [ settings.sources =
{ name = "nvim_lsp"; } [ { name = "nvim_lsp"; } { name = "path"; } { name = "buffer"; } ];
{ name = "path"; }
{ name = "buffer"; }
];
}; };
# All of the typical completion sources I would need. # All of the typical completion sources I would need.

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.debugging; cfg = nixvimCfg.setups.debugging;
in in {
{
options.nixvimConfigs.fiesta.setups.debugging.enable = options.nixvimConfigs.fiesta.setups.debugging.enable =
lib.mkEnableOption "debugging setup for Fiesta NixVim"; lib.mkEnableOption "debugging setup for Fiesta NixVim";
@ -20,17 +19,14 @@ in
}; };
}; };
keymaps = keymaps = let
let
bindingPrefix = "<Leader>d"; bindingPrefix = "<Leader>d";
mkDAPBinding = binding: settings: mkDAPBinding = binding: settings:
{ {
mode = "n"; mode = "n";
key = "${bindingPrefix}${binding}"; key = "${bindingPrefix}${binding}";
} // settings; } // settings;
in in lib.mapAttrsToList mkDAPBinding {
lib.mapAttrsToList mkDAPBinding
{
"b" = { "b" = {
options.desc = "Toggle breakpoint"; options.desc = "Toggle breakpoint";
action = helpers.mkRaw "require('dap').toggle_breakpoint"; action = helpers.mkRaw "require('dap').toggle_breakpoint";
@ -118,8 +114,7 @@ in
action = helpers.mkRaw "require('dap.ui.widgets').preview"; action = helpers.mkRaw "require('dap.ui.widgets').preview";
mode = [ "n" "v" ]; mode = [ "n" "v" ];
}; };
} } ++ lib.mapAttrsToList mkDAPBinding {
++ lib.mapAttrsToList mkDAPBinding {
"<F5>" = { "<F5>" = {
options.desc = "Continue"; options.desc = "Continue";
action = helpers.mkRaw "require('dap').continue"; action = helpers.mkRaw "require('dap').continue";

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.desktop-utils; cfg = nixvimCfg.setups.desktop-utils;
in in {
{
options.nixvimConfigs.fiesta.setups.desktop-utils.enable = options.nixvimConfigs.fiesta.setups.desktop-utils.enable =
lib.mkEnableOption "desktop utilities to be used for this Neovim setup"; lib.mkEnableOption "desktop utilities to be used for this Neovim setup";

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.devenvs; cfg = nixvimCfg.setups.devenvs;
in in {
{
options.nixvimConfigs.fiesta.setups.devenvs.enable = options.nixvimConfigs.fiesta.setups.devenvs.enable =
lib.mkEnableOption "integration for typical devenvs"; lib.mkEnableOption "integration for typical devenvs";

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.fuzzy-finder; cfg = nixvimCfg.setups.fuzzy-finder;
in in {
{
options.nixvimConfigs.fiesta.setups.fuzzy-finder.enable = options.nixvimConfigs.fiesta.setups.fuzzy-finder.enable =
lib.mkEnableOption "fuzzy finder setup"; lib.mkEnableOption "fuzzy finder setup";
@ -17,18 +16,14 @@ in
}; };
# Configure all of the keymaps. # Configure all of the keymaps.
keymaps = keymaps = let
let
bindingPrefix = "<leader>f"; bindingPrefix = "<leader>f";
mkTelescopeKeymap = binding: settings: mkTelescopeKeymap = binding: settings:
lib.mergeAttrs lib.mergeAttrs {
{
mode = "n"; mode = "n";
key = "${bindingPrefix}${binding}"; key = "${bindingPrefix}${binding}";
} } settings;
settings; in lib.mapAttrsToList mkTelescopeKeymap ({
in
lib.mapAttrsToList mkTelescopeKeymap ({
"A" = { "A" = {
options.desc = "Resume from last use"; options.desc = "Resume from last use";
action = helpers.mkRaw "require('telescope.builtin').resume"; action = helpers.mkRaw "require('telescope.builtin').resume";
@ -72,8 +67,7 @@ in
options.desc = "Find manpage entries"; options.desc = "Find manpage entries";
action = helpers.mkRaw "require('telescope.builtin').man_pages"; action = helpers.mkRaw "require('telescope.builtin').man_pages";
}; };
} } // lib.optionalAttrs nixvimCfg.setups.treesitter.enable {
// lib.optionalAttrs nixvimCfg.setups.treesitter.enable {
"t" = { "t" = {
options.desc = "List symbols from treesitter queries"; options.desc = "List symbols from treesitter queries";
action = helpers.mkRaw "require('telescope.builtin').treesitter"; action = helpers.mkRaw "require('telescope.builtin').treesitter";

View File

@ -3,10 +3,8 @@
let let
nixvimConfig = config.nixvimConfigs.fiesta; nixvimConfig = config.nixvimConfigs.fiesta;
cfg = nixvimConfig.setups.lsp; cfg = nixvimConfig.setups.lsp;
in in {
{ options.nixvimConfigs.fiesta.setups.lsp.enable = lib.mkEnableOption null // {
options.nixvimConfigs.fiesta.setups.lsp.enable =
lib.mkEnableOption null // {
description = '' description = ''
Whether to enable LSP setup. Take note you'll have to enable and Whether to enable LSP setup. Take note you'll have to enable and
configure individual language servers yourself since the resulting configure individual language servers yourself since the resulting
@ -15,8 +13,7 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
keymaps = [ keymaps = [{
{
mode = [ "n" ]; mode = [ "n" ];
key = "<leader>Li"; key = "<leader>Li";
options.desc = "Toggle inlay hints"; options.desc = "Toggle inlay hints";
@ -25,8 +22,7 @@ in
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end end
''; '';
} }];
];
plugins.lsp = { plugins.lsp = {
enable = true; enable = true;

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.note-taking; cfg = nixvimCfg.setups.note-taking;
in in {
{
options.nixvimConfigs.fiesta.setups.note-taking.enable = options.nixvimConfigs.fiesta.setups.note-taking.enable =
lib.mkEnableOption "basic note-taking setup"; lib.mkEnableOption "basic note-taking setup";
@ -25,8 +24,7 @@ in
# Install the tree-sitter parsers. # Install the tree-sitter parsers.
plugins.treesitter.grammarPackages = plugins.treesitter.grammarPackages =
lib.mkIf lib.mkIf (config.plugins.neorg.settings ? load."core.defaults")
(config.plugins.neorg.settings ? load."core.defaults")
(with pkgs.tree-sitter-grammars; [ (with pkgs.tree-sitter-grammars; [
tree-sitter-norg tree-sitter-norg
tree-sitter-norg-meta tree-sitter-norg-meta

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.devenvs; cfg = nixvimCfg.setups.devenvs;
in in {
{
options.nixvimConfigs.fiesta.setups.qol.enable = options.nixvimConfigs.fiesta.setups.qol.enable =
lib.mkEnableOption "quality-of-life improvements"; lib.mkEnableOption "quality-of-life improvements";

View File

@ -4,11 +4,8 @@ let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.snippets; cfg = nixvimCfg.setups.snippets;
luasnipKeymapConfig = { luasnipKeymapConfig = { mode = [ "i" "s" ]; };
mode = [ "i" "s" ]; in {
};
in
{
options.nixvimConfigs.fiesta.setups.snippets.enable = options.nixvimConfigs.fiesta.setups.snippets.enable =
lib.mkEnableOption "snippets setup"; lib.mkEnableOption "snippets setup";
@ -26,12 +23,10 @@ in
plugins.friendly-snippets.enable = true; plugins.friendly-snippets.enable = true;
# Load all of the custom snippets. # Load all of the custom snippets.
plugins.luasnip.fromLua = [ plugins.luasnip.fromLua = [{
{
lazyLoad = true; lazyLoad = true;
paths = ./snippets; paths = ./snippets;
} }];
];
# Set up the keymaps ourselves since LuaSnip doesn't provide one as a # Set up the keymaps ourselves since LuaSnip doesn't provide one as a
# config option. # config option.

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.treesitter; cfg = nixvimCfg.setups.treesitter;
in in {
{
options.nixvimConfigs.fiesta.setups.treesitter.enable = options.nixvimConfigs.fiesta.setups.treesitter.enable =
lib.mkEnableOption "tree-sitter setup for Fiesta NixVim"; lib.mkEnableOption "tree-sitter setup for Fiesta NixVim";
@ -41,8 +40,7 @@ in
lspInterop = { lspInterop = {
enable = true; enable = true;
border = "none"; border = "none";
peekDefinitionCode = peekDefinitionCode = let
let
bindingPrefix = "<leader>d"; bindingPrefix = "<leader>d";
mkQueryMappings = query: binding: mkQueryMappings = query: binding:
@ -50,8 +48,7 @@ in
desc = "Peek definition of ${query}"; desc = "Peek definition of ${query}";
query = "@${query}.outer"; query = "@${query}.outer";
}; };
in in lib.mapAttrs' mkQueryMappings {
lib.mapAttrs' mkQueryMappings {
"function" = "f"; "function" = "f";
"class" = "F"; "class" = "F";
}; };
@ -59,9 +56,7 @@ in
move = lib.mkMerge ([{ move = lib.mkMerge ([{
enable = true; enable = true;
setJumps = true; setJumps = true;
}] }] ++ (let
++ (
let
motions = lib.cartesianProduct { motions = lib.cartesianProduct {
region = [ "Start" "End" ]; region = [ "Start" "End" ];
jumpDirection = [ "Previous" "Next" ]; jumpDirection = [ "Previous" "Next" ];
@ -76,9 +71,10 @@ in
}; };
actionDesc = variant: jumpDirection: query: actionDesc = variant: jumpDirection: query:
if variant == "inner" if variant == "inner" then
then "Jump to inner part of the ${jumpDirection} ${query}" "Jump to inner part of the ${jumpDirection} ${query}"
else "Jump to ${jumpDirection} ${query}"; else
"Jump to ${jumpDirection} ${query}";
mkQueryMappings = mkQueryMappings =
# The accumulator. Should be a list where it contains all of the # The accumulator. Should be a list where it contains all of the
@ -92,36 +88,51 @@ in
# A set of bindings to be used for each jump direction. # A set of bindings to be used for each jump direction.
bindings: bindings:
let let
mappings = builtins.map mappings = builtins.map (motion:
(motion:
let let
inherit (motion) region jumpDirection variant; inherit (motion) region jumpDirection variant;
jumpDirection' = lib.strings.toLower jumpDirection; jumpDirection' = lib.strings.toLower jumpDirection;
binding' = bindings.${jumpDirection'}; binding' = bindings.${jumpDirection'};
bindingPrefix = motionMap."${variant}${jumpDirection}"; bindingPrefix = motionMap."${variant}${jumpDirection}";
in in {
{
"goto${jumpDirection}${region}" = { "goto${jumpDirection}${region}" = {
"${bindingPrefix}${binding'}" = { "${bindingPrefix}${binding'}" = {
desc = actionDesc variant jumpDirection' query; desc = actionDesc variant jumpDirection' query;
query = "@${query}.${variant}"; query = "@${query}.${variant}";
}; };
}; };
}) }) motions;
motions; in acc ++ mappings;
in in lib.foldlAttrs mkQueryMappings [ ] {
acc ++ mappings; "function" = {
in previous = "M";
lib.foldlAttrs mkQueryMappings [ ] { next = "m";
"function" = { previous = "M"; next = "m"; }; };
"block" = { previous = "B"; next = "b"; }; "block" = {
"call" = { previous = "F"; next = "f"; }; previous = "B";
"class" = { previous = "C"; next = "c"; }; next = "b";
"conditional" = { previous = "D"; next = "d"; }; };
"statement" = { previous = "S"; next = "s"; }; "call" = {
"loop" = { previous = "L"; next = "l"; }; previous = "F";
} next = "f";
)); };
"class" = {
previous = "C";
next = "c";
};
"conditional" = {
previous = "D";
next = "d";
};
"statement" = {
previous = "S";
next = "s";
};
"loop" = {
previous = "L";
next = "l";
};
}));
select = { select = {
enable = true; enable = true;
lookahead = true; lookahead = true;
@ -130,8 +141,7 @@ in
"@class.outer" = "<c-v>"; "@class.outer" = "<c-v>";
"@block.outer" = "<c-v>"; "@block.outer" = "<c-v>";
}; };
keymaps = keymaps = let
let
prefixMap = { prefixMap = {
"outer" = { "outer" = {
key = "a"; key = "a";
@ -154,20 +164,14 @@ in
binding: binding:
let let
mappingsList = mappingsList = builtins.map (variant:
builtins.map let prefixMap' = prefixMap.${variant};
(variant: in lib.nameValuePair "${prefixMap'.key}${binding}" {
let
prefixMap' = prefixMap.${variant};
in
lib.nameValuePair "${prefixMap'.key}${binding}" {
query = "@${query}.${variant}"; query = "@${query}.${variant}";
desc = prefixMap'.desc query; desc = prefixMap'.desc query;
}) [ "outer" "inner" ]; }) [ "outer" "inner" ];
in in lib.listToAttrs mappingsList;
lib.listToAttrs mappingsList; in lib.concatMapAttrs mkQueryMappings {
in
lib.concatMapAttrs mkQueryMappings {
"function" = "m"; "function" = "m";
"call" = "f"; "call" = "f";
"class" = "c"; "class" = "c";
@ -177,10 +181,7 @@ in
"attribute" = "a"; "attribute" = "a";
}; };
}; };
swap = lib.mkMerge ( swap = lib.mkMerge ([{ enable = true; }] ++ (let
[{ enable = true; }]
++ (
let
motions = lib.cartesianProduct { motions = lib.cartesianProduct {
jumpDirection = [ "Previous" "Next" ]; jumpDirection = [ "Previous" "Next" ];
variant = [ "outer" ]; variant = [ "outer" ];
@ -192,39 +193,42 @@ in
}; };
actionDesc = variant: jumpDirection: query: actionDesc = variant: jumpDirection: query:
if variant == "inner" if variant == "inner" then
then "Jump to inner part of the ${jumpDirection} ${query}" "Jump to inner part of the ${jumpDirection} ${query}"
else "Jump to ${jumpDirection} ${query}"; else
"Jump to ${jumpDirection} ${query}";
mkQueryMappings = acc: query: bindings: mkQueryMappings = acc: query: bindings:
let let
mappings = builtins.map mappings = builtins.map (motion:
(motion:
let let
inherit (motion) jumpDirection variant; inherit (motion) jumpDirection variant;
jumpDirection' = lib.strings.toLower jumpDirection; jumpDirection' = lib.strings.toLower jumpDirection;
binding' = bindings.${jumpDirection'}; binding' = bindings.${jumpDirection'};
bindingPrefix = motionMap."${variant}${jumpDirection}"; bindingPrefix = motionMap."${variant}${jumpDirection}";
in in {
{
"swap${jumpDirection}" = { "swap${jumpDirection}" = {
"${bindingPrefix}${binding'}" = { "${bindingPrefix}${binding'}" = {
desc = actionDesc variant jumpDirection' query; desc = actionDesc variant jumpDirection' query;
query = "@${query}.${variant}"; query = "@${query}.${variant}";
}; };
}; };
}) }) motions;
motions; in acc ++ mappings;
in in lib.foldlAttrs mkQueryMappings [ ] {
acc ++ mappings; "function" = {
in next = "f";
lib.foldlAttrs mkQueryMappings [ ] { previous = "F";
"function" = { next = "f"; previous = "F"; }; };
"parameter" = { next = "a"; previous = "A"; }; "parameter" = {
"conditional" = { next = "d"; previous = "D"; }; next = "a";
} previous = "A";
) };
); "conditional" = {
next = "d";
previous = "D";
};
}));
}; };
}; };
} }

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.fiesta; nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.ui; cfg = nixvimCfg.setups.ui;
in in {
{
options.nixvimConfigs.fiesta.setups.ui.enable = options.nixvimConfigs.fiesta.setups.ui.enable =
lib.mkEnableOption "configuration for UI-related settings and plugins"; lib.mkEnableOption "configuration for UI-related settings and plugins";
@ -46,9 +45,7 @@ in
plugins.indent-blankline = { plugins.indent-blankline = {
enable = true; enable = true;
settings = { settings = {
indent = { indent = { char = ""; };
char = "";
};
scope.char = ""; scope.char = "";
}; };
}; };

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.trovebelt; nixvimCfg = config.nixvimConfigs.trovebelt;
cfg = nixvimCfg.setups.debugging; cfg = nixvimCfg.setups.debugging;
in in {
{
options.nixvimConfigs.trovebelt.setups.debugging.enable = options.nixvimConfigs.trovebelt.setups.debugging.enable =
lib.mkEnableOption "debugging setup"; lib.mkEnableOption "debugging setup";
@ -19,9 +18,7 @@ in
args = [ "-i" "dap" ]; args = [ "-i" "dap" ];
}; };
lldb = { lldb = { command = "lldb-dap"; };
command = "lldb-dap";
};
dart = { dart = {
command = "dart"; command = "dart";
@ -37,6 +34,5 @@ in
# Enable all of the debugging extensoins. # Enable all of the debugging extensoins.
plugins.dap.extensions.dap-go.enable = true; plugins.dap.extensions.dap-go.enable = true;
plugins.dap.extensions.dap-python.enable = true; plugins.dap.extensions.dap-python.enable = true;
plugins.rustaceanvim.enable = true;
}; };
} }

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.trovebelt; nixvimCfg = config.nixvimConfigs.trovebelt;
cfg = nixvimCfg.setups.lsp; cfg = nixvimCfg.setups.lsp;
in in {
{
options.nixvimConfigs.trovebelt.setups.lsp.enable = options.nixvimConfigs.trovebelt.setups.lsp.enable =
lib.mkEnableOption "LSP setup alongside the preferred servers installation"; lib.mkEnableOption "LSP setup alongside the preferred servers installation";
@ -12,8 +11,7 @@ in
plugins.lsp.enable = true; plugins.lsp.enable = true;
# Make all of the preferred language servers. # Make all of the preferred language servers.
plugins.lsp.servers = plugins.lsp.servers = let
let
servers = [ servers = [
"ansiblels" # For Ansible. "ansiblels" # For Ansible.
"astro" # For Astro. "astro" # For Astro.
@ -64,8 +62,8 @@ in
"zls" # For Zig. "zls" # For Zig.
]; ];
mkEnableServerConfig = server: lib.nameValuePair server { enable = true; }; mkEnableServerConfig = server:
in lib.nameValuePair server { enable = true; };
lib.listToAttrs (builtins.map mkEnableServerConfig servers); in lib.listToAttrs (builtins.map mkEnableServerConfig servers);
}; };
} }

View File

@ -3,8 +3,7 @@
let let
nixvimCfg = config.nixvimConfigs.trovebelt; nixvimCfg = config.nixvimConfigs.trovebelt;
cfg = nixvimCfg.setups.treesitter; cfg = nixvimCfg.setups.treesitter;
in in {
{
options.nixvimConfigs.trovebelt.setups.treesitter.enable = options.nixvimConfigs.trovebelt.setups.treesitter.enable =
lib.mkEnableOption "tree-sitter setup with all parsers installed"; lib.mkEnableOption "tree-sitter setup with all parsers installed";

Some files were not shown because too many files have changed in this diff Show More