Rename modules directory
All checks were successful
/ check (push) Successful in 55s

This commit is contained in:
Oliver Davies 2025-08-18 12:00:00 +01:00
parent a0575bdb2a
commit 703bf836de
210 changed files with 1 additions and 1 deletions

0
modules/.keep Normal file
View file

5
modules/README.md Normal file
View file

@ -0,0 +1,5 @@
I'm refactoring my configuration to follow [the dendritic pattern](https://github.com/mightyiam/dendritic), inspired by <https://github.com/mightyiam/infra>.
Rather than a large rewrite, I am incrementally refactoring my configuration in-place.
This directory contains the modules that have been refactored, and will eventually replace the existing `modules` directory.

12
modules/avahi.nix Normal file
View file

@ -0,0 +1,12 @@
{
flake.modules.nixos.pc.services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
publish = {
enable = true;
addresses = true;
};
};
}

7
modules/bluetooth.nix Normal file
View file

@ -0,0 +1,7 @@
{
flake.modules.nixos.desktop = {
hardware.bluetooth.enable = true;
services.blueman.enable = true;
};
}

29
modules/bluetuith.nix Normal file
View file

@ -0,0 +1,29 @@
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
pkgs.bluetuith
];
xdg.configFile."bluetuith/bluetuith.conf" = {
text = ''
{
adapter: ""
adapter-states: ""
connect-bdaddr: ""
gsm-apn: ""
gsm-number: ""
keybindings: {
NavigateDown: j
NavigateUp: k
}
receive-dir: ""
theme: {}
}
'';
};
};
}

57
modules/bookmarkthis.nix Normal file
View file

@ -0,0 +1,57 @@
{ lib, ... }:
{
flake.modules.homeManager.gui =
{ config, pkgs, ... }:
{
options.programs.bookmarkthis.snippetsFile = lib.mkOption {
default = "${config.xdg.dataHome}/snippets.txt";
type = lib.types.str;
};
config = {
home = {
packages = [
(pkgs.writeShellApplication {
name = "bookmarkthis";
text = ''
message() {
if command -v ${lib.getExe pkgs.libnotify} > /dev/null; then
${lib.getExe pkgs.libnotify} "$1" "$2"
else
echo "$2"
fi
}
main() {
bookmark="$(xclip -o)"
file="$SNIPPETS_FILE"
if grep -q "^$bookmark$" "$file"; then
message "Oops." "Already bookmarked." >&2
exit 2
fi
echo "$bookmark" >> "$file"
message "Bookmark added!" "$bookmark is now saved to the file."
}
main
'';
})
];
sessionVariables = {
SNIPPETS_FILE = config.programs.bookmarkthis.snippetsFile;
};
};
programs.zsh.zsh-abbr.abbreviations = lib.optionalAttrs (config.programs.zsh.enable) {
"sn" = "${config.home.sessionVariables.EDITOR} $SNIPPETS_FILE";
};
};
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.chromium.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.librewolf.enable = true;
}

View file

@ -0,0 +1,17 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
programs.librewolf.profiles.default.extensions.packages =
with pkgs.nur.repos.rycee.firefox-addons; [
awesome-rss
bitwarden
darkreader
tree-style-tab
ublock-origin
videospeed
vimium
web-developer
];
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.gui.programs.librewolf.languagePacks = [
"en-GB"
];
}

View file

@ -0,0 +1,70 @@
{
flake.modules.homeManager.gui.programs.librewolf.policies = {
CaptivePortal = false;
DisableFirefoxAccounts = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
EnableTrackingProtection = {
Cryptomining = true;
Fingerprinting = true;
Value = true;
};
ExtensionSettings = {
"jid1-ZAdIEUB7XOzOJw@jetpack" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/duckduckgo-for-firefox/latest.xpi";
installation_mode = "force_installed";
};
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
};
FirefoxHome = {
Highlights = false;
Pocket = false;
Search = true;
Snippets = false;
SponsoredPocket = false;
SponsoredTopSites = false;
TopSites = true;
};
FirefoxSuggest = {
ImproveSuggest = false;
SponsoredSuggestions = false;
WebSuggestions = false;
};
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false;
Preferences = {
"browser.newtabpage.enabled" = false;
"cookiebanners.service.mode" = 2; # Block cookie banners
"cookiebanners.service.mode.privateBrowsing" = 2; # Block cookie banners in private browsing
"privacy.donottrackheader.enabled" = true;
"privacy.fingerprintingProtection" = true;
"privacy.resistFingerprinting" = true;
"privacy.trackingprotection.emailtracking.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.fingerprinting.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
};
HardwareAcceleration = true;
TranslateEnabled = true;
UserMessaging = {
ExtensionRecommendations = false;
UrlbarInterventions = false;
SkipOnboarding = true;
};
};
}

View file

@ -0,0 +1,19 @@
{
flake.modules.homeManager.gui.programs.librewolf.profiles.default.search.engines = {
# TODO: Drupal.org users.
# TODO: Mastodon.
# TODO: GitHub.
# TODO: Forgejo.
drupal_projects = {
name = "Drupal.org projects";
urls = [ { template = "https://www.drupal.org/project/{searchTerms}"; } ];
definedAliases = [ "@dp" ];
};
nixvim = {
name = "Nixvim options search";
urls = [ { template = "https://nix-community.github.io/nixvim/search/?query={searchTerms}"; } ];
definedAliases = [ "@nxv" ];
};
};
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui.programs.librewolf.profiles.default.search = {
default = "ddg";
force = true;
privateDefault = "ddg";
};
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui.programs.librewolf.profiles.default.settings = {
"browser.search.isUS" = false;
"browser.search.region" = "GB";
"distribution.searchplugins.defaultLocale" = "en-GB";
"general.useragent.locale" = "en-GB";
"intl.accept_languages" = "en-GB, en";
"intl.regional_prefs.use_os_locales" = true;
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.qutebrowser.enable = true;
}

View file

@ -0,0 +1,14 @@
{ lib, ... }:
{
flake.modules.homeManager.gui.programs.qutebrowser.keyBindings.normal = {
"<Ctrl-d>" = "config-cycle colors.webpage.darkmode.enabled true false";
"xb" = "config-cycle statusbar.show always never";
"xt" = "config-cycle tabs.show always never";
"xx" = lib.mkMerge [
"config-cycle statusbar.show always never"
"config-cycle tabs.show always never"
];
};
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
programs.qutebrowser.package = pkgs.stable.qutebrowser;
};
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui.programs.qutebrowser.searchEngines = {
dp = "https://www.drupal.org/project/{}";
du = "https://www.drupal.org/u/{}";
gh = "https://github.com/search?q={}";
mn = "https://mynixos.com/search?q={}";
nx = "https://search.nixos.org/packages?query={}";
yt = "https://www.youtube.com/results?search_query={}";
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.gui.programs.qutebrowser.settings = {
colors.webpage.darkmode.enabled = true;
};
}

7
modules/calculator.nix Normal file
View file

@ -0,0 +1,7 @@
{
flake.modules.nixos.pc =
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.bc ];
};
}

3
modules/dconf.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.programs.dconf.enable = true;
}

7
modules/desktop.nix Normal file
View file

@ -0,0 +1,7 @@
{ config, ... }:
{
flake.modules.nixos.desktop.imports = with config.flake.modules.nixos; [
pc
];
}

83
modules/dev-commit.nix Normal file
View file

@ -0,0 +1,83 @@
{ lib, ... }:
{
flake.modules.homeManager.base =
{ config, pkgs, ... }:
{
options.programs.dev-commit = {
enable = lib.mkEnableOption "Enable dev-commit";
repoPaths = lib.mkOption {
default = [ ];
description = "A list of repository paths that should have automated commits";
type = lib.types.listOf lib.types.path;
};
schedule = lib.mkOption {
type = lib.types.submodule {
options = {
enable = lib.mkEnableOption "Enable automated dev commits with systemd";
time = lib.mkOption {
description = ''
Time expression for when to run the dev-commit job.
This uses systemd's `OnCalendar` syntax.
Examples:
- "hourly" (once every hour)
- "daily" (once per day at midnight)
- "Mon *-*-01 12:00:00" (every Monday at 12:00 PM)
See `man systemd.time` for full syntax reference.
'';
default = "hourly";
type = lib.types.str;
};
};
};
default = {
enable = false;
time = "hourly";
};
};
};
config =
let
cfg = config.programs.dev-commit;
repoPaths = lib.concatStringsSep ":" cfg.repoPaths;
in
{
home = lib.mkIf cfg.enable {
packages = [ pkgs.dev-commit ];
sessionVariables.DEV_COMMIT_PATHS = repoPaths;
};
systemd.user = lib.mkIf cfg.schedule.enable {
services.dev-commit = {
Service = {
Environment = [ "DEV_COMMIT_PATHS=${repoPaths}" ];
ExecStart = "${lib.getExe pkgs.dev-commit}";
Type = "oneshot";
};
Unit.Description = "dev-commit";
};
timers.dev-commit = {
Install.WantedBy = [ "timers.target" ];
Timer = {
OnCalendar = cfg.schedule.time;
Unit = "dev-commit.service";
};
Unit.Description = "Runs automated development commits in select project repositories.";
};
};
};
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.direnv.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.direnv.nix-direnv.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.direnv.silent = true;
}

3
modules/direnv/zsh.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.direnv.enableZshIntegration = true;
}

24
modules/docker.nix Normal file
View file

@ -0,0 +1,24 @@
{ config, lib, ... }:
{
flake.modules.nixos.pc = args: {
options.docker.enable = lib.mkEnableOption "Enable Docker";
config = lib.mkIf args.config.docker.enable {
virtualisation = {
oci-containers.backend = "docker";
docker = {
enable = true;
autoPrune = {
enable = true;
dates = "weekly";
};
};
};
users.users.${config.flake.meta.owner.username}.extraGroups = [ "docker" ];
};
};
}

11
modules/dwm/config.nix Normal file
View file

@ -0,0 +1,11 @@
{
flake.modules.homeManager.gui =
{ config, ... }:
{
home = {
file."${config.home.sessionVariables.XINITRC}".source = ./xinitrc;
sessionVariables.XINITRC = "${config.xdg.configHome}/X11/xinitrc";
};
};
}

16
modules/dwm/packages.nix Normal file
View file

@ -0,0 +1,16 @@
{
flake.modules.nixos.pc =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
dmenu
dmenu-bluetooth
dunst
networkmanager_dmenu
poweralertd
slock
xdotool
xwallpaper
];
};
}

13
modules/dwm/xinitrc Normal file
View file

@ -0,0 +1,13 @@
systemctl --user import-environment DISPLAY
poweralertd -s &
set-background &
dwmblocks &
gammastep &
sxhkd &
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpg-connect-agent updatestartuptty /bye
exec dwm

3
modules/firmware.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.desktop.services.fwupd.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.services.flameshot.enable = true;
}

View file

@ -0,0 +1,13 @@
{
flake.modules.homeManager.gui =
{ config, ... }:
{
services.flameshot.settings.General = {
disabledTrayIcon = false;
saveAfterCopy = true;
savePath = "${config.xdg.userDirs.pictures}/Screenshots";
showHelp = false;
uiColor = "#60a5fa";
};
};
}

16
modules/fonts.nix Normal file
View file

@ -0,0 +1,16 @@
{
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
fonts = {
fontconfig.enable = true;
packages = with pkgs; [
nerd-fonts.jetbrains-mono
nerd-fonts.meslo-lg
terminus_font
terminus_font_ttf
];
};
};
}

6
modules/fzf/enable.nix Normal file
View file

@ -0,0 +1,6 @@
{
flake.modules.homeManager.base.programs.fzf = {
enable = true;
enableZshIntegration = true;
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.base.home.sessionVariables = {
FZF_DEFAULT_OPTS = "--reverse";
};
}

8
modules/games/steam.nix Normal file
View file

@ -0,0 +1,8 @@
{
nixpkgs.allowedUnfreePackages = [
"steam"
"steam-unwrapped"
];
flake.modules.nixos.desktop.programs.steam.enable = true;
}

7
modules/games/zeroad.nix Normal file
View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = with pkgs; [ zeroad ];
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homManager.gui.services.gammastep.enable = true;
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homManager.gui.services.gammastep.provider = "geoclue2";
}

View file

@ -0,0 +1,11 @@
{ inputs, ... }:
{
flake.modules.nixos.pc =
{ system, ... }:
{
environment.systemPackages = [
inputs.git-repo-updater.packages.${system}.default
];
};
}

50
modules/git/aliases.nix Normal file
View file

@ -0,0 +1,50 @@
{
flake.modules.homeManager.base.programs.git.aliases = {
aa = "add --all";
assume = "update-index --assume-unchanged";
assumed = "!git ls-files -v | grep '^[hsmrck?]' | cut -c 3-";
b = "branch";
blame = "blame -w -C -C -C";
browse = "!gh repo view --web";
ca = "commit --amend --verbose";
car = "commit --amend --no-edit";
cl = "!hub clone";
co = "checkout";
compare = "!hub compare";
current-branch = "rev-parse --abbrev-ref HEAD";
dc = "diff --color --word-diff --cached";
df = "diff --color --word-diff";
dup = "!git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -";
fixup = "commit --fixup";
issues = "!gh issue list --web";
mup = "!git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -";
no-ff = "merge --no-ff";
pl = "pull";
prune = "remote prune origin";
ps = "push";
pulls = "!gh pr list --web";
rbc = "rebase --continue";
rdup = "!git dup && git rebase develop";
remotes = "remote -v";
repush = "!git pull --rebase && git push";
ri = "rebase --interactive";
rid = "!git rebase -i $(git merge-base develop HEAD)";
rim = "!git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)";
rip = "!git rebase -i $(git merge-base production HEAD)";
ris = "!git rebase -i $(git merge-base staging HEAD)";
riu = "!git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})";
rmup = "!git mup && git master-to-main-wrapper rebase %BRANCH%";
sl = "log --oneline --decorate -20";
sla = "log --oneline --decorate --graph --all -20";
slap = "log --oneline --decorate --graph --all";
slp = "log --oneline --decorate";
stash = "stash --included-untracked";
unassume = "update-index --no-assume-unchanged";
uncommit = "reset --soft HEAD^";
unstage = "reset";
update = "!git fetch --all --jobs=4 --prune --progress && git rebase --autostash --stat";
upstream = "rev-parse --abbrev-ref --symbolic-full-name @{u}";
ureset = "!git reset --hard $(git upstream)";
worktrees = "worktree list";
};
}

View file

@ -0,0 +1,25 @@
{
flake.modules.homeManager.base =
{ config, ... }:
{
home.file."${config.xdg.configHome}/git/message".text = ''
# Description
#
# - Why is this change necessary?
# - How does it address the issue?
# - What side effects does this change have?
#
# For breaking changes, uncomment the following line and describe the change:
#
# BREAKING CHANGE:
#
#
# Add any issue IDs or commit SHAs that this commit references:
#
# Refs:
'';
};
}

54
modules/git/defaults.nix Normal file
View file

@ -0,0 +1,54 @@
{
flake.modules.homeManager.base =
{ config, ... }:
{
programs.git.extraConfig = {
branch = {
autosetupmerge = true;
autosetuprebase = "always";
sort = "-committerdate";
};
checkout.defaultRemote = "origin";
color.ui = true;
column.ui = "auto";
commit.template = "${config.xdg.configHome}/git/message";
core = {
editor = "nvim";
excludesFile = "${config.xdg.configHome}/git/ignore";
};
diff.tool = "vimdiff";
fetch.prune = true;
gpg.format = "ssh";
grep.lineNumber = true;
help.autocorrect = "1";
init.defaultBranch = "main";
maintenance = {
auto = false;
strategy = "incremental";
};
merge.ff = "only";
push = {
autoSetupRemote = true;
default = "upstream";
};
pull = {
ff = "only";
rebase = true;
};
rebase = {
autosquash = true;
autostash = true;
};
user.signingkey = "~/.ssh/id_rsa.pub";
};
};
}

3
modules/git/enable.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.git.enable = true;
}

View file

@ -0,0 +1,13 @@
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = with pkgs; [
git-exclude
git-extras
git-graph
git-trim
stable.git-instafix
];
};
}

11
modules/git/ignores.nix Normal file
View file

@ -0,0 +1,11 @@
{
flake.modules.homeManager.base.programs.git.ignores = [
"/.ddev/providers/"
"/.direnv/"
"/.ignored/"
"/.issue-id"
"/.phpactor.json"
"/notes"
"/todo"
];
}

8
modules/git/user.nix Normal file
View file

@ -0,0 +1,8 @@
{ config, ... }:
{
flake.modules.homeManager.base.programs.git = {
userName = config.flake.meta.owner.name;
userEmail = config.flake.meta.owner.email;
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.base.home.sessionVariables = {
GIT_INSTAFIX_UPSTREAM = "origin/main";
};
}

23
modules/gnupg.nix Normal file
View file

@ -0,0 +1,23 @@
{
flake.modules = {
nixos.pc =
{ pkgs, ... }:
{
security.pam.services.login.gnupg.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryPackage = pkgs.pinentry-qt;
};
};
homeManager.base.home.file.".gnupg/gpg-agent.conf".text = ''
allow-preset-passphrase
default-cache-ttl 600
max-cache-ttl 7200
enable-ssh-support
'';
};
}

View file

@ -0,0 +1,6 @@
{
flake.modules.homeManager.gui.gtk = {
gtk3.extraConfig.gtk-enable-animations = false;
gtk4.extraConfig.gtk-enable-animations = false;
};
}

3
modules/gtk/enable.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.gtk.enable = true;
}

View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
gtk.iconTheme = {
name = "Arc";
package = pkgs.arc-icon-theme;
};
};
}

10
modules/gtk/theme.nix Normal file
View file

@ -0,0 +1,10 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
gtk.theme = {
name = "Arc-Dark";
package = pkgs.arc-theme;
};
};
}

7
modules/handbrake.nix Normal file
View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.gui =
{ pkgs, ... }:
{
home.packages = [ pkgs.handbrake ];
};
}

View file

@ -0,0 +1,14 @@
{ config, ... }:
{
flake.modules.homeManager.base = args: {
home = {
homeDirectory = "/home/${config.flake.meta.owner.username}";
username = config.flake.meta.owner.username;
};
programs.home-manager.enable = true;
systemd.user.startServices = "sd-switch";
};
}

View file

@ -0,0 +1,38 @@
{
config,
inputs,
lib,
...
}:
{
flake.modules.nixos = {
pc = {
imports = [ inputs.home-manager.nixosModules.home-manager ];
home-manager = {
extraSpecialArgs.hasGlobalPkgs = true;
useGlobalPkgs = true;
# https://github.com/nix-community/home-manager/issues/6770
# useUserPackages = true;
users.${config.flake.meta.owner.username}.imports = [
(
{ osConfig, ... }:
{
home.stateVersion = lib.mkForce osConfig.system.stateVersion;
}
)
config.flake.modules.homeManager.base
];
};
};
desktop.home-manager.users.${config.flake.meta.owner.username}.imports = [
config.flake.modules.homeManager.gui
];
};
}

View file

@ -0,0 +1,31 @@
{ inputs, ... }:
{
flake.modules.nixos."nixosConfigurations/nixedo" =
{ config, pkgs, ... }:
{
services.gitea-actions-runner.instances.default = {
enable = true;
hostPackages = with pkgs; [
bash
coreutils
curl
gawk
gitMinimal
gnused
nix
nodejs
wget
];
labels = [ "nixos:host" ];
name = config.networking.hostName;
tokenFile = config.age.secrets.forgejo-runner-token.path;
url = config.services.forgejo.settings.server.ROOT_URL;
};
age.secrets.forgejo-runner-token.file = "${inputs.self}/secrets/forgejo-runner-token.age";
};
}

View file

@ -0,0 +1,7 @@
{ config, ... }:
{
flake.modules.nixos."nixosConfigurations/nixedo".imports = with config.flake.modules.nixos; [
pc
];
}

View file

@ -0,0 +1,23 @@
{ config, ... }:
{
flake.modules.nixos."nixosConfigurations/t480".home-manager.users.${config.flake.meta.owner.username} =
hmArgs: {
programs.dev-commit.enable = true;
programs.dev-commit.schedule.enable = true;
programs.dev-commit.schedule.time = "daily";
programs.dev-commit.repoPaths =
let
repos = "${hmArgs.config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/forgejo/opdavies";
in
map (name: "${repos}/${name}") [
"email-filters"
"git-repo-updater"
"nix-config"
"oliverdavies.uk"
"opentofu-dns"
];
};
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.gui = { pkgs, ... }: {
home.packages = [ pkgs.dwmblocks ];
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.services.xserver.windowManager.dwm.enable = true;
}

View file

@ -0,0 +1,17 @@
{ inputs, ... }:
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellApplication rec {
name = "fixapost";
runtimeInputs = [ pkgs.coreutils ];
text = builtins.readFile "${inputs.rwxrob-dot}/scripts/${name}";
})
];
};
}

View file

@ -0,0 +1,17 @@
{ inputs, ... }:
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellApplication rec {
name = "heightwidth";
runtimeInputs = [ pkgs.ffmpeg ];
text = builtins.readFile "${inputs.rwxrob-dot}/scripts/${name}";
})
];
};
}

View file

@ -0,0 +1,7 @@
{ config, ... }:
{
flake.modules.nixos."nixosConfigurations/t480".imports = with config.flake.modules.nixos; [
desktop
];
}

View file

@ -0,0 +1,5 @@
{
flake.modules.nixos.pc.services.kanata.devices = [
"/dev/input/by-path/platform-i8042-serio-0-event-kbd"
];
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.services.kanata.enable = true;
}

View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.base =
{ config, ... }:
{
programs.notes.directory = "${config.xdg.userDirs.documents}/wiki/notes";
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.desktop.services.ollama.enable = false;
}

View file

@ -0,0 +1,5 @@
{
nixpkgs.allowedUnfreePackages = [ "open-webui" ];
flake.modules.nixos.desktop.services.open-webui.enable = false;
}

View file

@ -0,0 +1,11 @@
{
flake.modules.homeManager.base =
{ pkgs, ... }:
{
programs.password-store.extensions = with pkgs.passExtensions; [
pass-audit
pass-otp
pass-update
];
};
}

View file

@ -0,0 +1,11 @@
{ config, ... }:
{
nixpkgs.allowedUnfreePackages = [ "slack" ];
flake.modules.nixos."nixosConfigurations/t480" =
{ pkgs, ... }:
{
users.users."${config.flake.meta.owner.username}".packages = [ pkgs.slack ];
};
}

View file

@ -0,0 +1,15 @@
{ config, ... }:
{
flake.modules.nixos."nixosConfigurations/t480".home-manager.users.${config.flake.meta.owner.username} = args: {
programs.tmux-sessionizer.searchPaths =
let
inherit (args.config.xdg) userDirs;
in
[
"${userDirs.extraConfig.XDG_REPOS_DIR}:3"
"${userDirs.documents}:1"
"${args.config.home.homeDirectory}/tmp"
];
};
}

View file

@ -0,0 +1,11 @@
{ config, ... }:
{
nixpkgs.allowedUnfreePackages = [ "zoom" ];
flake.modules.nixos."nixosConfigurations/t480" =
{ pkgs, ... }:
{
users.users."${config.flake.meta.owner.username}".packages = [ pkgs.zoom-us ];
};
}

29
modules/kanata/config.nix Normal file
View file

@ -0,0 +1,29 @@
{
flake.modules.nixos.pc.services.kanata.keyboards.default.config = ''
(defsrc
caps a s d f j k l ;
)
(defvar
tap-time 150
hold-time 200
hold-time-slow 300
)
(defalias
escctrl (tap-hold 100 100 esc lctl)
a (tap-hold $tap-time $hold-time-slow a lmet)
s (tap-hold $tap-time $hold-time-slow s lalt)
d (tap-hold $tap-time $hold-time d lsft)
f (tap-hold $tap-time $hold-time f lctl)
j (tap-hold $tap-time $hold-time j rctl)
k (tap-hold $tap-time $hold-time k rsft)
l (tap-hold $tap-time $hold-time-slow l ralt)
; (tap-hold $tap-time $hold-time-slow ; rmet)
)
(deflayer base
@escctrl @a @s @d @f @j @k @l @;
)
'';
}

View file

@ -0,0 +1,14 @@
{ lib, ... }:
{
flake.modules.nixos.pc =
{ config, ... }:
{
options.services.kanata.devices = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.str;
};
config.services.kanata.keyboards.default.devices = config.services.kanata.devices;
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.nixos.pc.services.kanata.keyboards.default.extraDefCfg = "process-unmapped-keys yes";
}

15
modules/makemkv.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, ... }:
{
nixpkgs.allowedUnfreePackages = [ "makemkv" ];
flake.modules.nixos.desktop =
{ pkgs, ... }:
{
boot.kernelModules = [ "sg" ];
environment.systemPackages = with pkgs; [ makemkv ];
users.users.${config.flake.meta.owner.username}.extraGroups = [ "cdrom" ];
};
}

View file

@ -0,0 +1,14 @@
{
perSystem =
{ pkgs, ... }:
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
just
lua-language-server
lua54Packages.luacheck
nixd
];
};
};
}

View file

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

View file

@ -0,0 +1,7 @@
{
perSystem =
{ pkgs, ... }:
{
formatter = pkgs.nixfmt-rfc-style;
};
}

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
options.flake.meta = lib.mkOption {
type = lib.types.anything;
};
}

3
modules/meta/systems.nix Normal file
View file

@ -0,0 +1,3 @@
{
systems = [ "x86_64-linux" ];
}

7
modules/mpv/bindings.nix Normal file
View file

@ -0,0 +1,7 @@
{
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf
flake.modules.homeManager.gui.programs.mpv.bindings = {
"DOWN" = "add volume -5";
"UP" = "add volume 5";
};
}

3
modules/mpv/enable.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.gui.programs.mpv.enable = true;
}

12
modules/nix-index.nix Normal file
View file

@ -0,0 +1,12 @@
{ inputs, ... }:
{
flake.modules.homeManager.base = {
imports = [ inputs.nix-index-database.homeModules.nix-index ];
programs = {
nix-index.enable = true;
nix-index-database.comma.enable = true;
};
};
}

3
modules/nix/utils.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.nh.enable = true;
}

View file

@ -0,0 +1,55 @@
{
config,
inputs,
self,
...
}:
{
flake =
let
inherit (self) outputs;
specialArgs = {
inherit inputs outputs self;
system = "x86_64-linux";
username = "opdavies";
};
mkNixosConfiguration =
{
hostname,
modules ? [ ],
stateVersion ? "22.11",
system ? "x86_64-linux",
}:
inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules = modules ++ [
"${self}/hosts/${hostname}/configuration.nix"
];
specialArgs = specialArgs // {
inherit hostname stateVersion system;
};
};
in
{
nixosConfigurations = {
nixedo = mkNixosConfiguration rec {
hostname = "nixedo";
stateVersion = "24.11";
modules = [ config.flake.modules.nixos."nixosConfigurations/${hostname}" ];
};
t480 = mkNixosConfiguration rec {
hostname = "t480";
modules = [ config.flake.modules.nixos."nixosConfigurations/${hostname}" ];
};
};
};
}

View file

@ -0,0 +1,6 @@
{
flake.modules.nixvim.custom = {
viAlias = true;
vimAlias = true;
};
}

View file

@ -0,0 +1,24 @@
{
flake.modules.nixvim.custom.plugins.auto-save = {
enable = true;
settings.condition = ''
function(buf)
local excluded_filetypes = {
"harpoon",
"oil",
}
local excluded_filenames = {}
if vim.tbl_contains(excluded_filetypes, vim.fn.getbufvar(buf, "&filetype"))
or vim.tbl_contains(excluded_filenames, vim.fn.expand("%:t"))
then
return false
end
return true
end
'';
};
}

View file

@ -0,0 +1,6 @@
{
flake.modules.nixvim.custom.colorschemes.catppuccin = {
enable = true;
settings.flavour = "mocha";
};
}

View file

@ -0,0 +1,57 @@
{
flake.modules.nixvim.custom.plugins.cmp = {
enable = true;
autoEnableSources = true;
settings = {
mapping = {
"<C-e>" = "cmp.mapping.close()";
"<C-h>" = ''
cmp.mapping(function()
if ls.locally_jumpable(-1) then
ls.jump(-1)
end
end)
'';
"<C-l>" = ''
cmp.mapping(function()
if ls.expand_or_locally_jumpable() then
ls.expand_or_jump()
end
end)
'';
"<C-n>" = "cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select })";
"<C-p>" = "cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select })";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<CR>" = "nil";
"<S-Tab>" = "nil";
"<Tab>" = "nil";
};
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
sources = [
{ name = "nvim_lsp"; }
{ name = "nvim_lua"; }
{
name = "luasnip";
keyword_length = 2;
}
{
name = "buffer";
keyword_length = 3;
}
];
};
};
}

View file

@ -0,0 +1,16 @@
{
flake.modules.nixvim.custom.plugins = {
cmp_luasnip.enable = true;
luasnip = {
enable = true;
fromLua = [
{
lazyLoad = true;
paths = ./snippets;
}
];
};
};
}

View file

@ -0,0 +1,10 @@
return {
s("dev", t("__Under development...__")),
s("source", fmta([[
[source<options>]
----
<finish>
----
]], { finish = i(0), options = i(1) })),
}

View file

@ -0,0 +1,3 @@
return {
s("log", fmta("console.log(<>);", { i(1, "value") })),
}

View file

@ -0,0 +1,13 @@
return {
s(
"req",
fmt([[local {} = require "{}"]], {
f(function(import_name)
local parts = vim.split(import_name[1][1], ".", true)
return parts[#parts] or ""
end, { 1 }),
i(1),
})
)
}

View file

@ -0,0 +1,111 @@
return {
s("home_packages", fmta("home.packages = with pkgs; [ <> ];", i(0))),
s(
"homepage_options",
fmta(
[[
homepage.name = mkOption {
default = "<name>";
type = types.str;
};
homepage.description = mkOption {
default = "<description>";
type = types.str;
};
homepage.icon = mkOption {
default = "<icon>";
type = types.str;
};
homepage.category = mkOption {
default = "<finish>";
type = types.str;
};
]],
{
description = i(2),
finish = i(0),
icon = i(3),
name = i(1),
}
)
),
s(
"imports",
fmta(
[[
{
imports = [
<>
];
}
]],
{ i(0) }
)
),
s(
"new_flake",
fmta(
[[
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";<inputs>
};
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) mkShell;
in
{
devShells.${system}.default = mkShell {
packages = with pkgs; [ <pkgs> ];
};<finish>
formatter.${system} = pkgs.nixfmt-classic;
};
}
]],
{ inputs = i(1), pkgs = i(2), finish = i(0) }
)
),
s(
"new_module",
fmta(
[[
{ config, lib, ... }:
let
name = "<name>";
cfg = config.<namespace>.${name};
in
{
options.<namespace>.${name} = {
enable = lib.mkEnableOption "Enable ${name}";<more_options>
};
config = lib.mkIf cfg.enable {
<finish>
};
}
]],
{
finish = i(0),
more_options = i(3),
name = i(1),
namespace = i(2),
},
{ repeat_duplicates = true }
)
),
s("system_packages", fmta("environment.systemPackages = with pkgs; [<>];", i(0))),
}

View file

@ -0,0 +1,55 @@
return {
s("func", fmta("function <>(<>)<> {\n <>\n}<>", { i(1), i(2), i(3), i(4), i(0) })),
s(
"met",
fmta(
[[
<> function <>(<>)<> {
<>
}<>
]],
{ c(1, { t "public", t "protected", t "private" }), i(2), i(3), i(4), i(5), i(0) }
)
),
s("pest", fmta("<>('<>', function() {\n <>\n});", { c(1, { t "it", t "test" }), i(2), i(0) })),
s(
"test",
fmta(
[[
public function test<>(): void {
<>
}<>
]],
{ i(1), i(2), i(0) }
)
),
s(
"testan",
fmta(
[[
/** @test */
public function <>(): void {
<>
}<>
]],
{ i(1), i(2), i(0) }
)
),
s(
"testat",
fmta(
[[
[#Test]
public function <>(): void {
<>
}<>
]],
{ i(1), i(2), i(0) }
)
)
}

View file

@ -0,0 +1,54 @@
local fmta = require("luasnip.extras.fmt").fmta
local fill_line = function(char)
return function()
local row = vim.api.nvim_win_get_cursor(0)[1]
local lines = vim.api.nvim_buf_get_lines(0, row - 2, row, false)
return string.rep(char, #lines[1])
end
end
return {
s("class", t(".. class:: ", i(1))),
s("footer", t(".. footer:: ", i(1))),
s("link", t(".. _", i(1), ":")),
s("raw", t(".. raw:: ", i(1))),
-- TODO: add an optional new line and ":width" property.
s("image", t(".. image:: ", i(1))),
s("head", f(fill_line "=", {})),
s("sub", f(fill_line "-", {})),
s("subsub", f(fill_line "^", {})),
-- Add a page break with an optional page template.
s(
"pb",
fmta(
[[
.. raw:: pdf
PageBreak<>
]],
{ i(0) }
)
),
-- Add a new speaker note.
s(
"ta",
fmta(
[[
.. raw:: pdf
TextAnnotation "<>"
]],
{ i(0) }
)
),
}

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