part 3 of the flake-parts migration

This commit is contained in:
Danilo Reyes 2025-10-12 14:02:09 -06:00
parent 11fd8e0440
commit c3d20aa28f
6 changed files with 88 additions and 62 deletions

View File

@ -15,10 +15,12 @@
"doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org; "doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org;
}; };
services.lorri.enable = true; services.lorri.enable = true;
programs.${config.my.shell.type}.shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases { programs.${config.my.shell.type}.shellAliases =
edit = "emacsclient -t"; inputs.self.lib.mergeAliases inputs.self.lib.commonAliases
e = "edit"; {
}; edit = "emacsclient -t";
e = "edit";
};
}; };
users.users.jawz.packages = builtins.attrValues { users.users.jawz.packages = builtins.attrValues {
inherit (pkgs.xorg) xwininfo; inherit (pkgs.xorg) xwininfo;

View File

@ -34,12 +34,14 @@ in
}; };
config = lib.mkIf config.my.dev.nix.enable { config = lib.mkIf config.my.dev.nix.enable {
users.users.jawz = { inherit packages; }; users.users.jawz = { inherit packages; };
home-manager.users.jawz.programs.${shellType}.shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases { home-manager.users.jawz.programs.${shellType}.shellAliases =
nixformat = '' inputs.self.lib.mergeAliases inputs.self.lib.commonAliases
deadnix -e && \ {
nix run nixpkgs#nixfmt-tree && \ nixformat = ''
statix fix deadnix -e && \
''; nix run nixpkgs#nixfmt-tree && \
}; statix fix
'';
};
}; };
} }

View File

@ -1,18 +1,23 @@
{ lib, config, ... }: {
lib,
config,
inputs,
...
}:
let let
nativeServicesWithOpenFirewall = [ firewallBlacklist = [
"adguardhome" "lidarr"
"plex" "maloja"
"nix-serve" "tranga"
"radarr" "flame"
"sonarr" "flameSecret"
"jellyfin" "ryot"
"prowlarr" "drpp"
"bazarr" "metube"
"stash" "multi-scrobbler"
"ombi" "plex-discord-bot"
"flaresolverr"
]; ];
nativeServicesWithOpenFirewall = inputs.self.lib.getServicesWithNativeFirewall config firewallBlacklist;
servicesConfig = lib.listToAttrs ( servicesConfig = lib.listToAttrs (
map (serviceName: { map (serviceName: {
name = serviceName; name = serviceName;
@ -37,17 +42,7 @@ in
config = lib.mkIf config.my.network.firewall.enabledServicePorts { config = lib.mkIf config.my.network.firewall.enabledServicePorts {
services = servicesConfig; services = servicesConfig;
networking.firewall.allowedTCPPorts = networking.firewall.allowedTCPPorts =
config.my.network.firewall.staticPorts inputs.self.lib.generateFirewallPorts config nativeServicesWithOpenFirewall lib
++ config.my.network.firewall.additionalPorts
++ (
config.my.servers
|> lib.filterAttrs (
name: srv:
(srv.enable or false) && (srv ? port) && !(builtins.elem name nativeServicesWithOpenFirewall)
)
|> lib.attrValues
|> map (srv: srv.port)
)
++ (lib.optionals config.services.nginx.enable [ ++ (lib.optionals config.services.nginx.enable [
config.services.nginx.defaultHTTPListenPort config.services.nginx.defaultHTTPListenPort
config.services.nginx.defaultSSLListenPort config.services.nginx.defaultSSLListenPort

View File

@ -23,17 +23,20 @@
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"''; gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
}; };
} }
// inputs.self.lib.shellConditional config.my.shell.type '' //
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz inputs.self.lib.shellConditional config.my.shell.type
export LW=$list_root/watch.txt ''
export LI=$list_root/instant.txt list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
export LC=$list_root/comic.txt export LW=$list_root/watch.txt
'' '' export LI=$list_root/instant.txt
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz export LC=$list_root/comic.txt
export LW=$list_root/watch.txt ''
export LI=$list_root/instant.txt ''
export LC=$list_root/comic.txt list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
''; export LW=$list_root/watch.txt
export LI=$list_root/instant.txt
export LC=$list_root/comic.txt
'';
systemd.user = { systemd.user = {
services = services =
let let

View File

@ -70,17 +70,20 @@ in
uniq --count | sort -rn''; uniq --count | sort -rn'';
}; };
} }
// inputs.self.lib.shellConditional shellType '' //
if command -v fzf-share >/dev/null; then inputs.self.lib.shellConditional shellType
source "$(fzf-share)/key-bindings.bash" ''
source "$(fzf-share)/completion.bash" if command -v fzf-share >/dev/null; then
fi source "$(fzf-share)/key-bindings.bash"
'' '' source "$(fzf-share)/completion.bash"
if command -v fzf-share >/dev/null; then fi
source "$(fzf-share)/key-bindings.bash" ''
source "$(fzf-share)/completion.bash" ''
fi if command -v fzf-share >/dev/null; then
''; source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
}; };
programs = { programs = {
starship.enable = true; starship.enable = true;

View File

@ -192,12 +192,33 @@ in
|> builtins.filter ( |> builtins.filter (
name: !(lib.hasPrefix "wg-" name) && name != "vps" && name != "router" && name != hostName name: !(lib.hasPrefix "wg-" name) && name != "vps" && name != "router" && name != hostName
); );
shellConditional = shellType: bashContent: zshContent: shellConditional =
if shellType == "bash" then shellType: bashContent: zshContent:
{ initExtra = bashContent; } if shellType == "bash" then { initExtra = bashContent; } else { initContent = zshContent; };
else
{ initContent = zshContent; };
mergeAliases = baseAliases: extraAliases: baseAliases // extraAliases; mergeAliases = baseAliases: extraAliases: baseAliases // extraAliases;
getServicesWithNativeFirewall =
config: blacklist:
config.my.servers
|> builtins.attrNames
|> builtins.filter (
name:
(config.my.servers.${name}.enable or false)
&& !(builtins.elem name blacklist)
&& builtins.hasAttr name config.services
&& (config.services.${name} ? openFirewall)
);
generateFirewallPorts =
config: nativeServices: lib:
config.my.network.firewall.staticPorts
++ config.my.network.firewall.additionalPorts
++ (
config.my.servers
|> lib.filterAttrs (
name: srv: (srv.enable or false) && (srv ? port) && !(builtins.elem name nativeServices)
)
|> lib.attrValues
|> map (srv: srv.port)
);
}; };
}; };
} }