style: format everything

This commit is contained in:
Moritz Böhme 2025-04-13 17:58:17 +02:00
parent ca77e23d40
commit 7c7e9317db
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
120 changed files with 1550 additions and 1655 deletions

View file

@ -1,13 +1,7 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ pkgs {pkgs, ...}: {
, config
, inputs
, ...
}:
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix

View file

@ -1,6 +1,4 @@
{ lib, pkgs, ... }: {pkgs, ...}: {
{
# needed for zfs pool # needed for zfs pool
networking.hostId = "1f8b8073"; networking.hostId = "1f8b8073";
disko.devices = { disko.devices = {

View file

@ -1,11 +1,13 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];

View file

@ -15,10 +15,12 @@
networking = { networking = {
interfaces.enp2s0 = { interfaces.enp2s0 = {
ipv4.addresses = [{ ipv4.addresses = [
{
address = "192.168.0.3"; address = "192.168.0.3";
prefixLength = 24; prefixLength = 24;
}]; }
];
}; };
defaultGateway = { defaultGateway = {
address = "192.168.0.1"; address = "192.168.0.1";

View file

@ -1,27 +1,21 @@
{ lib, ... }: {lib, ...}: rec {
mkDate = longDate:
rec { lib.concatStringsSep "-" [
mkDate = longDate: lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate) (builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate) (builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate) (builtins.substring 6 2 longDate)
]; ];
mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev; mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev;
mkVersionInput = input: mkVersionInput = input: let
let
date = mkDate (input.lastModifiedDate or "19700101"); date = mkDate (input.lastModifiedDate or "19700101");
rev = input.shortRev or "dirty"; rev = input.shortRev or "dirty";
in in "unstable-${date}_${rev}";
"unstable-${date}_${rev}";
mapModules = f: dir: mapModules = f: dir: let
let filterModules = name: type: let
filterModules = name: type:
let
isPublic = !(lib.hasPrefix "_" name); isPublic = !(lib.hasPrefix "_" name);
isSomething = type != null; isSomething = type != null;
isModule = isModule = let
let
path = "${toString dir}/${name}"; path = "${toString dir}/${name}";
isDefault = type == "directory" && builtins.pathExists "${path}/default.nix"; isDefault = type == "directory" && builtins.pathExists "${path}/default.nix";
isFile = type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix"; isFile = type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix";
@ -32,8 +26,7 @@ rec {
modulesInDir = lib.filterAttrs filterModules (builtins.readDir dir); modulesInDir = lib.filterAttrs filterModules (builtins.readDir dir);
mkModule = name: _: mkModule = name: _: let
let
path = "${toString dir}/${name}"; path = "${toString dir}/${name}";
normalizedName = normalizedName =
if name == "default.nix" if name == "default.nix"
@ -48,10 +41,8 @@ rec {
listModules = mapModules' (path: path); listModules = mapModules' (path: path);
mapModulesRec = f: dir: mapModulesRec = f: dir: let
let filterDirs = name: type: let
filterDirs = name: type:
let
isPublic = !(lib.hasPrefix "_" name); isPublic = !(lib.hasPrefix "_" name);
isSomething = type != null; isSomething = type != null;
isDir = type == "directory"; isDir = type == "directory";
@ -61,18 +52,20 @@ rec {
subDirs = lib.filterAttrs filterDirs (builtins.readDir dir); subDirs = lib.filterAttrs filterDirs (builtins.readDir dir);
mkSubModule = name: _: mkSubModule = name: _: let
let
path = "${toString dir}/${name}"; path = "${toString dir}/${name}";
in in
lib.nameValuePair name (mapModulesRec f path); lib.nameValuePair name (mapModulesRec f path);
in in
mapModules f dir // mapModules f dir
(lib.mapAttrs' mkSubModule subDirs); // (lib.mapAttrs' mkSubModule subDirs);
mapModulesRec' = f: dir: mapModulesRec' = f: dir: let
let attrValuesRec = attrs:
attrValuesRec = attrs: map (values: if lib.isAttrs values then attrValuesRec values else values) (lib.attrValues attrs); map (values:
if lib.isAttrs values
then attrValuesRec values
else values) (lib.attrValues attrs);
in in
lib.flatten (attrValuesRec (mapModulesRec f dir)); lib.flatten (attrValuesRec (mapModulesRec f dir));

View file

@ -1,11 +1,10 @@
{ lib
, config
, ...
}:
let
cfg = config.my.ai;
in
{ {
lib,
config,
...
}: let
cfg = config.my.ai;
in {
options.my.ai.enable = lib.mkEnableOption "AI stuff"; options.my.ai.enable = lib.mkEnableOption "AI stuff";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {

View file

@ -1,9 +1,5 @@
{ lib {lib, ...}:
, ... with lib; {
}:
with lib;
{
options.my.shell = { options.my.shell = {
abbreviations = mkOption { abbreviations = mkOption {
default = {}; default = {};

View file

@ -1,9 +1,5 @@
{ lib {lib, ...}:
, ... with lib; {
}:
with lib;
{
options.my.terminal = { options.my.terminal = {
package = mkOption { package = mkOption {
description = "Terminal emulator package to use. Gets converted to path of bin automatically."; description = "Terminal emulator package to use. Gets converted to path of bin automatically.";

View file

@ -1,36 +1,33 @@
{ config
, pkgs
, flavor
, rosewater
, flamingo
, pink
, mauve
, red
, maroon
, peach
, yellow
, green
, teal
, sky
, sapphire
, blue
, lavender
, text
, subtext1
, subtext0
, overlay2
, overlay1
, overlay0
, surface2
, surface1
, surface0
, base
, mantle
, crust
, ...
}:
{ {
config,
pkgs,
flavor,
rosewater,
flamingo,
pink,
mauve,
red,
maroon,
peach,
yellow,
green,
teal,
sapphire,
blue,
lavender,
text,
subtext1,
subtext0,
overlay1,
overlay0,
surface2,
surface1,
surface0,
base,
mantle,
crust,
...
}: {
my.programs.tofi.settings = { my.programs.tofi.settings = {
text-color = "#${text}"; text-color = "#${text}";
prompt-color = "#${red}"; prompt-color = "#${red}";

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{ {
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-frappe") config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.theming;
in {
config =
mkIf (cfg.enable && cfg.scheme == "catppuccin-frappe")
(import ./_catppuccin.nix (import ./_catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{ {
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-latte") config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.theming;
in {
config =
mkIf (cfg.enable && cfg.scheme == "catppuccin-latte")
(import ./_catppuccin.nix (import ./_catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{ {
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-macchiato") config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.theming;
in {
config =
mkIf (cfg.enable && cfg.scheme == "catppuccin-macchiato")
(import ./_catppuccin.nix (import ./_catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.theming;
in
{ {
config = mkIf (cfg.enable && cfg.scheme == "catppuccin-mocha") config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.theming;
in {
config =
mkIf (cfg.enable && cfg.scheme == "catppuccin-mocha")
(import ./_catppuccin.nix (import ./_catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.theming;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.theming;
in {
imports = [ imports = [
./dracula.nix ./dracula.nix
./catppuccin-frappe.nix ./catppuccin-frappe.nix
@ -33,11 +31,9 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.programs.tofi.settings = { my.programs.tofi.settings = {
font-size = "20"; font-size = "20";
font = font = let
let
fontBasePath = pkgs.nerd-fonts.fira-code; fontBasePath = pkgs.nerd-fonts.fira-code;
in in "${fontBasePath}/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf";
"${fontBasePath}/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf";
height = "360"; height = "360";
width = "720"; width = "720";
outline-width = "0"; outline-width = "0";

View file

@ -1,11 +1,10 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.theming; cfg = config.my.theming;
background = "282a36"; background = "282a36";
@ -19,8 +18,7 @@ let
purple = "bd93f9"; purple = "bd93f9";
red = "ff5555"; red = "ff5555";
yellow = "f1fa8c"; yellow = "f1fa8c";
in in {
{
config = mkIf (cfg.enable && cfg.scheme == "dracula") { config = mkIf (cfg.enable && cfg.scheme == "dracula") {
home-manager.users.moritz = { home-manager.users.moritz = {
programs = { programs = {
@ -38,8 +36,7 @@ in
prompt = "#${green}"; prompt = "#${green}";
spinner = "#${orange}"; spinner = "#${orange}";
}; };
kitty.extraConfig = kitty.extraConfig = ''
''
# https://draculatheme.com/kitty # https://draculatheme.com/kitty
foreground #f8f8f2 foreground #f8f8f2
background #282a36 background #282a36

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.wallpapers;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.wallpapers;
in {
options.my.wallpapers.enable = mkEnableOption "wallpapers"; options.my.wallpapers.enable = mkEnableOption "wallpapers";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,7 +1,5 @@
{ lib, ... }: {lib, ...}: let
let
myLib = import ../lib.nix {inherit lib;}; myLib = import ../lib.nix {inherit lib;};
in in {
{
imports = myLib.listModulesRec ./.; imports = myLib.listModulesRec ./.;
} }

View file

@ -1,7 +1,9 @@
{ config, lib, ... }: {
config,
with lib; lib,
let ...
}:
with lib; let
cfg = config.my.nixpkgs; cfg = config.my.nixpkgs;
overlayType = mkOptionType { overlayType = mkOptionType {
@ -10,13 +12,13 @@ let
check = lib.isFunction; check = lib.isFunction;
merge = lib.mergeOneOption; merge = lib.mergeOneOption;
}; };
in in {
{
options.my.nixpkgs = { options.my.nixpkgs = {
overlays = mkOption { overlays = mkOption {
default = []; default = [];
type = types.listOf overlayType; type = types.listOf overlayType;
example = literalExpression example =
literalExpression
'' ''
[ [
(self: super: { (self: super: {
@ -41,11 +43,11 @@ in
}; };
config.nixpkgs = { config.nixpkgs = {
overlays = overlays = let
let
channelOverlays = _: prev: channelOverlays = _: prev:
mapAttrs mapAttrs
(_: value: (
_: value:
import value { import value {
inherit (prev) system; inherit (prev) system;
config.allowUnfree = true; config.allowUnfree = true;

View file

@ -1,22 +1,19 @@
{ config
, lib
, pkgs
, inputs
, ...
}:
let
inherit (lib) getExe;
in
{ {
lib,
pkgs,
inputs,
...
}: let
inherit (lib) getExe;
in {
imports = [ imports = [
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
my = { my = {
nixpkgs = { nixpkgs = {
overlays = [ overlays = [
(_: prev: (
{ _: prev: {
nur = import inputs.nur { nur = import inputs.nur {
pkgs = prev; pkgs = prev;
nurpkgs = prev; nurpkgs = prev;
@ -91,7 +88,6 @@ in
wget wget
]; ];
programs = { programs = {
mtr.enable = true; mtr.enable = true;
command-not-found.enable = false; command-not-found.enable = false;

View file

@ -1,15 +1,13 @@
{ lib {
, config lib,
, pkgs config,
, inputs pkgs,
, ... inputs,
}: ...
}: let
let
inherit (lib) mkEnableOption mkIf mkDefault; inherit (lib) mkEnableOption mkIf mkDefault;
cfg = config.my.profiles.desktop; cfg = config.my.profiles.desktop;
in in {
{
options.my.profiles.desktop.enable = mkEnableOption "desktop profile"; options.my.profiles.desktop.enable = mkEnableOption "desktop profile";
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -99,7 +97,6 @@ in
}) })
]; ];
fonts = { fonts = {
enableDefaultPackages = true; enableDefaultPackages = true;
packages = [ packages = [

View file

@ -1,15 +1,13 @@
{ lib
, config
, inputs
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.gaming;
in
{ {
lib,
config,
inputs,
pkgs,
...
}:
with lib; let
cfg = config.my.profiles.gaming;
in {
imports = [ imports = [
inputs.jovian.nixosModules.default inputs.jovian.nixosModules.default
]; ];

View file

@ -1,10 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.my.profiles.impermanence;
in
{ {
config,
lib,
pkgs,
inputs,
...
}:
with lib; let
cfg = config.my.profiles.impermanence;
in {
options.my.profiles.impermanence.enable = mkEnableOption "impermanence"; options.my.profiles.impermanence.enable = mkEnableOption "impermanence";
imports = [ imports = [
@ -48,9 +51,18 @@ in
"Music" "Music"
"Pictures" "Pictures"
"Videos" "Videos"
{ directory = ".gnupg"; mode = "0700"; } {
{ directory = ".local/share/keyrings"; mode = "0700"; } directory = ".gnupg";
{ directory = ".ssh"; mode = "0700"; } mode = "0700";
}
{
directory = ".local/share/keyrings";
mode = "0700";
}
{
directory = ".ssh";
mode = "0700";
}
]; ];
files = [ files = [
".local/share/fish/fish_history" ".local/share/fish/fish_history"
@ -62,8 +74,14 @@ in
users.root = { users.root = {
home = "/root"; home = "/root";
directories = [ directories = [
{ directory = ".gnupg"; mode = "0700"; } {
{ directory = ".ssh"; mode = "0700"; } directory = ".gnupg";
mode = "0700";
}
{
directory = ".ssh";
mode = "0700";
}
]; ];
files = [ files = [
".local/share/nix/trusted-settings.json" ".local/share/nix/trusted-settings.json"

View file

@ -1,13 +1,11 @@
{ lib
, config
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{ {
lib,
config,
...
}:
with lib; let
cfg = config.my.profiles.personal;
in {
options.my.profiles.personal.enable = mkEnableOption "personal profile"; options.my.profiles.personal.enable = mkEnableOption "personal profile";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,14 +1,11 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{ {
lib,
config,
...
}:
with lib; let
cfg = config.my.profiles.personal;
in {
options.my.profiles.personal.calendar = mkEnableOption "calendar"; options.my.profiles.personal.calendar = mkEnableOption "calendar";
config = mkIf cfg.contacts { config = mkIf cfg.contacts {

View file

@ -1,14 +1,11 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.personal;
in
{ {
lib,
config,
...
}:
with lib; let
cfg = config.my.profiles.personal;
in {
options.my.profiles.personal.contacts = mkEnableOption "contacts"; options.my.profiles.personal.contacts = mkEnableOption "contacts";
config = mkIf cfg.contacts { config = mkIf cfg.contacts {

View file

@ -1,11 +1,10 @@
{ lib {
, config lib,
, pkgs config,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.profiles.personal; cfg = config.my.profiles.personal;
filterHtml = pkgs.writeScript "filter_html" '' filterHtml = pkgs.writeScript "filter_html" ''
@ -15,8 +14,7 @@ let
-o display_image=false \ -o display_image=false \
-o display_link_number=true "$@" -o display_link_number=true "$@"
''; '';
in in {
{
options.my.profiles.personal.mail = mkEnableOption "personal email"; options.my.profiles.personal.mail = mkEnableOption "personal email";
config = mkIf cfg.mail { config = mkIf cfg.mail {

View file

@ -1,15 +1,12 @@
{ lib
, config
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.ripping;
in
{ {
lib,
config,
pkgs,
...
}:
with lib; let
cfg = config.my.profiles.ripping;
in {
options.my.profiles.ripping.enable = mkEnableOption "ripping profile"; options.my.profiles.ripping.enable = mkEnableOption "ripping profile";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,15 +1,12 @@
{ lib {
, config lib,
, pkgs config,
, ... pkgs,
}: ...
}: let
let
cfg = config.my.profiles.webis; cfg = config.my.profiles.webis;
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
in in {
{
options.my.profiles.webis.enable = mkEnableOption "webis profile"; options.my.profiles.webis.enable = mkEnableOption "webis profile";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.profiles.yubikey;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.profiles.yubikey;
in {
options.my.profiles.yubikey = { options.my.profiles.yubikey = {
enable = mkEnableOption "yubikey"; enable = mkEnableOption "yubikey";
luksSupport = { luksSupport = {
@ -21,7 +19,6 @@ in
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.udev.packages = [pkgs.yubikey-personalization]; services.udev.packages = [pkgs.yubikey-personalization];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.adb;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.adb;
in {
options.my.programs.adb.enable = mkEnableOption "adb"; options.my.programs.adb.enable = mkEnableOption "adb";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,11 +1,10 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.aider; cfg = config.my.programs.aider;
wrapped = pkgs.writeShellApplication { wrapped = pkgs.writeShellApplication {
@ -15,8 +14,7 @@ let
''; '';
runtimeInputs = [cfg.package]; runtimeInputs = [cfg.package];
}; };
in in {
{
options.my.programs.aider = { options.my.programs.aider = {
enable = mkEnableOption "ssh"; enable = mkEnableOption "ssh";
package = mkPackageOption pkgs "aider-chat" {}; package = mkPackageOption pkgs "aider-chat" {};

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.chromium;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.chromium;
in {
options.my.programs.chromium = { options.my.programs.chromium = {
enable = mkEnableOption "chromium"; enable = mkEnableOption "chromium";
package = mkOption { package = mkOption {

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.code;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.code;
in {
options.my.programs.code = { options.my.programs.code = {
enable = mkEnableOption "code"; enable = mkEnableOption "code";
package = mkOption { package = mkOption {
@ -17,10 +15,12 @@ in
}; };
extensions = mkOption { extensions = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = with pkgs.vscode-extensions; [ default = with pkgs.vscode-extensions;
[
bbenoist.nix bbenoist.nix
vscodevim.vim vscodevim.vim
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ ]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{ {
name = "copilot-nightly"; name = "copilot-nightly";
publisher = "GitHub"; publisher = "GitHub";
@ -42,13 +42,15 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = environment.systemPackages = let
let
withExtensions = pkgs.vscode-with-extensions.override { withExtensions = pkgs.vscode-with-extensions.override {
vscode = cfg.package; vscode = cfg.package;
vscodeExtensions = cfg.extensions; vscodeExtensions = cfg.extensions;
}; };
maybeExtensions = if cfg.extensions == [ ] then cfg.package else withExtensions; maybeExtensions =
if cfg.extensions == []
then cfg.package
else withExtensions;
withWayland = pkgs.symlinkJoin { withWayland = pkgs.symlinkJoin {
name = "${maybeExtensions.name}-wayland"; name = "${maybeExtensions.name}-wayland";
paths = [maybeExtensions]; paths = [maybeExtensions];
@ -58,8 +60,10 @@ in
--set NIXOS_OZONE_WL 1 --set NIXOS_OZONE_WL 1
''; '';
}; };
final = if cfg.wayland then withWayland else maybeExtensions; final =
in if cfg.wayland
[ final ]; then withWayland
else maybeExtensions;
in [final];
}; };
} }

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.direnv;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.direnv;
in {
options.my.programs.direnv.enable = mkEnableOption "direnv"; options.my.programs.direnv.enable = mkEnableOption "direnv";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,16 +1,14 @@
{ config {
, lib config,
, inputs lib,
, pkgs inputs,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.firefox; cfg = config.my.programs.firefox;
arkenfox = builtins.readFile "${inputs.arkenfox-userjs}/user.js"; arkenfox = builtins.readFile "${inputs.arkenfox-userjs}/user.js";
in in {
{
options.my.programs.firefox = { options.my.programs.firefox = {
enable = mkEnableOption "firefox"; enable = mkEnableOption "firefox";
arkenfox = { arkenfox = {
@ -18,7 +16,8 @@ in
overrides = mkOption { overrides = mkOption {
default = {}; default = {};
type = with types; attrsOf (oneOf [str bool int]); type = with types; attrsOf (oneOf [str bool int]);
apply = overrides: concatStrings ( apply = overrides:
concatStrings (
mapAttrsToList mapAttrsToList
( (
name: value: '' name: value: ''
@ -39,23 +38,20 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz.programs.firefox = { home-manager.users.moritz.programs.firefox = {
enable = true; enable = true;
policies = policies = let
let
removeExtensions = ["Google" "Amazon.de" "Bing" "Amazon" "Wikipedia (en)" "Wikipedia (de)"]; removeExtensions = ["Google" "Amazon.de" "Bing" "Amazon" "Wikipedia (en)" "Wikipedia (de)"];
convertName = name: convertName = name: let
let
lower = toLower name; lower = toLower name;
escaped = replaceStrings ["."] ["dot"] lower; escaped = replaceStrings ["."] ["dot"] lower;
sanitized = head (splitString " " escaped); sanitized = head (splitString " " escaped);
in in "${sanitized}@search.mozilla.org";
"${sanitized}@search.mozilla.org"; in {
in
{
SearchEngines = mkIf (hasInfix "esr" cfg.package) { SearchEngines = mkIf (hasInfix "esr" cfg.package) {
Default = "Kagi"; Default = "Kagi";
Remove = removeExtensions; Remove = removeExtensions;
}; };
ExtensionSettings = genAttrs ExtensionSettings =
genAttrs
(map convertName removeExtensions) (map convertName removeExtensions)
(_: {installation_mode = "blocked";}); (_: {installation_mode = "blocked";});
}; };

View file

@ -1,21 +1,18 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.fish; cfg = config.my.programs.fish;
shellConfig = config.my.shell; shellConfig = config.my.shell;
exportedVariables = exportedVariables = let
let
exportVariables = exportVariables =
lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables; lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables;
in in
lib.concatStringsSep "\n" exportVariables; lib.concatStringsSep "\n" exportVariables;
in in {
{
options.my.programs.fish.enable = mkEnableOption "fish"; options.my.programs.fish.enable = mkEnableOption "fish";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -29,7 +26,8 @@ in
programs = { programs = {
fish = { fish = {
enable = true; enable = true;
plugins = [{ plugins = [
{
name = "fish-completion-sync"; name = "fish-completion-sync";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "pfgray"; owner = "pfgray";
@ -37,10 +35,15 @@ in
rev = "ba70b6457228af520751eab48430b1b995e3e0e2"; rev = "ba70b6457228af520751eab48430b1b995e3e0e2";
sha256 = "sha256-JdOLsZZ1VFRv7zA2i/QEZ1eovOym/Wccn0SJyhiP9hI="; sha256 = "sha256-JdOLsZZ1VFRv7zA2i/QEZ1eovOym/Wccn0SJyhiP9hI=";
}; };
}]; }
];
shellAbbrs = shellConfig.abbreviations; shellAbbrs = shellConfig.abbreviations;
shellAliases = shellConfig.aliases; shellAliases = shellConfig.aliases;
shellInit = /* fish */ '' shellInit =
/*
fish
*/
''
# Vi Mode # Vi Mode
fish_vi_key_bindings fish_vi_key_bindings
@ -85,7 +88,11 @@ in
# Completions # Completions
complete -c c -kfa '(zoxide query -l | sed "s|$HOME|~|")' complete -c c -kfa '(zoxide query -l | sed "s|$HOME|~|")'
${optionalString config.virtualisation.podman.dockerCompat /* fish */ "complete -c docker -w podman"} ${optionalString config.virtualisation.podman.dockerCompat
/*
fish
*/
"complete -c docker -w podman"}
complete -c nom -fn "not __fish_seen_subcommand_from build shell develop" -a "build shell develop" complete -c nom -fn "not __fish_seen_subcommand_from build shell develop" -a "build shell develop"
complete -c nom -fn "__fish_seen_subcommand_from build" -w "nix build" complete -c nom -fn "__fish_seen_subcommand_from build" -w "nix build"

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.foot;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.foot;
in {
options.my.programs.foot.enable = mkEnableOption "foot"; options.my.programs.foot.enable = mkEnableOption "foot";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,20 +1,17 @@
{ config {
, lib config,
, pkgs lib,
, inputs pkgs,
, ... ...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.ghostty; cfg = config.my.programs.ghostty;
format = pkgs.formats.keyValue { format = pkgs.formats.keyValue {
listsAsDuplicateKeys = true; listsAsDuplicateKeys = true;
}; };
in in {
{
options.my.programs.ghostty.enable = mkEnableOption "Ghostty"; options.my.programs.ghostty.enable = mkEnableOption "Ghostty";
options.my.programs.ghostty.package = (mkPackageOption pkgs "ghostty" { }); options.my.programs.ghostty.package = mkPackageOption pkgs "ghostty" {};
options.my.programs.ghostty.settings = mkOption { options.my.programs.ghostty.settings = mkOption {
inherit (format) type; inherit (format) type;
description = '' description = ''

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.git;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.git;
in {
options.my.programs.git = { options.my.programs.git = {
enable = mkEnableOption "git"; enable = mkEnableOption "git";
signing = mkOption { signing = mkOption {

View file

@ -1,11 +1,10 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.gnome; cfg = config.my.programs.gnome;
extensions = with pkgs.gnomeExtensions; [ extensions = with pkgs.gnomeExtensions; [
@ -14,8 +13,7 @@ let
blur-my-shell blur-my-shell
pop-shell pop-shell
]; ];
in in {
{
options.my.programs.gnome.enable = mkEnableOption "gnome"; options.my.programs.gnome.enable = mkEnableOption "gnome";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -39,7 +37,9 @@ in
home-manager.users.moritz.dconf.settings = { home-manager.users.moritz.dconf.settings = {
"org/gnome/shell" = { "org/gnome/shell" = {
disable-user-extensions = false; disable-user-extensions = false;
enabled-extensions = map (p: p.extensionUuid or p.uuid) extensions ++ [ enabled-extensions =
map (p: p.extensionUuid or p.uuid) extensions
++ [
"launch-new-instance@gnome-shell-extensions.gcampax.github.com" "launch-new-instance@gnome-shell-extensions.gcampax.github.com"
"workspace-indicator@gnome-shell-extensions.gcampax.github.com" "workspace-indicator@gnome-shell-extensions.gcampax.github.com"
]; ];

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.gpg;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.gpg;
in {
options.my.programs.gpg.enable = mkEnableOption "gpg"; options.my.programs.gpg.enable = mkEnableOption "gpg";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,13 +1,15 @@
{ config, lib, pkgs, ... }: {
config,
let lib,
pkgs,
...
}: let
inherit (lib) any filterAttrs mapAttrsToList mkEnableOption mkIf mkOption; inherit (lib) any filterAttrs mapAttrsToList mkEnableOption mkIf mkOption;
cfg = config.my.programs.jetbrains; cfg = config.my.programs.jetbrains;
isEnabled = _: value: value.enable; isEnabled = _: value: value.enable;
anyEnabled = any (x: x) (mapAttrsToList isEnabled cfg); anyEnabled = any (x: x) (mapAttrsToList isEnabled cfg);
in in {
{
options.my.programs.jetbrains = { options.my.programs.jetbrains = {
pycharm = { pycharm = {
enable = mkEnableOption "pycharm"; enable = mkEnableOption "pycharm";
@ -34,8 +36,7 @@ in
xdg.configFile."ideavim/ideavimrc" = { xdg.configFile."ideavim/ideavimrc" = {
source = ./ideavimrc; source = ./ideavimrc;
}; };
home.packages = home.packages = let
let
enabledPackages = filterAttrs isEnabled cfg; enabledPackages = filterAttrs isEnabled cfg;
in in
mapAttrsToList (_: value: value.package) enabledPackages; mapAttrsToList (_: value: value.package) enabledPackages;

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.kitty;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.kitty;
in {
options.my.programs.kitty.enable = mkEnableOption "kitty"; options.my.programs.kitty.enable = mkEnableOption "kitty";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,11 +1,10 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.lazygit; cfg = config.my.programs.lazygit;
wrapper = pkgs.writeShellApplication { wrapper = pkgs.writeShellApplication {
@ -22,8 +21,7 @@ let
''; '';
runtimeInputs = [pkgs.lazygit]; runtimeInputs = [pkgs.lazygit];
}; };
in in {
{
options.my.programs.lazygit.enable = mkEnableOption "lazygit"; options.my.programs.lazygit.enable = mkEnableOption "lazygit";
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -44,17 +42,61 @@ in
key = "Type"; key = "Type";
title = "Type of change"; title = "Type of change";
options = [ options = [
{ name = "build"; description = "Changes that affect the build system or external dependencies"; value = "build"; } {
{ name = "feat"; description = "A new feature"; value = "feat"; } name = "build";
{ name = "fix"; description = "A bug fix"; value = "fix"; } description = "Changes that affect the build system or external dependencies";
{ name = "chore"; description = "Other changes that don't modify src or test files"; value = "chore"; } value = "build";
{ name = "ci"; description = "Changes to CI configuration files and scripts"; value = "ci"; } }
{ name = "docs"; description = "Documentation only changes"; value = "docs"; } {
{ name = "perf"; description = "A code change that improves performance"; value = "perf"; } name = "feat";
{ name = "refactor"; description = "A code change that neither fixes a bug nor adds a feature"; value = "refactor"; } description = "A new feature";
{ name = "revert"; description = "Reverts a previous commit"; value = "revert"; } value = "feat";
{ name = "style"; description = "Changes that do not affect the meaning of the code"; value = "style"; } }
{ name = "test"; description = "Adding missing tests or correcting existing tests"; value = "test"; } {
name = "fix";
description = "A bug fix";
value = "fix";
}
{
name = "chore";
description = "Other changes that don't modify src or test files";
value = "chore";
}
{
name = "ci";
description = "Changes to CI configuration files and scripts";
value = "ci";
}
{
name = "docs";
description = "Documentation only changes";
value = "docs";
}
{
name = "perf";
description = "A code change that improves performance";
value = "perf";
}
{
name = "refactor";
description = "A code change that neither fixes a bug nor adds a feature";
value = "refactor";
}
{
name = "revert";
description = "Reverts a previous commit";
value = "revert";
}
{
name = "style";
description = "Changes that do not affect the meaning of the code";
value = "style";
}
{
name = "test";
description = "Adding missing tests or correcting existing tests";
value = "test";
}
]; ];
} }
{ {
@ -68,8 +110,14 @@ in
key = "Breaking"; key = "Breaking";
title = "Breaking change"; title = "Breaking change";
options = [ options = [
{ name = "no"; value = ""; } {
{ name = "yes"; value = "!"; } name = "no";
value = "";
}
{
name = "yes";
value = "!";
}
]; ];
} }
{ {

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.ledger;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.ledger;
in {
options.my.programs.ledger.enable = mkEnableOption "ledger"; options.my.programs.ledger.enable = mkEnableOption "ledger";
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -16,8 +14,7 @@ in
variables = { variables = {
LEDGER_FILE = "/home/moritz/Nextcloud/Notes/ledger/main.ledger"; LEDGER_FILE = "/home/moritz/Nextcloud/Notes/ledger/main.ledger";
}; };
aliases = aliases = let
let
applyCommon = _: command: "${command} --payee note --strict --explicit"; applyCommon = _: command: "${command} --payee note --strict --explicit";
in in
mapAttrs applyCommon { mapAttrs applyCommon {
@ -41,8 +38,7 @@ in
echo "$table" | xclip -selection clipboard echo "$table" | xclip -selection clipboard
''; '';
}; };
in in [ledger reg-copy hledger hledger-ui hledger-web];
[ ledger reg-copy hledger hledger-ui hledger-web ];
home-manager.users.moritz = { home-manager.users.moritz = {
xdg.configFile = { xdg.configFile = {
"fish/completions/ledger.fish" = { "fish/completions/ledger.fish" = {

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.logseq;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.logseq;
in {
options.my.programs.logseq.enable = mkEnableOption "logseq"; options.my.programs.logseq.enable = mkEnableOption "logseq";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.miracast;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.miracast;
in {
options.my.programs.miracast.enable = mkEnableOption "miracast"; options.my.programs.miracast.enable = mkEnableOption "miracast";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,10 +1,11 @@
{ config, lib, ... }:
with lib;
let
cfg = config.my.programs.navi;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.navi;
in {
options.my.programs.navi.enable = mkEnableOption "navi"; options.my.programs.navi.enable = mkEnableOption "navi";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,22 +1,22 @@
{ config {
, lib config,
, pkgs lib,
, inputs pkgs,
, ... inputs,
}: ...
}: let
let
cfg = config.my.programs.niri; cfg = config.my.programs.niri;
inherit (config.home-manager.users.moritz.lib.niri) actions; inherit (config.home-manager.users.moritz.lib.niri) actions;
inherit (lib) mkEnableOption getExe mkIf; inherit (lib) mkEnableOption getExe mkIf;
in in {
{
imports = [ imports = [
inputs.niri.nixosModules.niri inputs.niri.nixosModules.niri
]; ];
options.my.programs.niri.enable = mkEnableOption "niri"; options.my.programs.niri.enable = mkEnableOption "niri";
options.my.programs.niri.autoStart = mkEnableOption "auto start niri" // { options.my.programs.niri.autoStart =
mkEnableOption "auto start niri"
// {
default = true; default = true;
}; };
@ -95,11 +95,9 @@ in
command = "${lib.getExe pkgs.swaylock} -fF"; command = "${lib.getExe pkgs.swaylock} -fF";
} }
]; ];
timeouts = timeouts = let
let
lockTimeout = 10; lockTimeout = 10;
in in [
[
{ {
timeout = lockTimeout * 60 - 10; timeout = lockTimeout * 60 - 10;
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'"; command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";

View file

@ -1,17 +1,15 @@
{ config {
, lib config,
, inputs lib,
, self inputs,
, pkgs self,
, ... pkgs,
}: ...
}: let
let
inherit (lib) mkEnableOption mkOption types; inherit (lib) mkEnableOption mkOption types;
cfg = config.my.programs.nix; cfg = config.my.programs.nix;
in in {
{
options.my.programs.nix = { options.my.programs.nix = {
gc = { gc = {
enable = mkEnableOption "nix-gc"; enable = mkEnableOption "nix-gc";

View file

@ -1,13 +1,18 @@
{ config, lib, pkgs, inputs, ... }: {
config,
let lib,
pkgs,
inputs,
...
}: let
inherit (lib) mkEnableOption mkIf readFile; inherit (lib) mkEnableOption mkIf readFile;
myLib = import ../../../lib.nix {inherit lib;}; myLib = import ../../../lib.nix {inherit lib;};
cfg = config.my.programs.nvim; cfg = config.my.programs.nvim;
in in {
{ imports =
imports = (myLib.listModulesRec ./plugins) ++ [ (myLib.listModulesRec ./plugins)
++ [
{ {
home-manager.sharedModules = [ home-manager.sharedModules = [
inputs.nixvim.homeManagerModules.nixvim inputs.nixvim.homeManagerModules.nixvim
@ -26,7 +31,6 @@ in
]; ];
home-manager.users.moritz = { home-manager.users.moritz = {
home.packages = with pkgs; [ home.packages = with pkgs; [
xdotool # for vimtex xdotool # for vimtex
]; ];

View file

@ -1,11 +1,12 @@
{ config, lib, pkgs, ... }: {
config,
let lib,
...
}: let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.my.ai; cfg = config.my.ai;
in in {
{
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz.programs.nixvim.plugins = { home-manager.users.moritz.programs.nixvim.plugins = {
render-markdown = { render-markdown = {

View file

@ -1,9 +1,11 @@
{ lib, pkgs, inputs, ... }: {...}: {
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.blink-compat.enable = true; plugins.blink-compat.enable = true;
plugins.lsp.capabilities = /* lua */ '' plugins.lsp.capabilities =
/*
lua
*/
''
capabilities = require('blink.cmp').get_lsp_capabilities(capabilities) capabilities = require('blink.cmp').get_lsp_capabilities(capabilities)
''; '';
plugins.blink-cmp = { plugins.blink-cmp = {

View file

@ -1,11 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
colorschemes.catppuccin = { colorschemes.catppuccin = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.comment.enable = true; plugins.comment.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.conform-nvim = { plugins.conform-nvim = {
enable = true; enable = true;
@ -67,8 +62,11 @@ in
"conform.nvim" "conform.nvim"
]; ];
keymaps = [ keymaps = [
{ key = "="; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; } {
key = "=";
action.__raw = ''function() require("conform").format() end'';
options.desc = "Format current file";
}
]; ];
}; };
} }

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.crates.enable = true; plugins.crates.enable = true;
plugins.crates.lazyLoad.settings.event = ["BufRead Cargo.toml"]; plugins.crates.lazyLoad.settings.event = ["BufRead Cargo.toml"];

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.direnv.enable = true; plugins.direnv.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.friendly-snippets.enable = true; plugins.friendly-snippets.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.fugitive.enable = true; plugins.fugitive.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.gitsigns.enable = true; plugins.gitsigns.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.helpview.enable = true; plugins.helpview.enable = true;
performance.combinePlugins.standalonePlugins = ["helpview.nvim"]; performance.combinePlugins.standalonePlugins = ["helpview.nvim"];

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.hmts.enable = true; plugins.hmts.enable = true;
performance.combinePlugins.standalonePlugins = ["hmts.nvim"]; performance.combinePlugins.standalonePlugins = ["hmts.nvim"];

View file

@ -1,15 +1,30 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
keymaps = [ keymaps = [
{ key = "<esc>"; action = "<cmd>noh<cr><esc>"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } {
{ key = "<"; action = "<gv"; options.desc = "Shift left"; mode = [ "v" ]; } key = "<esc>";
{ key = ">"; action = ">gv"; options.desc = "Shift right"; mode = [ "v" ]; } action = "<cmd>noh<cr><esc>";
{ key = "y"; action = "ygv<esc>"; options.desc = "Yank"; mode = [ "v" ]; } options.desc = "Escape and clear hlsearch";
mode = ["i" "n"];
}
{
key = "<";
action = "<gv";
options.desc = "Shift left";
mode = ["v"];
}
{
key = ">";
action = ">gv";
options.desc = "Shift right";
mode = ["v"];
}
{
key = "y";
action = "ygv<esc>";
options.desc = "Yank";
mode = ["v"];
}
]; ];
}; };
} }

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.lastplace.enable = true; plugins.lastplace.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {pkgs, ...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [
elixir-tools-nvim elixir-tools-nvim

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins = { plugins = {
lspsaga = { lspsaga = {

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.lualine = { home-manager.users.moritz.programs.nixvim.plugins.lualine = {
enable = true; enable = true;
lazyLoad.settings.event = ["DeferredUIEnter"]; lazyLoad.settings.event = ["DeferredUIEnter"];

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz = { home-manager.users.moritz = {
xdg.configFile."nvim/snippets" = { xdg.configFile."nvim/snippets" = {
recursive = true; recursive = true;
@ -12,7 +7,11 @@ in
programs.nixvim = { programs.nixvim = {
plugins.luasnip = { plugins.luasnip = {
lazyLoad.settings.event = ["InsertEnter"]; lazyLoad.settings.event = ["InsertEnter"];
lazyLoad.settings.after = /* lua */ '' lazyLoad.settings.after =
/*
lua
*/
''
function() function()
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
require("luasnip.loaders.from_snipmate").lazy_load({ paths = "~/.config/nvim/snippets" }) require("luasnip.loaders.from_snipmate").lazy_load({ paths = "~/.config/nvim/snippets" })

View file

@ -1,8 +1,3 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.lz-n.enable = true; home-manager.users.moritz.programs.nixvim.plugins.lz-n.enable = true;
} }

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.markdown-preview.enable = true; plugins.markdown-preview.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.marks = { plugins.marks = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.mini = { plugins.mini = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.nvim-autopairs.enable = true; plugins.nvim-autopairs.enable = true;
}; };

View file

@ -1,8 +1,3 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.nvim-ufo.enable = true; home-manager.users.moritz.programs.nixvim.plugins.nvim-ufo.enable = true;
} }

View file

@ -1,6 +1,4 @@
_: _: {
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.obsidian = { plugins.obsidian = {
enable = true; enable = true;
@ -21,14 +19,49 @@ _:
end end
''; '';
mappings = { mappings = {
"<localleader>n" = { action.__raw = ''function() return vim.cmd("ObsidianNew") end''; opts.desc = "New Note"; opts.buffer = true; }; "<localleader>n" = {
"<localleader>q" = { action.__raw = ''function() return vim.cmd("ObsidianQuickSwitch") end''; opts.desc = "Quick Switch"; opts.buffer = true; }; action.__raw = ''function() return vim.cmd("ObsidianNew") end'';
"<localleader>b" = { action.__raw = ''function() return vim.cmd("ObsidianBacklinks") end''; opts.desc = "Backlinks"; opts.buffer = true; }; opts.desc = "New Note";
"<localleader>l" = { action.__raw = ''function() return vim.cmd("ObsidianLink") end''; opts.desc = "Link"; opts.buffer = true; }; opts.buffer = true;
"<localleader>e" = { action.__raw = ''function() return vim.cmd("ObsidianExtractNote") end''; opts.desc = "Extract Note"; opts.buffer = true; }; };
"<localleader>r" = { action.__raw = ''function() return vim.cmd("ObsidianRename") end''; opts.desc = "Rename"; opts.buffer = true; }; "<localleader>q" = {
"<cr>" = { action.__raw = ''function() return require("obsidian").util.smart_action() end''; opts.buffer = true; opts.expr = true; }; action.__raw = ''function() return vim.cmd("ObsidianQuickSwitch") end'';
"gf" = { action.__raw = ''function() return require("obsidian").util.gf_passthrough() end''; opts = { noremap = false; expr = true; buffer = true; }; }; opts.desc = "Quick Switch";
opts.buffer = true;
};
"<localleader>b" = {
action.__raw = ''function() return vim.cmd("ObsidianBacklinks") end'';
opts.desc = "Backlinks";
opts.buffer = true;
};
"<localleader>l" = {
action.__raw = ''function() return vim.cmd("ObsidianLink") end'';
opts.desc = "Link";
opts.buffer = true;
};
"<localleader>e" = {
action.__raw = ''function() return vim.cmd("ObsidianExtractNote") end'';
opts.desc = "Extract Note";
opts.buffer = true;
};
"<localleader>r" = {
action.__raw = ''function() return vim.cmd("ObsidianRename") end'';
opts.desc = "Rename";
opts.buffer = true;
};
"<cr>" = {
action.__raw = ''function() return require("obsidian").util.smart_action() end'';
opts.buffer = true;
opts.expr = true;
};
"gf" = {
action.__raw = ''function() return require("obsidian").util.gf_passthrough() end'';
opts = {
noremap = false;
expr = true;
buffer = true;
};
};
}; };
}; };
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.oil.enable = true; plugins.oil.enable = true;
performance.combinePlugins.standalonePlugins = [ performance.combinePlugins.standalonePlugins = [

View file

@ -1,6 +1,4 @@
_: _: {
{
home-manager.users.moritz.programs.nixvim.plugins.otter = { home-manager.users.moritz.programs.nixvim.plugins.otter = {
enable = true; enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim.plugins.render-markdown = { home-manager.users.moritz.programs.nixvim.plugins.render-markdown = {
enable = true; enable = true;
settings.latex.enable = false; settings.latex.enable = false;

View file

@ -1,6 +1,4 @@
_: _: {
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
keymaps = [ keymaps = [
{ {

View file

@ -1,6 +1,4 @@
_: _: {
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
autoCmd = [ autoCmd = [
{ {

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.todo-comments = { plugins.todo-comments = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.treesitter-textobjects = { plugins.treesitter-textobjects = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.treesitter = { plugins.treesitter = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.ts-context-commentstring.enable = true; plugins.ts-context-commentstring.enable = true;
}; };

View file

@ -1,6 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [vim-beancount]; extraPlugins = with pkgs.vimPlugins; [vim-beancount];
performance.combinePlugins.standalonePlugins = [ performance.combinePlugins.standalonePlugins = [

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.vim-surround.enable = true; plugins.vim-surround.enable = true;
}; };

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {pkgs, ...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.vimtex = { plugins.vimtex = {
enable = true; enable = true;

View file

@ -1,9 +1,4 @@
{ config, lib, pkgs, inputs, ... }: {...}: {
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = { home-manager.users.moritz.programs.nixvim = {
plugins.which-key.enable = true; plugins.which-key.enable = true;
}; };

View file

@ -1,14 +1,14 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.prismlauncher; cfg = config.my.programs.prismlauncher;
prismlauncher = pkgs.runCommandNoCC "prismlauncher" prismlauncher =
pkgs.runCommandNoCC "prismlauncher"
{ {
nativeBuildInputs = [pkgs.makeWrapper]; nativeBuildInputs = [pkgs.makeWrapper];
} '' } ''
@ -16,8 +16,7 @@ let
--set QT_STYLE_OVERRIDE "" \ --set QT_STYLE_OVERRIDE "" \
--set QT_QPA_PLATFORMTHEME "gtk3" --set QT_QPA_PLATFORMTHEME "gtk3"
''; '';
in in {
{
options.my.programs.prismlauncher.enable = mkEnableOption "prismlauncher"; options.my.programs.prismlauncher.enable = mkEnableOption "prismlauncher";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,10 +1,9 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
}: ...
}: let
let
inherit (lib) range filterAttrs attrNames foldl' head tail mkOption mkEnableOption intersectLists genAttrs flip getAttr; inherit (lib) range filterAttrs attrNames foldl' head tail mkOption mkEnableOption intersectLists genAttrs flip getAttr;
inherit (lib.types) listOf enum package; inherit (lib.types) listOf enum package;
@ -15,8 +14,7 @@ let
pythonPackages = version: attrNames pkgs."python${version}Packages"; pythonPackages = version: attrNames pkgs."python${version}Packages";
commonPackages = commonPackages = let
let
packageLists = map pythonPackages (attrNames enabledVersions); packageLists = map pythonPackages (attrNames enabledVersions);
in in
foldl' intersectLists (head packageLists) (tail packageLists); foldl' intersectLists (head packageLists) (tail packageLists);
@ -28,8 +26,7 @@ let
type = listOf (enum (pythonPackages version)); type = listOf (enum (pythonPackages version));
}; };
}; };
in in {
{
options.my.programs.python = { options.my.programs.python = {
versions = genAttrs pythonVersions versionOpts; versions = genAttrs pythonVersions versionOpts;
defaultPackages = mkOption { defaultPackages = mkOption {
@ -46,8 +43,7 @@ in
users.users.moritz.packages = users.users.moritz.packages =
( (
let let
mkPython = version: mkPython = version: let
let
package = pkgs."python${version}"; package = pkgs."python${version}";
finalPythonPackages = cfg.versions.${version}.pythonPackages ++ cfg.defaultPackages; finalPythonPackages = cfg.versions.${version}.pythonPackages ++ cfg.defaultPackages;
getPythonPackages = ps: map (flip getAttr ps) finalPythonPackages; getPythonPackages = ps: map (flip getAttr ps) finalPythonPackages;
@ -55,6 +51,7 @@ in
package.withPackages getPythonPackages; package.withPackages getPythonPackages;
in in
map mkPython (attrNames enabledVersions) map mkPython (attrNames enabledVersions)
) ++ cfg.extraPackages; )
++ cfg.extraPackages;
}; };
} }

View file

@ -1,16 +1,13 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
}: ...
}: let
let
inherit (lib) mkEnableOption mkIf mkOption types; inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.my.programs.river; cfg = config.my.programs.river;
in in {
{
options.my.programs.river = { options.my.programs.river = {
enable = mkEnableOption "river"; enable = mkEnableOption "river";
keyboardLayouts = mkOption { keyboardLayouts = mkOption {
@ -69,7 +66,8 @@ in
passthrough = { passthrough = {
"Super F11" = "enter-mode normal"; "Super F11" = "enter-mode normal";
}; };
normal = { normal =
{
"Super Q" = "close"; "Super Q" = "close";
"Super Return" = "spawn '${config.my.terminal.package}'"; "Super Return" = "spawn '${config.my.terminal.package}'";
"Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' ''; "Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' '';
@ -108,24 +106,29 @@ in
"None XF86AudioPrev" = "spawn 'playerctl -p spotifyd,firefox previous'"; "None XF86AudioPrev" = "spawn 'playerctl -p spotifyd,firefox previous'";
"Super F11" = "enter-mode passthrough"; "Super F11" = "enter-mode passthrough";
} // }
//
# tags # tags
( (
let let
numbers = lib.range 1 9; numbers = lib.range 1 9;
toTag = num: "$((1 << (${toString num} - 1)))"; toTag = num: "$((1 << (${toString num} - 1)))";
mkMappings = num: mkMappings = num: let
let
numStr = toString num; numStr = toString num;
tag = toTag num; tag = toTag num;
in in [
[
# Super+Control+[1-9] to toggle focus of tag [0-8] # Super+Control+[1-9] to toggle focus of tag [0-8]
{ name = "Super ${numStr}"; value = "set-focused-tags ${tag}"; } {
name = "Super ${numStr}";
value = "set-focused-tags ${tag}";
}
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
{ name = "Super+Shift ${numStr}"; value = "toggle-view-tags ${tag}"; } {
name = "Super+Shift ${numStr}";
value = "toggle-view-tags ${tag}";
}
]; ];
mappings = lib.flatten (map mkMappings numbers); mappings = lib.flatten (map mkMappings numbers);
in in
@ -147,7 +150,11 @@ in
set-cursor-warp = "on-focus-change"; set-cursor-warp = "on-focus-change";
keyboard-layout = "-options grp:win_space_toggle,caps:escape ${lib.concatStringsSep "," cfg.keyboardLayouts}"; keyboard-layout = "-options grp:win_space_toggle,caps:escape ${lib.concatStringsSep "," cfg.keyboardLayouts}";
}; };
extraConfig = /* bash */ '' extraConfig =
/*
bash
*/
''
rivercarro_pid="$(pidof rivercarro)" rivercarro_pid="$(pidof rivercarro)"
if [[ -z $rivercarro_pid ]]; then if [[ -z $rivercarro_pid ]]; then
rivercarro -inner-gaps 4 -outer-gaps 4 & rivercarro -inner-gaps 4 -outer-gaps 4 &
@ -198,11 +205,9 @@ in
command = "${lib.getExe pkgs.swaylock} -fF"; command = "${lib.getExe pkgs.swaylock} -fF";
} }
]; ];
timeouts = timeouts = let
let
lockTimeout = 10; lockTimeout = 10;
in in [
[
{ {
timeout = lockTimeout * 60 - 10; timeout = lockTimeout * 60 - 10;
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'"; command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
@ -229,7 +234,6 @@ in
wl-clipboard # clipboard tool for wayland wl-clipboard # clipboard tool for wayland
]; ];
# additional environment variables # additional environment variables
environment.sessionVariables = environment.sessionVariables =
{ {
@ -241,7 +245,8 @@ in
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORMTHEME = "qt5ct"; QT_QPA_PLATFORMTHEME = "qt5ct";
_JAVA_AWT_WM_NONEREPARENTING = "1"; _JAVA_AWT_WM_NONEREPARENTING = "1";
} // (lib.optionalAttrs cfg.nvidiaSupport }
// (lib.optionalAttrs cfg.nvidiaSupport
{ {
GBM_BACKEND = "nvidia-drm"; GBM_BACKEND = "nvidia-drm";
GDK_BACKEND = "wayland"; GDK_BACKEND = "wayland";

View file

@ -1,14 +1,17 @@
{ lib, pkgs, config, ... }: {
lib,
let pkgs,
config,
...
}: let
cfg = config.my.scripts; cfg = config.my.scripts;
inherit (lib) readFile; inherit (lib) readFile;
fishFile = fishFile = {
{ name name,
, destination destination,
, content content,
, checkPhase ? null checkPhase ? null,
}: }:
pkgs.writeTextFile { pkgs.writeTextFile {
inherit name destination; inherit name destination;
@ -22,7 +25,8 @@ let
''; '';
checkPhase = checkPhase =
if checkPhase == null then '' if checkPhase == null
then ''
runHook preCheck runHook preCheck
${lib.getExe pkgs.fish} -n "$target" ${lib.getExe pkgs.fish} -n "$target"
runHook postCheck runHook postCheck
@ -30,15 +34,15 @@ let
else checkPhase; else checkPhase;
}; };
writeFishApplication = writeFishApplication = {
{ name name,
, text text,
, completions ? null completions ? null,
, runtimeInputs ? [ ] runtimeInputs ? [],
, checkPhase ? null checkPhase ? null,
}: }: let
let runtimeHeader =
runtimeHeader = lib.optionalString (runtimeInputs != [ ]) lib.optionalString (runtimeInputs != [])
''export PATH="${lib.makeBinPath runtimeInputs}:$PATH"''; ''export PATH="${lib.makeBinPath runtimeInputs}:$PATH"'';
script = fishFile { script = fishFile {
@ -56,15 +60,21 @@ let
in in
pkgs.symlinkJoin { pkgs.symlinkJoin {
inherit name; inherit name;
paths = [ paths =
[
script script
] ++ lib.optional (completions != null) completions_file; ]
++ lib.optional (completions != null) completions_file;
}; };
which-nix = writeFishApplication { which-nix = writeFishApplication {
name = "which-nix"; name = "which-nix";
runtimeInputs = with pkgs; [which coreutils-full procps]; runtimeInputs = with pkgs; [which coreutils-full procps];
text = /* fish */ '' text =
/*
fish
*/
''
function recurse -a path; function recurse -a path;
if not test -f "$path" if not test -f "$path"
return return
@ -80,7 +90,11 @@ let
recurse (which $arg) recurse (which $arg)
end end
''; '';
completions = /* fish */ '' completions =
/*
fish
*/
''
complete -c which-nix -fa '(__fish_complete_command)' complete -c which-nix -fa '(__fish_complete_command)'
''; '';
}; };
@ -88,7 +102,11 @@ let
gi = writeFishApplication { gi = writeFishApplication {
name = "gi"; name = "gi";
runtimeInputs = with pkgs; [fzf gum curl coreutils-full]; runtimeInputs = with pkgs; [fzf gum curl coreutils-full];
text = /* fish */ '' text =
/*
fish
*/
''
set url https://www.gitignore.io/api set url https://www.gitignore.io/api
if test (count $argv) -eq 0 if test (count $argv) -eq 0
@ -108,7 +126,11 @@ let
echo "$contents" >> .gitignore echo "$contents" >> .gitignore
end end
''; '';
completions = /* fish */ '' completions =
/*
fish
*/
''
set args (curl -sL https://www.gitignore.io/api/list | string split ",") set args (curl -sL https://www.gitignore.io/api/list | string split ",")
complete -c gi -fa "$args" complete -c gi -fa "$args"
''; '';
@ -117,7 +139,11 @@ let
tmux-switch = pkgs.writeShellApplication { tmux-switch = pkgs.writeShellApplication {
name = "tmux-switch"; name = "tmux-switch";
runtimeInputs = with pkgs; [tmux]; runtimeInputs = with pkgs; [tmux];
text = /* bash */ '' text =
/*
bash
*/
''
if [[ -z ''${TMUX+x} ]]; then if [[ -z ''${TMUX+x} ]]; then
tmux attach -t "$1" tmux attach -t "$1"
else else
@ -143,7 +169,11 @@ let
tmux-new = pkgs.writeFishApplication { tmux-new = pkgs.writeFishApplication {
name = "tn"; name = "tn";
runtimeInputs = with pkgs; [tmux]; runtimeInputs = with pkgs; [tmux];
text = /* fish */ '' text =
/*
fish
*/
''
if ! tmux has-session -t $argv[1] 2> /dev/null if ! tmux has-session -t $argv[1] 2> /dev/null
tmux new-session -ds $argv[1] -c $argv[2] tmux new-session -ds $argv[1] -c $argv[2]
end end
@ -151,17 +181,18 @@ let
tmux-switch $argv[1] tmux-switch $argv[1]
''; '';
}; };
in in {
{
options.my.scripts = { options.my.scripts = {
enable = lib.mkEnableOption "My Scripts"; enable = lib.mkEnableOption "My Scripts";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ environment.systemPackages =
[
which-nix which-nix
gi gi
] ++ lib.optional config.my.programs.tmux.enable [ ]
++ lib.optional config.my.programs.tmux.enable [
tmux-sessionizer tmux-sessionizer
tmux-attach tmux-attach
tmux-switch tmux-switch

View file

@ -1,15 +1,13 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.spotify-player; cfg = config.my.programs.spotify-player;
toml = pkgs.formats.toml {}; toml = pkgs.formats.toml {};
in in {
{
options.my.programs.spotify-player = { options.my.programs.spotify-player = {
enable = mkEnableOption "spotify-player"; enable = mkEnableOption "spotify-player";
package = mkOption { package = mkOption {

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.ssh;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.ssh;
in {
options.my.programs.ssh = { options.my.programs.ssh = {
enable = mkEnableOption "ssh"; enable = mkEnableOption "ssh";
includes = mkOption { includes = mkOption {

View file

@ -1,14 +1,12 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.thunar;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.thunar;
in {
options.my.programs.thunar.enable = mkEnableOption "thunar"; options.my.programs.thunar.enable = mkEnableOption "thunar";
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -1,22 +1,12 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.programs.tmux;
tmux-switch = pkgs.writeShellApplication {
name = "tmux-switch";
runtimeInputs = with pkgs; [ tmux ];
text = /* bash */ ''
if [[ -z ''${TMUX+x} ]]; then
tmux attach -t "$1"
else
tmux switch-client -t "$1"
fi
'';
};
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.my.programs.tmux;
in {
options.my.programs.tmux = { options.my.programs.tmux = {
enable = mkEnableOption "tmux"; enable = mkEnableOption "tmux";
autoAttach = mkEnableOption "autoAttach"; autoAttach = mkEnableOption "autoAttach";
@ -56,19 +46,16 @@ in
vim-tmux-navigator vim-tmux-navigator
yank yank
]; ];
extraConfig = extraConfig = let
let
mkKeybind = table: mapAttrsToList (keybind: value: "bind-key -T ${table} '${keybind}' ${value}"); mkKeybind = table: mapAttrsToList (keybind: value: "bind-key -T ${table} '${keybind}' ${value}");
keybinds = flatten (mapAttrsToList mkKeybind cfg.keybinds); keybinds = flatten (mapAttrsToList mkKeybind cfg.keybinds);
in in ''
''
# Keybinds # Keybinds
${concatStringsSep "\n" keybinds} ${concatStringsSep "\n" keybinds}
''; '';
}; };
fzf.tmux.enableShellIntegration = true; fzf.tmux.enableShellIntegration = true;
fish.interactiveShellInit = fish.interactiveShellInit = let
let
insideVariables = ["$TMUX" "$INSIDE_EMACS" "$EMACS" "$VIM" "$VSCODE_RESOLVING_ENVIRONMENT"]; insideVariables = ["$TMUX" "$INSIDE_EMACS" "$EMACS" "$VIM" "$VSCODE_RESOLVING_ENVIRONMENT"];
insideVariableMissing = concatStringsSep " && " (map (x: "test -z ${x}") insideVariables); insideVariableMissing = concatStringsSep " && " (map (x: "test -z ${x}") insideVariables);
in in

View file

@ -1,20 +1,17 @@
{ config {
, lib config,
, pkgs lib,
, ... pkgs,
...
}: }:
with lib; let
with lib;
let
cfg = config.my.programs.tofi; cfg = config.my.programs.tofi;
configText = configText = let
let
settingsStrings = mapAttrsToList (name: value: "${name} = ${value}") cfg.settings; settingsStrings = mapAttrsToList (name: value: "${name} = ${value}") cfg.settings;
in in
concatLines settingsStrings; concatLines settingsStrings;
in in {
{
options.my.programs.tofi = { options.my.programs.tofi = {
enable = mkEnableOption "tofi"; enable = mkEnableOption "tofi";
settings = mkOption { settings = mkOption {

View file

@ -1,11 +1,12 @@
{ lib, config, pkgs, ... }: {
lib,
config,
with lib; pkgs,
let ...
}:
with lib; let
cfg = config.my.programs.wallpaper; cfg = config.my.programs.wallpaper;
script = pkgs.writeShellApplication { script = pkgs.writeShellApplication {
name = "wallpaper"; name = "wallpaper";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@ -18,8 +19,7 @@ let
]; ];
text = builtins.readFile ./wallpaper.sh; text = builtins.readFile ./wallpaper.sh;
}; };
in in {
{
options.my.programs.wallpaper = { options.my.programs.wallpaper = {
enable = mkEnableOption "wallpaper"; enable = mkEnableOption "wallpaper";
package = mkOption { package = mkOption {
@ -29,8 +29,7 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = environment.systemPackages = [
[
cfg.package cfg.package
]; ];
}; };

View file

@ -1,13 +1,11 @@
{ config
, lib
, ...
}:
with lib;
let
cfg = config.my.programs.zathura;
in
{ {
config,
lib,
...
}:
with lib; let
cfg = config.my.programs.zathura;
in {
options.my.programs.zathura.enable = mkEnableOption "zathura"; options.my.programs.zathura.enable = mkEnableOption "zathura";
config = mkIf cfg.enable { config = mkIf cfg.enable {

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