Format with nixfmt-rfc

This commit is contained in:
DashieTM 2024-08-25 19:10:41 +02:00
parent 8c9f699269
commit a90a9c3a8e
60 changed files with 1756 additions and 1039 deletions

View file

@ -1,6 +1,13 @@
{ config, lib, options, ... }:
let username = config.conf.username;
in {
{
config,
lib,
options,
...
}:
let
username = config.conf.username;
in
{
manual = {
html.enable = false;
json.enable = false;
@ -17,7 +24,9 @@ in {
sessionPath = [ "$HOME/.cargo/bin" ];
sessionVariables = { GOROOT = "$HOME/.go"; };
sessionVariables = {
GOROOT = "$HOME/.go";
};
keyboard = null;

View file

@ -1,4 +1,13 @@
{ inputs, pkgs, config, lib, mod, additionalHomeConfig, root, ... }:
{
inputs,
pkgs,
config,
lib,
mod,
additionalHomeConfig,
root,
...
}:
let
base_imports = [
inputs.anyrun.homeManagerModules.default
@ -16,7 +25,8 @@ let
inputs.dashvim.homeManagerModules.dashvim
../modules
];
in {
in
{
xdg = {
portal.config.common.default = "*";
portal = {
@ -27,13 +37,21 @@ in {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs root; };
extraSpecialArgs = {
inherit inputs root;
};
users.${config.conf.username} = {
imports = [ ./common.nix ./xdg.nix ./themes ./sync.nix ] ++ base_imports
imports =
[
./common.nix
./xdg.nix
./themes
./sync.nix
]
++ base_imports
++ lib.optional (builtins.pathExists mod) mod
++ lib.optional (builtins.pathExists additionalHomeConfig)
additionalHomeConfig;
++ lib.optional (builtins.pathExists additionalHomeConfig) additionalHomeConfig;
};
};
}

View file

@ -1,43 +1,56 @@
# derived from NixOS wiki
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
username = config.mods.nextcloud.username;
password = if (config.sops.secrets ? nextcloud.path) then
config.sops.secrets.nextcloud.path
else
"";
password =
if (config.sops.secrets ? nextcloud.path) then config.sops.secrets.nextcloud.path else "";
url = config.mods.nextcloud.url;
synclist = config.mods.nextcloud.synclist;
in lib.mkIf config.mods.nextcloud.enable {
in
lib.mkIf config.mods.nextcloud.enable {
systemd.user = {
services = (builtins.listToAttrs (map (opts: {
name = "${opts.name}";
value = {
Unit = {
Description = "Auto sync Nextcloud";
After = "network-online.target";
};
Service = {
Type = "simple";
ExecStart =
"${pkgs.bash}/bin/bash -c '${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}'";
TimeoutStopSec = "180";
KillMode = "process";
KillSignal = "SIGINT";
};
Install.WantedBy = [ "multi-user.target" ];
};
}) synclist));
timers = (builtins.listToAttrs (map (opts: {
name = "${opts.name}";
value = {
Unit.Description =
"Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes";
Timer.OnBootSec = "1min";
Timer.OnUnitActiveSec = "60min";
Install.WantedBy = [ "multi-user.target" "timers.target" ];
};
}) synclist));
services = (
builtins.listToAttrs (
map (opts: {
name = "${opts.name}";
value = {
Unit = {
Description = "Auto sync Nextcloud";
After = "network-online.target";
};
Service = {
Type = "simple";
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.nextcloud-client}/bin/nextcloudcmd -h --path ${opts.remote} ${opts.local} https://${username}:$(bat ${password})@${url}'";
TimeoutStopSec = "180";
KillMode = "process";
KillSignal = "SIGINT";
};
Install.WantedBy = [ "multi-user.target" ];
};
}) synclist
)
);
timers = (
builtins.listToAttrs (
map (opts: {
name = "${opts.name}";
value = {
Unit.Description = "Automatic sync files with Nextcloud when booted up after 1 minute then rerun every 60 minutes";
Timer.OnBootSec = "1min";
Timer.OnUnitActiveSec = "60min";
Install.WantedBy = [
"multi-user.target"
"timers.target"
];
};
}) synclist
)
);
startServices = true;
};
}

View file

@ -1,4 +1,9 @@
{ config, inputs, pkgs, ... }:
{
config,
inputs,
pkgs,
...
}:
let
username = config.conf.username;
# at time of using this here, stylix might not be evaluated yet
@ -22,10 +27,17 @@ let
border: none;
}
'';
in {
xdg.configFile."qt5ct/colors/tokyonight.conf" = { text = "${color}"; };
xdg.configFile."qt6ct/colors/tokyonight.conf" = { text = "${color}"; };
xdg.configFile."qt5ct/qss/tab.qss" = { text = "${qss}"; };
in
{
xdg.configFile."qt5ct/colors/tokyonight.conf" = {
text = "${color}";
};
xdg.configFile."qt6ct/colors/tokyonight.conf" = {
text = "${color}";
};
xdg.configFile."qt5ct/qss/tab.qss" = {
text = "${qss}";
};
xdg.configFile."qt5ct/qt5ct.conf" = {
text = ''
[Appearance]
@ -101,4 +113,3 @@ in {
'';
};
}

View file

@ -7,39 +7,65 @@ let
videoPlayer = [ "mpv" ];
audioPlayer = [ "io.bassi.Amberol" ];
xdgAssociations = type: program: list:
builtins.listToAttrs (map (e: {
name = "${type}/${e}";
value = program;
}) list);
xdgAssociations =
type: program: list:
builtins.listToAttrs (
map (e: {
name = "${type}/${e}";
value = program;
}) list
);
image = xdgAssociations "image" imageViewer [ "png" "svg" "jpeg" "gif" ];
video = xdgAssociations "video" videoPlayer [ "mp4" "avi" "mkv" ];
audio = xdgAssociations "audio" audioPlayer [ "mp3" "flac" "wav" "aac" ];
browserTypes = (xdgAssociations "application" browser [
"json"
"x-extension-htm"
"x-extension-html"
"x-extension-shtml"
"x-extension-xht"
"x-extension-xhtml"
]) // (xdgAssociations "x-scheme-handler" browser [
"about"
"ftp"
"http"
"https"
"unknown"
]);
image = xdgAssociations "image" imageViewer [
"png"
"svg"
"jpeg"
"gif"
];
video = xdgAssociations "video" videoPlayer [
"mp4"
"avi"
"mkv"
];
audio = xdgAssociations "audio" audioPlayer [
"mp3"
"flac"
"wav"
"aac"
];
browserTypes =
(xdgAssociations "application" browser [
"json"
"x-extension-htm"
"x-extension-html"
"x-extension-shtml"
"x-extension-xht"
"x-extension-xhtml"
])
// (xdgAssociations "x-scheme-handler" browser [
"about"
"ftp"
"http"
"https"
"unknown"
]);
# XDG MIME types
associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) ({
"application/pdf" = [ "org.pwmt.zathura-pdf-mupdf" ];
"text/html" = browser;
"text/plain" = [ "neovide" ];
"x-scheme-handler/chrome" = [ "com.brave.browser" ];
"inode/directory" = [ "yazi" ];
} // image // video // audio // browserTypes);
in {
associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) (
{
"application/pdf" = [ "org.pwmt.zathura-pdf-mupdf" ];
"text/html" = browser;
"text/plain" = [ "neovide" ];
"x-scheme-handler/chrome" = [ "com.brave.browser" ];
"inode/directory" = [ "yazi" ];
}
// image
// video
// audio
// browserTypes
);
in
{
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.local/cache";