current
linted
This commit is contained in:
parent
4e99a0e323
commit
7485de646a
95 changed files with 2743 additions and 2282 deletions
|
@ -1,20 +1,18 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
mainUser,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
inherit mainUser;
|
||||
|
||||
imports = [
|
||||
./home.nix
|
||||
./util/local-webapp.nix
|
||||
./util/containers.nix
|
||||
# ./util/local-webapp.nix
|
||||
# ./util/containers.nix
|
||||
# ./programs/stable-diffusion.nix
|
||||
# ./programs/openwebui.nix
|
||||
./programs/anything-llm.nix
|
||||
inputs.comfyui.homeManagerModules.comfyui
|
||||
];
|
||||
|
||||
|
@ -25,13 +23,14 @@
|
|||
programs.comfyui = {
|
||||
enable = false;
|
||||
storage = "/home/${config.mainUser}/.local/share/comfyui/";
|
||||
plugins = [];
|
||||
# plugins = let
|
||||
# inherit (pkgs.comfyui-plugins) gguf openpose;
|
||||
# in [
|
||||
# gguf
|
||||
# # essentials
|
||||
# openpose
|
||||
# ];
|
||||
plugins =
|
||||
let
|
||||
inherit (pkgs.comfyui-plugins) gguf openpose;
|
||||
in
|
||||
[
|
||||
gguf
|
||||
# essentials
|
||||
openpose
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) getExe;
|
||||
in {
|
||||
in
|
||||
{
|
||||
home.stateVersion = "22.11";
|
||||
|
||||
imports = [
|
||||
|
@ -29,36 +31,37 @@ in {
|
|||
|
||||
xdg = {
|
||||
enable = true;
|
||||
portal = let
|
||||
gtk = pkgs.xdg-desktop-portal-gtk;
|
||||
gnome = pkgs.xdg-desktop-portal-gnome;
|
||||
in {
|
||||
enable = true;
|
||||
config = {
|
||||
common = {
|
||||
default = [
|
||||
"gnome"
|
||||
];
|
||||
portal =
|
||||
let
|
||||
gtk = pkgs.xdg-desktop-portal-gtk;
|
||||
gnome = pkgs.xdg-desktop-portal-gnome;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
config = {
|
||||
common = {
|
||||
default = [
|
||||
"gnome"
|
||||
];
|
||||
};
|
||||
};
|
||||
extraPortals = [
|
||||
gnome
|
||||
gtk
|
||||
];
|
||||
};
|
||||
extraPortals = [
|
||||
gnome
|
||||
gtk
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = let
|
||||
inherit (pkgs.rice) icons fonts cursor;
|
||||
in
|
||||
fonts.pkgs
|
||||
++ icons.pkgs
|
||||
++ [cursor.package];
|
||||
home.packages =
|
||||
let
|
||||
inherit (pkgs.rice) icons fonts cursor;
|
||||
in
|
||||
fonts.pkgs ++ icons.pkgs ++ [ cursor.package ];
|
||||
|
||||
systemd.user.targets.tray = {
|
||||
Unit = {
|
||||
Description = "Home Manager System Tray";
|
||||
Requires = ["graphical-session.target"];
|
||||
Requires = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -71,13 +74,13 @@ in {
|
|||
systemd.user.services.udiskie = lib.mkForce {
|
||||
Unit = {
|
||||
Description = "udiskie mount daemon";
|
||||
After = [];
|
||||
PartOf = ["graphical-session.target"];
|
||||
After = [ ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service.ExecStart = ["${pkgs.udiskie}/bin/udiskie --appindicator"];
|
||||
Service.ExecStart = [ "${pkgs.udiskie}/bin/udiskie --appindicator" ];
|
||||
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
# programs.nix-index-database.comma.enable = true;
|
||||
|
|
BIN
home/icons/discord.jpg
Normal file
BIN
home/icons/discord.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
|
@ -1,4 +1,5 @@
|
|||
{config, ...}: {
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [
|
||||
../util/firefox-webapp.nix
|
||||
];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../programs/kitty.nix
|
||||
../programs/zsh.nix
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) range mapAttrsToList;
|
||||
inherit (builtins) toString;
|
||||
workspaceRange = range 1 6;
|
||||
makeWorkspaceBinding = modifiers: action:
|
||||
makeWorkspaceBinding =
|
||||
modifiers: action:
|
||||
map (i: {
|
||||
inherit modifiers;
|
||||
key = toString i;
|
||||
|
@ -14,10 +15,9 @@
|
|||
type = action;
|
||||
data = i;
|
||||
};
|
||||
})
|
||||
workspaceRange;
|
||||
focusWsBindings = makeWorkspaceBinding ["Super"] "Workspace";
|
||||
moveWsBindings = makeWorkspaceBinding ["Super" "Shift"] "SendToWorkspace";
|
||||
}) workspaceRange;
|
||||
focusWsBindings = makeWorkspaceBinding [ "Super" ] "Workspace";
|
||||
moveWsBindings = makeWorkspaceBinding [ "Super" "Shift" ] "SendToWorkspace";
|
||||
|
||||
hjkl = {
|
||||
"h" = "Left";
|
||||
|
@ -27,24 +27,18 @@
|
|||
# "i" = "In";
|
||||
# "u" = "Out";
|
||||
};
|
||||
makeDirBinding = modifiers: action:
|
||||
mapAttrsToList (
|
||||
key: dir: {
|
||||
inherit key modifiers;
|
||||
action = {
|
||||
type = action;
|
||||
data = dir;
|
||||
};
|
||||
}
|
||||
)
|
||||
hjkl;
|
||||
focusBindings = makeDirBinding ["Super"] "Focus";
|
||||
moveBindings = makeDirBinding ["Super" "Shift"] "Move";
|
||||
winManagementBindings =
|
||||
focusWsBindings
|
||||
++ moveWsBindings
|
||||
++ focusBindings
|
||||
++ moveBindings;
|
||||
makeDirBinding =
|
||||
modifiers: action:
|
||||
mapAttrsToList (key: dir: {
|
||||
inherit key modifiers;
|
||||
action = {
|
||||
type = action;
|
||||
data = dir;
|
||||
};
|
||||
}) hjkl;
|
||||
focusBindings = makeDirBinding [ "Super" ] "Focus";
|
||||
moveBindings = makeDirBinding [ "Super" "Shift" ] "Move";
|
||||
winManagementBindings = focusWsBindings ++ moveWsBindings ++ focusBindings ++ moveBindings;
|
||||
binding = key: modifiers: action: {
|
||||
inherit key modifiers action;
|
||||
};
|
||||
|
@ -62,97 +56,96 @@
|
|||
data = action;
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../util/cosmic.nix
|
||||
];
|
||||
config.cosmic = {
|
||||
enable = true;
|
||||
defaultKeybindings = false;
|
||||
keybindings =
|
||||
winManagementBindings
|
||||
++ [
|
||||
# System bindings appear broken?
|
||||
(binding "q" ["Super" "Shift"] "Close")
|
||||
(binding "w" ["Super"] "ToggleStacking")
|
||||
(binding "s" ["Super"] "ToggleOrientation")
|
||||
(binding "space" ["Super"] "ToggleWindowFloating")
|
||||
(binding "space" ["Super" "Shift"] "Maximize")
|
||||
(binding "minus" ["Super"] "Minimize")
|
||||
(binding "r" ["Super"] {
|
||||
type = "Resizing";
|
||||
data = "Outwards";
|
||||
})
|
||||
(binding "r" ["Super" "Shift"] {
|
||||
type = "Resizing";
|
||||
data = "Inwards";
|
||||
})
|
||||
(binding "tab" ["Super"] "NextOutput")
|
||||
(binding "tab" ["Super" "Shift"] "MoveToNextOutput")
|
||||
(binding "grave" ["Super"] "PreviousOutput")
|
||||
(binding "grave" ["Super" "Shift"] "MoveToPreviousOutput")
|
||||
(spawnBinding "equal" ["Super"] "keepassxc")
|
||||
(systemBinding "f" ["Super"] "WebBrowser")
|
||||
# my mime handling is fucked
|
||||
# (systemBinding "e" ["Super"] "HomeFolder")
|
||||
# (systemBinding "return" ["Super"] "Terminal")
|
||||
(spawnBinding "return" ["Super"] "kitty")
|
||||
# (systemBinding "s" ["Super" "Shift"] "Screenshot")
|
||||
(systemBinding null ["Super"] "Launcher")
|
||||
(systemBinding "d" ["Super"] "AppLibrary")
|
||||
(systemBinding "XF86AudioRaiseVolume" [] "VolumeRaise")
|
||||
(systemBinding "XF86AudioLowerVolume" [] "VolumeLower")
|
||||
(systemBinding "XF86AudioMute" [] "Mute")
|
||||
(spawnBinding "XF86AudioNext" [] "playerctl next")
|
||||
(spawnBinding "XF86AudioPrev" [] "playerctl previous")
|
||||
(spawnBinding "XF86AudioPlay" [] "playerctl play-pause")
|
||||
(spawnBinding "XF86AudioStop" [] "playerctl stop")
|
||||
(systemBinding "XF86MonBrightnessUp" [] "BrightnessUp")
|
||||
(systemBinding "XF86MonBrightnessDown" [] "BrightnessDown")
|
||||
(spawnBinding "e" ["Super" "Shift"] "wlogout")
|
||||
keybindings = winManagementBindings ++ [
|
||||
# System bindings appear broken?
|
||||
(binding "q" [ "Super" "Shift" ] "Close")
|
||||
(binding "w" [ "Super" ] "ToggleStacking")
|
||||
(binding "s" [ "Super" ] "ToggleOrientation")
|
||||
(binding "space" [ "Super" ] "ToggleWindowFloating")
|
||||
(binding "space" [ "Super" "Shift" ] "Maximize")
|
||||
(binding "minus" [ "Super" ] "Minimize")
|
||||
(binding "r" [ "Super" ] {
|
||||
type = "Resizing";
|
||||
data = "Outwards";
|
||||
})
|
||||
(binding "r" [ "Super" "Shift" ] {
|
||||
type = "Resizing";
|
||||
data = "Inwards";
|
||||
})
|
||||
(binding "tab" [ "Super" ] "NextOutput")
|
||||
(binding "tab" [ "Super" "Shift" ] "MoveToNextOutput")
|
||||
(binding "grave" [ "Super" ] "PreviousOutput")
|
||||
(binding "grave" [ "Super" "Shift" ] "MoveToPreviousOutput")
|
||||
(spawnBinding "equal" [ "Super" ] "keepassxc")
|
||||
(systemBinding "f" [ "Super" ] "WebBrowser")
|
||||
# my mime handling is fucked
|
||||
# (systemBinding "e" ["Super"] "HomeFolder")
|
||||
# (systemBinding "return" ["Super"] "Terminal")
|
||||
(spawnBinding "return" [ "Super" ] "kitty")
|
||||
# (systemBinding "s" ["Super" "Shift"] "Screenshot")
|
||||
(systemBinding null [ "Super" ] "Launcher")
|
||||
(systemBinding "d" [ "Super" ] "AppLibrary")
|
||||
(systemBinding "XF86AudioRaiseVolume" [ ] "VolumeRaise")
|
||||
(systemBinding "XF86AudioLowerVolume" [ ] "VolumeLower")
|
||||
(systemBinding "XF86AudioMute" [ ] "Mute")
|
||||
(spawnBinding "XF86AudioNext" [ ] "playerctl next")
|
||||
(spawnBinding "XF86AudioPrev" [ ] "playerctl previous")
|
||||
(spawnBinding "XF86AudioPlay" [ ] "playerctl play-pause")
|
||||
(spawnBinding "XF86AudioStop" [ ] "playerctl stop")
|
||||
(systemBinding "XF86MonBrightnessUp" [ ] "BrightnessUp")
|
||||
(systemBinding "XF86MonBrightnessDown" [ ] "BrightnessDown")
|
||||
(spawnBinding "e" [ "Super" "Shift" ] "wlogout")
|
||||
|
||||
# old, pre-System bindings
|
||||
# (binding "q" ["Super" "Shift"] "Close")
|
||||
# (binding "w" ["Super"] "ToggleStacking")
|
||||
# (binding "s" ["Super"] "ToggleOrientation")
|
||||
# (binding "space" ["Super"] "ToggleWindowFloating")
|
||||
# (binding "space" ["Super" "Shift"] "Maximize")
|
||||
# (binding "minus" ["Super"] "Minimize")
|
||||
# (binding "r" ["Super"] {
|
||||
# type = "Resizing";
|
||||
# data = "Outwards";
|
||||
# })
|
||||
# (binding "r" ["Super" "Shift"] {
|
||||
# type = "Resizing";
|
||||
# data = "Inwards";
|
||||
# })
|
||||
# (binding "tab" ["Super"] "NextOutput")
|
||||
# (binding "tab" ["Super" "Shift"] "MoveToNextOutput")
|
||||
# (binding "grave" ["Super"] "PreviousOutput")
|
||||
# (binding "grave" ["Super" "Shift"] "MoveToPreviousOutput")
|
||||
# (spawnBinding "f" ["Super"] "firefox")
|
||||
(spawnBinding "e" ["Super"] "nautilus")
|
||||
# (spawnBinding "equal" ["Super"] "keepassxc")
|
||||
# (spawnBinding "return" ["Super"] "kitty")
|
||||
(spawnBinding "s" ["Super" "Shift"] "cosmic-screenshot")
|
||||
# (spawnBinding null ["Super"] "cosmic-launcher")
|
||||
# (spawnBinding "d" ["Super"] "cosmic-app-library")
|
||||
# (spawnBinding "XF86AudioRaiseVolume" [] "amixer sset Master 5%+")
|
||||
# (spawnBinding "XF86AudioLowerVolume" [] "amixer sset Master 5%-")
|
||||
# (spawnBinding "XF86AudioMute" [] "amixer sset Master toggle")
|
||||
# (spawnBinding "XF86AudioNext" [] "playerctl next")
|
||||
# (spawnBinding "XF86AudioPrev" [] "playerctl previous")
|
||||
# (spawnBinding "XF86AudioPlay" [] "playerctl play-pause")
|
||||
# (spawnBinding "XF86AudioStop" [] "playerctl stop")
|
||||
# (
|
||||
# spawnBinding "XF86MonBrightnessUp" []
|
||||
# "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon IncreaseDisplayBrightness"
|
||||
# )
|
||||
# (
|
||||
# spawnBinding "XF86MonBrightnessDown" []
|
||||
# "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness"
|
||||
# )
|
||||
# (spawnBinding "e" ["Super" "Shift"] "wlogout")
|
||||
];
|
||||
# old, pre-System bindings
|
||||
# (binding "q" ["Super" "Shift"] "Close")
|
||||
# (binding "w" ["Super"] "ToggleStacking")
|
||||
# (binding "s" ["Super"] "ToggleOrientation")
|
||||
# (binding "space" ["Super"] "ToggleWindowFloating")
|
||||
# (binding "space" ["Super" "Shift"] "Maximize")
|
||||
# (binding "minus" ["Super"] "Minimize")
|
||||
# (binding "r" ["Super"] {
|
||||
# type = "Resizing";
|
||||
# data = "Outwards";
|
||||
# })
|
||||
# (binding "r" ["Super" "Shift"] {
|
||||
# type = "Resizing";
|
||||
# data = "Inwards";
|
||||
# })
|
||||
# (binding "tab" ["Super"] "NextOutput")
|
||||
# (binding "tab" ["Super" "Shift"] "MoveToNextOutput")
|
||||
# (binding "grave" ["Super"] "PreviousOutput")
|
||||
# (binding "grave" ["Super" "Shift"] "MoveToPreviousOutput")
|
||||
# (spawnBinding "f" ["Super"] "firefox")
|
||||
(spawnBinding "e" [ "Super" ] "nautilus")
|
||||
# (spawnBinding "equal" ["Super"] "keepassxc")
|
||||
# (spawnBinding "return" ["Super"] "kitty")
|
||||
(spawnBinding "s" [ "Super" "Shift" ] "cosmic-screenshot")
|
||||
# (spawnBinding null ["Super"] "cosmic-launcher")
|
||||
# (spawnBinding "d" ["Super"] "cosmic-app-library")
|
||||
# (spawnBinding "XF86AudioRaiseVolume" [] "amixer sset Master 5%+")
|
||||
# (spawnBinding "XF86AudioLowerVolume" [] "amixer sset Master 5%-")
|
||||
# (spawnBinding "XF86AudioMute" [] "amixer sset Master toggle")
|
||||
# (spawnBinding "XF86AudioNext" [] "playerctl next")
|
||||
# (spawnBinding "XF86AudioPrev" [] "playerctl previous")
|
||||
# (spawnBinding "XF86AudioPlay" [] "playerctl play-pause")
|
||||
# (spawnBinding "XF86AudioStop" [] "playerctl stop")
|
||||
# (
|
||||
# spawnBinding "XF86MonBrightnessUp" []
|
||||
# "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon IncreaseDisplayBrightness"
|
||||
# )
|
||||
# (
|
||||
# spawnBinding "XF86MonBrightnessDown" []
|
||||
# "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness"
|
||||
# )
|
||||
# (spawnBinding "e" ["Super" "Shift"] "wlogout")
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{...}: {
|
||||
_:
|
||||
{
|
||||
# imports = [
|
||||
# ../util/flatpak.nix
|
||||
# ];
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./cosmic.nix
|
||||
./media-players.nix
|
||||
./webapps.nix
|
||||
# ./documents.nix
|
||||
./documents.nix
|
||||
# ./creative.nix
|
||||
./chat.nix
|
||||
../programs/firefox.nix
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../programs/vscode.nix
|
||||
];
|
||||
|
@ -8,6 +9,47 @@
|
|||
direnv
|
||||
];
|
||||
|
||||
programs.zed-editor = {
|
||||
enable = false;
|
||||
extensions = [
|
||||
"nix"
|
||||
"rust"
|
||||
"ocaml"
|
||||
"kanagawa-themes"
|
||||
];
|
||||
userSettings = {
|
||||
features = {
|
||||
copilot = false;
|
||||
};
|
||||
buffer_font_family = pkgs.rice.fonts.monospace.name;
|
||||
buffer_font_size = pkgs.rice.fonts.monospace.size;
|
||||
theme = {
|
||||
mode = "dark";
|
||||
dark = "Kanagawa Dragon";
|
||||
};
|
||||
telemetry = {
|
||||
metrics = false;
|
||||
diagnostics = false;
|
||||
};
|
||||
vim_mode = true;
|
||||
assistant = {
|
||||
default_model = {
|
||||
provider = "ollama";
|
||||
model = "llama3.2";
|
||||
};
|
||||
inline_alternatives = {
|
||||
provider = "ollama";
|
||||
model = "starcoder2:3b";
|
||||
};
|
||||
};
|
||||
language_models = {
|
||||
ollama = {
|
||||
api_url = "http://localhost:11434";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv = {
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
# ../util/flatpak.nix
|
||||
];
|
||||
# home.packages = with pkgs; [
|
||||
# libreoffice
|
||||
# ];
|
||||
flatpaks = [
|
||||
# "md.obsidian.Obsidian"
|
||||
# "com.logseq.Logseq"
|
||||
# "org.libreoffice.LibreOffice"
|
||||
# "com.jgraph.drawio.desktop"
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
libreoffice
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
rice = pkgs.rice;
|
||||
}:
|
||||
let
|
||||
inherit (pkgs) rice;
|
||||
palette = pkgs.lib.nix-rice.palette.toRGBShortHex rice.palette;
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.hyprlock = {
|
||||
# enable = true;
|
||||
};
|
||||
|
@ -24,23 +26,25 @@ in {
|
|||
package = inputs.hyprland.packages.x86_64-linux.hyprland;
|
||||
systemd = {
|
||||
enable = true;
|
||||
variables = ["--all"];
|
||||
variables = [ "--all" ];
|
||||
};
|
||||
settings = {
|
||||
"$mainMod" = "SUPER";
|
||||
general = let
|
||||
inherit (rice.borders) thickness;
|
||||
inherit (palette) normal;
|
||||
in {
|
||||
inherit (rice.borders) gaps_in gaps_out;
|
||||
border_size = thickness;
|
||||
layout = "dwindle";
|
||||
"col.inactive_border" = "rgb(${normal.black})";
|
||||
"col.active_border" = "rgb(${normal.yellow})";
|
||||
"col.nogroup_border" = "rgb(${normal.black})";
|
||||
"col.nogroup_border_active" = "rgb(${normal.yellow})";
|
||||
snap.enabled = true;
|
||||
};
|
||||
general =
|
||||
let
|
||||
inherit (rice.borders) thickness;
|
||||
inherit (palette) normal;
|
||||
in
|
||||
{
|
||||
inherit (rice.borders) gaps_in gaps_out;
|
||||
border_size = thickness;
|
||||
layout = "dwindle";
|
||||
"col.inactive_border" = "rgb(${normal.black})";
|
||||
"col.active_border" = "rgb(${normal.yellow})";
|
||||
"col.nogroup_border" = "rgb(${normal.black})";
|
||||
"col.nogroup_border_active" = "rgb(${normal.yellow})";
|
||||
snap.enabled = true;
|
||||
};
|
||||
cursor = {
|
||||
no_hardware_cursors = true;
|
||||
};
|
||||
|
@ -77,16 +81,17 @@ in {
|
|||
"HDMI-A-2, 1920x1080@60, auto-left, 1"
|
||||
"Unknown-1, disable"
|
||||
];
|
||||
bind = let
|
||||
makeDirBind = bind: extraMods:
|
||||
lib.mapAttrsToList (key: dir: "$mainMod${extraMods}, ${key}, ${bind}, ${dir}")
|
||||
{
|
||||
h = "l";
|
||||
j = "d";
|
||||
k = "u";
|
||||
l = "r";
|
||||
};
|
||||
in
|
||||
bind =
|
||||
let
|
||||
makeDirBind =
|
||||
bind: extraMods:
|
||||
lib.mapAttrsToList (key: dir: "$mainMod${extraMods}, ${key}, ${bind}, ${dir}") {
|
||||
h = "l";
|
||||
j = "d";
|
||||
k = "u";
|
||||
l = "r";
|
||||
};
|
||||
in
|
||||
[
|
||||
"$mainMod, Return, exec, ${lib.getExe pkgs.kitty}"
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
mpv
|
||||
imv
|
||||
|
|
|
@ -2,160 +2,201 @@
|
|||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
services = let
|
||||
inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit;
|
||||
in [
|
||||
swaynotificationcenter
|
||||
sway-audio-idle-inhibit
|
||||
];
|
||||
errata = let
|
||||
inherit (pkgs) sirula avizo playerctl;
|
||||
in [
|
||||
sirula
|
||||
avizo
|
||||
playerctl
|
||||
];
|
||||
extraServices = let
|
||||
inherit (pkgs) swayidle swaybg systemd niri-unstable avizo;
|
||||
in [
|
||||
{
|
||||
name = "swaybg";
|
||||
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
|
||||
}
|
||||
{
|
||||
name = "avizo-service";
|
||||
value = "${lib.getExe' avizo "avizo-service"}";
|
||||
}
|
||||
{
|
||||
name = "swayidle";
|
||||
value = let
|
||||
lock = lib.getExe pkgs.swaylock;
|
||||
niri = lib.getExe niri-unstable;
|
||||
systemctl = lib.getExe' systemd "systemctl";
|
||||
in ''
|
||||
${lib.getExe swayidle} -w \
|
||||
timeout 1800 '${systemctl} suspend' \
|
||||
timeout 600 '${niri} msg action power-off-monitors' \
|
||||
timeout 599 '${lock} -f' \
|
||||
before-sleep '${lock} -f'
|
||||
'';
|
||||
}
|
||||
];
|
||||
in {
|
||||
}:
|
||||
let
|
||||
services =
|
||||
let
|
||||
inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit;
|
||||
in
|
||||
[
|
||||
swaynotificationcenter
|
||||
sway-audio-idle-inhibit
|
||||
];
|
||||
errata =
|
||||
let
|
||||
inherit (pkgs) sirula avizo playerctl;
|
||||
in
|
||||
[
|
||||
sirula
|
||||
avizo
|
||||
playerctl
|
||||
];
|
||||
extraServices =
|
||||
let
|
||||
inherit (pkgs)
|
||||
swayidle
|
||||
swaybg
|
||||
systemd
|
||||
niri-unstable
|
||||
avizo
|
||||
;
|
||||
in
|
||||
[
|
||||
{
|
||||
name = "swaybg";
|
||||
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
|
||||
}
|
||||
{
|
||||
name = "avizo-service";
|
||||
value = "${lib.getExe' avizo "avizo-service"}";
|
||||
}
|
||||
{
|
||||
name = "swayidle";
|
||||
value =
|
||||
let
|
||||
niri = lib.getExe niri-unstable;
|
||||
systemctl = lib.getExe' systemd "systemctl";
|
||||
in
|
||||
''
|
||||
${lib.getExe swayidle} -w \
|
||||
timeout 1800 '${systemctl} suspend' \
|
||||
timeout 600 '${niri} msg action power-off-monitors'
|
||||
'';
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
home.packages = errata;
|
||||
ezServices = builtins.listToAttrs (
|
||||
(map (entry: {
|
||||
name = "${lib.strings.toLower entry.pname}";
|
||||
value = "${lib.getExe entry}";
|
||||
})
|
||||
services)
|
||||
name = "${lib.strings.toLower entry.pname}";
|
||||
value = "${lib.getExe entry}";
|
||||
}) services)
|
||||
++ extraServices
|
||||
);
|
||||
programs.niri.settings = let
|
||||
inherit (lib) range nameValuePair mapAttrs';
|
||||
inherit (builtins) listToAttrs replaceStrings;
|
||||
inherit (config.lib.niri) actions;
|
||||
in {
|
||||
binds = let
|
||||
hBinds = {
|
||||
H = "left";
|
||||
L = "right";
|
||||
};
|
||||
vBinds = {
|
||||
J = "down";
|
||||
K = "up";
|
||||
};
|
||||
makeDirBind = mods: cmd: keys:
|
||||
mapAttrs' (
|
||||
key: dir:
|
||||
nameValuePair
|
||||
"${mods}+${key}"
|
||||
{action = actions."${replaceStrings ["$DIR"] ["${dir}"] "${cmd}"}";}
|
||||
)
|
||||
keys;
|
||||
makeWsBind = mods: cmd:
|
||||
listToAttrs (map (num: {
|
||||
name = "${mods}+${builtins.toString num}";
|
||||
value = {action."${cmd}" = num;};
|
||||
}) (range 0 6));
|
||||
programs.niri.settings =
|
||||
let
|
||||
inherit (lib) range nameValuePair mapAttrs';
|
||||
inherit (builtins) listToAttrs replaceStrings;
|
||||
inherit (config.lib.niri) actions;
|
||||
in
|
||||
{
|
||||
"Mod+D".action.spawn = "sirula";
|
||||
"Mod+F".action.spawn = "firefox";
|
||||
"Mod+E".action.spawn = "nautilus";
|
||||
"Mod+Return".action.spawn = "kitty";
|
||||
"Mod+Shift+E".action.spawn = "wlogout";
|
||||
"Mod+Equal".action.spawn = "keepassxc";
|
||||
"Mod+Shift+Q".action = actions.close-window;
|
||||
"Mod+Shift+S".action = actions.screenshot;
|
||||
"Mod+R".action = actions.switch-preset-column-width;
|
||||
"Mod+Shift+R".action = actions.maximize-column;
|
||||
"XF86AudioRaiseVolume".action.spawn = ["volumectl" "-u" "up"];
|
||||
"XF86AudioLowerVolume".action.spawn = ["volumectl" "-u" "down"];
|
||||
"XF86AudioMute".action.spawn = ["volumectl" "toggle-mute"];
|
||||
"XF86AudioStop".action.spawn = ["playerctl" "stop"];
|
||||
"XF86AudioPlay".action.spawn = ["playerctl" "play-pause"];
|
||||
"XF86AudioNext".action.spawn = ["playerctl" "next"];
|
||||
"XF86AudioPrev".action.spawn = ["playerctl" "previous"];
|
||||
}
|
||||
// makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds
|
||||
// makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds
|
||||
// makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds
|
||||
// makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds
|
||||
// makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds
|
||||
// makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds
|
||||
// makeWsBind "Mod" "focus-workspace"
|
||||
// makeWsBind "Mod+Shift" "move-window-to-workspace";
|
||||
outputs = {
|
||||
"Unknown-1".enable = false;
|
||||
"DP-1" = {
|
||||
variable-refresh-rate = true;
|
||||
scale = 1;
|
||||
{
|
||||
binds =
|
||||
let
|
||||
hBinds = {
|
||||
H = "left";
|
||||
L = "right";
|
||||
};
|
||||
vBinds = {
|
||||
J = "down";
|
||||
K = "up";
|
||||
};
|
||||
makeDirBind =
|
||||
mods: cmd: keys:
|
||||
mapAttrs' (
|
||||
key: dir:
|
||||
nameValuePair "${mods}+${key}" {
|
||||
action = actions."${replaceStrings [ "$DIR" ] [ "${dir}" ] "${cmd}"}";
|
||||
}
|
||||
) keys;
|
||||
makeWsBind =
|
||||
mods: cmd:
|
||||
listToAttrs (
|
||||
map (num: {
|
||||
name = "${mods}+${builtins.toString num}";
|
||||
value = {
|
||||
action."${cmd}" = num;
|
||||
};
|
||||
}) (range 0 6)
|
||||
);
|
||||
in
|
||||
{
|
||||
"Mod+D".action.spawn = "sirula";
|
||||
"Mod+F".action.spawn = "firefox";
|
||||
"Mod+E".action.spawn = "nautilus";
|
||||
"Mod+Return".action.spawn = "kitty";
|
||||
"Mod+Shift+E".action.spawn = "wlogout";
|
||||
"Mod+Equal".action.spawn = "keepassxc";
|
||||
"Mod+Shift+Q".action = actions.close-window;
|
||||
"Mod+Shift+S".action = actions.screenshot;
|
||||
"Mod+R".action = actions.switch-preset-column-width;
|
||||
"Mod+Shift+R".action = actions.maximize-column;
|
||||
"XF86AudioRaiseVolume".action.spawn = [
|
||||
"volumectl"
|
||||
"-u"
|
||||
"up"
|
||||
];
|
||||
"XF86AudioLowerVolume".action.spawn = [
|
||||
"volumectl"
|
||||
"-u"
|
||||
"down"
|
||||
];
|
||||
"XF86AudioMute".action.spawn = [
|
||||
"volumectl"
|
||||
"toggle-mute"
|
||||
];
|
||||
"XF86AudioStop".action.spawn = [
|
||||
"playerctl"
|
||||
"stop"
|
||||
];
|
||||
"XF86AudioPlay".action.spawn = [
|
||||
"playerctl"
|
||||
"play-pause"
|
||||
];
|
||||
"XF86AudioNext".action.spawn = [
|
||||
"playerctl"
|
||||
"next"
|
||||
];
|
||||
"XF86AudioPrev".action.spawn = [
|
||||
"playerctl"
|
||||
"previous"
|
||||
];
|
||||
"Mod+Space".action = actions.toggle-window-floating;
|
||||
}
|
||||
// makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds
|
||||
// makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds
|
||||
// makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds
|
||||
// makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds
|
||||
// makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds
|
||||
// makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds
|
||||
// makeWsBind "Mod" "focus-workspace"
|
||||
// makeWsBind "Mod+Shift" "move-window-to-workspace";
|
||||
outputs = {
|
||||
# "Unknown-1".enable = false;
|
||||
"DP-1" = {
|
||||
transform.rotation = 90;
|
||||
scale = 1;
|
||||
};
|
||||
"DP-2" = {
|
||||
variable-refresh-rate = true;
|
||||
scale = 1;
|
||||
};
|
||||
};
|
||||
"HDMI-A-2" = {
|
||||
transform.rotation = 90;
|
||||
scale = 1;
|
||||
input = {
|
||||
warp-mouse-to-focus = true;
|
||||
};
|
||||
};
|
||||
input = {
|
||||
warp-mouse-to-focus = true;
|
||||
};
|
||||
cursor = {
|
||||
hide-after-inactive-ms = 5000;
|
||||
hide-when-typing = true;
|
||||
size = 16;
|
||||
theme = pkgs.rice.cursor.name;
|
||||
};
|
||||
layout = {
|
||||
always-center-single-column = true;
|
||||
gaps = 24;
|
||||
default-column-width.proportion = 0.5;
|
||||
preset-column-widths =
|
||||
map
|
||||
(p: {proportion = p;})
|
||||
[
|
||||
cursor = {
|
||||
hide-after-inactive-ms = 5000;
|
||||
hide-when-typing = true;
|
||||
size = 16;
|
||||
theme = pkgs.rice.cursor.name;
|
||||
};
|
||||
layout = {
|
||||
always-center-single-column = true;
|
||||
gaps = 24;
|
||||
default-column-width.proportion = 0.5;
|
||||
preset-column-widths = map (p: { proportion = p; }) [
|
||||
(2.0 / 3.0)
|
||||
0.5
|
||||
(1.0 / 3.0)
|
||||
];
|
||||
focus-ring = let
|
||||
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
in {
|
||||
active = {color = pal.bright.yellow;};
|
||||
inactive = {color = pal.normal.black;};
|
||||
focus-ring =
|
||||
let
|
||||
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
in
|
||||
{
|
||||
active = {
|
||||
color = pal.bright.yellow;
|
||||
};
|
||||
inactive = {
|
||||
color = pal.normal.black;
|
||||
};
|
||||
};
|
||||
};
|
||||
prefer-no-csd = true;
|
||||
hotkey-overlay.skip-at-startup = true;
|
||||
};
|
||||
prefer-no-csd = true;
|
||||
hotkey-overlay.skip-at-startup = true;
|
||||
};
|
||||
|
||||
programs.swaylock = {
|
||||
enable = true;
|
||||
settings.color = (pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette).normal.black;
|
||||
};
|
||||
|
||||
programs.ironbar = {
|
||||
enable = true;
|
||||
|
@ -178,20 +219,20 @@ in {
|
|||
}
|
||||
];
|
||||
end = [
|
||||
{type = "clock";}
|
||||
{type = "tray";}
|
||||
{ type = "clock"; }
|
||||
{ type = "tray"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.ironbar = {
|
||||
Unit.PartOf = ["graphical-session.target"];
|
||||
Unit.PartOf = [ "graphical-session.target" ];
|
||||
Unit.After = [
|
||||
"graphical-session.target"
|
||||
"niri.service"
|
||||
];
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
|
@ -211,17 +252,19 @@ in {
|
|||
term_command = "kitty {}"
|
||||
'';
|
||||
|
||||
"sirula/style.css".text = let
|
||||
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
in ''
|
||||
#root-box {
|
||||
background-color: ${pal.normal.black};
|
||||
color: ${pal.normal.yellow};
|
||||
font-family: '${pkgs.rice.fonts.sans.name}';
|
||||
}
|
||||
/* what's the name of the highlighted search text?
|
||||
color: ${pal.normal.white};
|
||||
*/
|
||||
'';
|
||||
"sirula/style.css".text =
|
||||
let
|
||||
pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
in
|
||||
''
|
||||
#root-box {
|
||||
background-color: ${pal.normal.black};
|
||||
color: ${pal.normal.yellow};
|
||||
font-family: '${pkgs.rice.fonts.sans.name}';
|
||||
}
|
||||
/* what's the name of the highlighted search text?
|
||||
color: ${pal.normal.white};
|
||||
*/
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
gtk-engine-murrine
|
||||
];
|
||||
|
@ -10,17 +11,19 @@
|
|||
platformTheme.name = "adwaita";
|
||||
};
|
||||
|
||||
gtk = with pkgs;
|
||||
with rice; {
|
||||
enable = true;
|
||||
theme = with gtk-theme; {
|
||||
inherit package name;
|
||||
gtk =
|
||||
with pkgs;
|
||||
with rice;
|
||||
{
|
||||
enable = true;
|
||||
theme = with gtk-theme; {
|
||||
inherit package name;
|
||||
};
|
||||
iconTheme = with icons; {
|
||||
inherit package name;
|
||||
};
|
||||
font = with fonts.sans; {
|
||||
inherit name size package;
|
||||
};
|
||||
};
|
||||
iconTheme = with icons; {
|
||||
inherit package name;
|
||||
};
|
||||
font = with fonts.sans; {
|
||||
inherit name size package;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
{config, ...}: {
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [
|
||||
../util/firefox-webapp.nix
|
||||
];
|
||||
programs.firefox.webapps = {
|
||||
"Syncthing" = {
|
||||
url = "http://127.0.0.1:8384";
|
||||
# id = 3;
|
||||
extraSettings = config.programs.firefox.profiles.default.settings;
|
||||
name = "Syncthing";
|
||||
icon = ../icons/syncthing.png;
|
||||
};
|
||||
"StudyTAFE" = {
|
||||
url = "https://www.studytafensw.edu.au";
|
||||
# id = 4;
|
||||
"Open-WebUI" = {
|
||||
url = "http://127.0.0.1:8088";
|
||||
extraSettings = config.programs.firefox.profiles.default.settings;
|
||||
name = "TAFE Study";
|
||||
icon = ../icons/tafe.jpg;
|
||||
name = "Open-WebUI";
|
||||
icon = ../icons/openwebui.png;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./home.nix
|
||||
];
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
port = 3021;
|
||||
in {
|
||||
imports = [./ollama.nix];
|
||||
in
|
||||
{
|
||||
imports = [ ./ollama.nix ];
|
||||
|
||||
localWebApps = {
|
||||
anything-llm = {
|
||||
|
@ -13,43 +15,50 @@ in {
|
|||
genericName = "Chatbot";
|
||||
icon = ../icons/anythingllm.png;
|
||||
inherit port;
|
||||
requires.containers = ["anything-llm" "ollama"];
|
||||
requires.containers = [
|
||||
"anything-llm"
|
||||
"ollama"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.podman.containers.anything-llm = let
|
||||
str = builtins.toString;
|
||||
username = config.mainUser;
|
||||
in {
|
||||
image = "docker.io/mintplexlabs/anythingllm";
|
||||
devices = ["nvidia.com/gpu=all"];
|
||||
ports = ["${str port}:3001"];
|
||||
autoStart = false;
|
||||
autoUpdate = "registry";
|
||||
network = ["ollama"];
|
||||
volumes = let
|
||||
home = "/home/${username}";
|
||||
share = "${home}/.local/share/anything-llm";
|
||||
in [
|
||||
"${share}:/app/server/storage"
|
||||
"${share}/.env:/app/server/.env"
|
||||
"${share}/config:/home/anythingllm/.config/anythingllm-desktop"
|
||||
"${share}/config:/home/${username}/.config/anythingllm-desktop"
|
||||
];
|
||||
environment = {
|
||||
STORAGE_DIR = "/app/server/storage";
|
||||
LLM_PROVIDER = "ollama";
|
||||
OLLAMA_BASE_PATH = "http://ollama:11434";
|
||||
EMBEDDING_ENGINE = "ollama";
|
||||
EMBEDDING_BASE_PATH = "http://ollama:11434";
|
||||
VECTOR_DB = "lancedb";
|
||||
WHISPER_PROVIDER = "local";
|
||||
TTS_PROVIDER = "native";
|
||||
services.podman.containers.anything-llm =
|
||||
let
|
||||
str = builtins.toString;
|
||||
username = config.mainUser;
|
||||
in
|
||||
{
|
||||
image = "docker.io/mintplexlabs/anythingllm";
|
||||
devices = [ "nvidia.com/gpu=all" ];
|
||||
ports = [ "${str port}:3001" ];
|
||||
autoStart = false;
|
||||
autoUpdate = "registry";
|
||||
network = [ "ollama" ];
|
||||
volumes =
|
||||
let
|
||||
home = "/home/${username}";
|
||||
share = "${home}/.local/share/anything-llm";
|
||||
in
|
||||
[
|
||||
"${share}:/app/server/storage"
|
||||
"${share}/.env:/app/server/.env"
|
||||
"${share}/config:/home/anythingllm/.config/anythingllm-desktop"
|
||||
"${share}/config:/home/${username}/.config/anythingllm-desktop"
|
||||
];
|
||||
environment = {
|
||||
STORAGE_DIR = "/app/server/storage";
|
||||
LLM_PROVIDER = "ollama";
|
||||
OLLAMA_BASE_PATH = "http://ollama:11434";
|
||||
EMBEDDING_ENGINE = "ollama";
|
||||
EMBEDDING_BASE_PATH = "http://ollama:11434";
|
||||
VECTOR_DB = "lancedb";
|
||||
WHISPER_PROVIDER = "local";
|
||||
TTS_PROVIDER = "native";
|
||||
};
|
||||
extraConfig.Unit.Requires = [ "podman-ollama.service" ];
|
||||
extraPodmanArgs = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/3001'")
|
||||
];
|
||||
};
|
||||
extraConfig.Unit.Requires = ["podman-ollama.service"];
|
||||
extraPodmanArgs = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/3001'")
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{...}: {
|
||||
_:
|
||||
{
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
officialAddon = name: {
|
||||
install_url = lib.strings.concatStrings ["https://addons.mozilla.org/firefox/downloads/latest/" name "/latest.xpi"];
|
||||
install_url = lib.strings.concatStrings [
|
||||
"https://addons.mozilla.org/firefox/downloads/latest/"
|
||||
name
|
||||
"/latest.xpi"
|
||||
];
|
||||
installation_mode = "force_installed";
|
||||
};
|
||||
lock-false = {
|
||||
|
@ -15,7 +19,8 @@
|
|||
Value = true;
|
||||
Status = "locked";
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
@ -3,16 +3,19 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette;
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
themes = with palette-hex; {
|
||||
nix-rice = {
|
||||
"attribute" = bright.cyan;
|
||||
"keyword" = {fg = normal.red;};
|
||||
"keyword" = {
|
||||
fg = normal.red;
|
||||
};
|
||||
"keyword.directive" = normal.red;
|
||||
"namespace" = bright.cyan;
|
||||
"punctuation" = bright.yellow;
|
||||
|
@ -27,29 +30,31 @@ in {
|
|||
"type.builtin" = normal.yellow;
|
||||
"constructor" = {
|
||||
fg = bright.magenta;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"function" = {
|
||||
fg = normal.green;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"function.macro" = bright.cyan;
|
||||
"function.builtin" = normal.yellow;
|
||||
"tag" = normal.red;
|
||||
"comment" = {
|
||||
fg = normal.magenta;
|
||||
modifiers = ["italic"];
|
||||
modifiers = [ "italic" ];
|
||||
};
|
||||
"constant" = {
|
||||
fg = bright.magenta;
|
||||
};
|
||||
"constant" = {fg = bright.magenta;};
|
||||
"constant.builtin" = {
|
||||
fg = bright.magenta;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"string" = normal.green;
|
||||
"constant.numeric" = bright.magenta;
|
||||
"constant.character.escape" = {
|
||||
fg = bright.white;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"label" = bright.cyan;
|
||||
"module" = bright.cyan;
|
||||
|
@ -60,64 +65,86 @@ in {
|
|||
"error" = bright.red;
|
||||
"info" = bright.cyan;
|
||||
"hint" = bright.blue;
|
||||
"ui.background" = {bg = util.bg;};
|
||||
"ui.linenr" = {fg = normal.cyan;};
|
||||
"ui.background" = {
|
||||
inherit (util) bg;
|
||||
};
|
||||
"ui.linenr" = {
|
||||
fg = normal.cyan;
|
||||
};
|
||||
"ui.linenr.selected" = {
|
||||
fg = normal.yellow;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"ui.cursorline" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.cursorline" = {bg = normal.black;};
|
||||
"ui.statusline" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.black;
|
||||
};
|
||||
"ui.statusline.normal" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.black;
|
||||
};
|
||||
"ui.statusline.insert" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = normal.blue;
|
||||
};
|
||||
"ui.statusline.select" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.yellow;
|
||||
};
|
||||
"ui.statusline.inactive" = {
|
||||
fg = normal.white;
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.popup" = {bg = normal.black;};
|
||||
"ui.window" = {bg = normal.black;};
|
||||
"ui.popup" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.window" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.help" = {
|
||||
bg = normal.black;
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
};
|
||||
"ui.text" = {
|
||||
inherit (util) fg;
|
||||
};
|
||||
"ui.text.focus" = {
|
||||
inherit (util) fg;
|
||||
};
|
||||
"ui.text" = {fg = util.fg;};
|
||||
"ui.text.focus" = {fg = util.fg;};
|
||||
"ui.selection" = {
|
||||
# modifiers = ["reversed"];
|
||||
bg = bright.yellow;
|
||||
};
|
||||
"ui.selection.primary" = {modifiers = ["reversed"];};
|
||||
"ui.selection.primary" = {
|
||||
modifiers = [ "reversed" ];
|
||||
};
|
||||
# "ui.selection.primary" = { bg = bright.cyan; };
|
||||
"ui.cursor.primary" = {
|
||||
bg = normal.white;
|
||||
fg = normal.black;
|
||||
};
|
||||
"ui.cursor.match" = {bg = bright.cyan;};
|
||||
"ui.cursor.match" = {
|
||||
bg = bright.cyan;
|
||||
};
|
||||
"ui.menu" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.black;
|
||||
};
|
||||
"ui.menu.selected" = {
|
||||
fg = bright.black;
|
||||
bg = bright.blue;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"ui.virtual.whitespace" = bright.black;
|
||||
"ui.virtual.ruler" = {bg = normal.black;};
|
||||
"ui.virtual.inlay-hint" = {fg = normal.magenta;};
|
||||
"ui.virtual.ruler" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.virtual.inlay-hint" = {
|
||||
fg = normal.magenta;
|
||||
};
|
||||
"diagnostic.warning" = {
|
||||
underline = {
|
||||
color = bright.yellow;
|
||||
|
@ -143,12 +170,18 @@ in {
|
|||
};
|
||||
};
|
||||
"markup.heading" = bright.cyan;
|
||||
"markup.bold" = {modifiers = ["bold"];};
|
||||
"markup.italic" = {modifiers = ["italic"];};
|
||||
"markup.strikethrough" = {modifiers = ["crossed_out"];};
|
||||
"markup.bold" = {
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"markup.italic" = {
|
||||
modifiers = [ "italic" ];
|
||||
};
|
||||
"markup.strikethrough" = {
|
||||
modifiers = [ "crossed_out" ];
|
||||
};
|
||||
"markup.link.url" = {
|
||||
fg = bright.green;
|
||||
modifiers = ["underlined"];
|
||||
modifiers = [ "underlined" ];
|
||||
};
|
||||
"markup.link.text" = bright.red;
|
||||
"markup.raw" = bright.red;
|
||||
|
@ -184,17 +217,28 @@ in {
|
|||
normal = "block";
|
||||
select = "underline";
|
||||
};
|
||||
statusline.left = ["mode" "spinner" "version-control" "file-name" "file-modification-indicator"];
|
||||
statusline.left = [
|
||||
"mode"
|
||||
"spinner"
|
||||
"version-control"
|
||||
"file-name"
|
||||
"file-modification-indicator"
|
||||
];
|
||||
lsp.display-messages = true;
|
||||
keys = let
|
||||
extend = {
|
||||
"A-x" = "extend_to_line_bounds";
|
||||
"X" = ["extend_line_up" "extend_to_line_bounds"];
|
||||
keys =
|
||||
let
|
||||
extend = {
|
||||
"A-x" = "extend_to_line_bounds";
|
||||
"X" = [
|
||||
"extend_line_up"
|
||||
"extend_to_line_bounds"
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
normal = extend;
|
||||
select = extend;
|
||||
};
|
||||
in {
|
||||
normal = extend;
|
||||
select = extend;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -202,13 +246,19 @@ in {
|
|||
language = [
|
||||
{
|
||||
name = "rust";
|
||||
language-servers = ["rust-analyzer" "lsp-ai"];
|
||||
language-servers = [
|
||||
"rust-analyzer"
|
||||
"lsp-ai"
|
||||
];
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "nix";
|
||||
language-servers = ["nixd" "lsp-ai"];
|
||||
file-types = ["nix"];
|
||||
language-servers = [
|
||||
"nixd"
|
||||
"lsp-ai"
|
||||
];
|
||||
file-types = [ "nix" ];
|
||||
# auto-format = true;
|
||||
formatter = {
|
||||
command = "alejandra";
|
||||
|
@ -216,8 +266,14 @@ in {
|
|||
}
|
||||
{
|
||||
name = "ocaml";
|
||||
language-servers = ["ocamllsp" "lsp-ai"];
|
||||
file-types = ["ml" "mli"];
|
||||
language-servers = [
|
||||
"ocamllsp"
|
||||
"lsp-ai"
|
||||
];
|
||||
file-types = [
|
||||
"ml"
|
||||
"mli"
|
||||
];
|
||||
auto-format = true;
|
||||
formatter = {
|
||||
command = "ocamlformat";
|
||||
|
@ -233,7 +289,7 @@ in {
|
|||
lsp-ai = {
|
||||
command = "lsp-ai";
|
||||
config = {
|
||||
memory.fileStore = {};
|
||||
memory.fileStore = { };
|
||||
models = {
|
||||
llama32 = {
|
||||
type = "ollama";
|
||||
|
@ -285,7 +341,7 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
}; #language-server
|
||||
}; #languages
|
||||
}; #helix config
|
||||
}; # language-server
|
||||
}; # languages
|
||||
}; # helix config
|
||||
}
|
||||
|
|
|
@ -3,16 +3,19 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette;
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
themes = with palette-hex; {
|
||||
nix-rice = {
|
||||
"attribute" = bright.cyan;
|
||||
"keyword" = {fg = normal.red;};
|
||||
"keyword" = {
|
||||
fg = normal.red;
|
||||
};
|
||||
"keyword.directive" = normal.red;
|
||||
"namespace" = bright.cyan;
|
||||
"punctuation" = bright.yellow;
|
||||
|
@ -27,29 +30,31 @@ in {
|
|||
"type.builtin" = normal.yellow;
|
||||
"constructor" = {
|
||||
fg = bright.magenta;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"function" = {
|
||||
fg = normal.green;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"function.macro" = bright.cyan;
|
||||
"function.builtin" = normal.yellow;
|
||||
"tag" = normal.red;
|
||||
"comment" = {
|
||||
fg = normal.magenta;
|
||||
modifiers = ["italic"];
|
||||
modifiers = [ "italic" ];
|
||||
};
|
||||
"constant" = {
|
||||
fg = bright.magenta;
|
||||
};
|
||||
"constant" = {fg = bright.magenta;};
|
||||
"constant.builtin" = {
|
||||
fg = bright.magenta;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"string" = normal.green;
|
||||
"constant.numeric" = bright.magenta;
|
||||
"constant.character.escape" = {
|
||||
fg = bright.white;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"label" = bright.cyan;
|
||||
"module" = bright.cyan;
|
||||
|
@ -60,64 +65,86 @@ in {
|
|||
"error" = bright.red;
|
||||
"info" = bright.cyan;
|
||||
"hint" = bright.blue;
|
||||
"ui.background" = {bg = util.bg;};
|
||||
"ui.linenr" = {fg = normal.cyan;};
|
||||
"ui.background" = {
|
||||
inherit (util) bg;
|
||||
};
|
||||
"ui.linenr" = {
|
||||
fg = normal.cyan;
|
||||
};
|
||||
"ui.linenr.selected" = {
|
||||
fg = normal.yellow;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"ui.cursorline" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.cursorline" = {bg = normal.black;};
|
||||
"ui.statusline" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.black;
|
||||
};
|
||||
"ui.statusline.normal" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.black;
|
||||
};
|
||||
"ui.statusline.insert" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = normal.blue;
|
||||
};
|
||||
"ui.statusline.select" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.yellow;
|
||||
};
|
||||
"ui.statusline.inactive" = {
|
||||
fg = normal.white;
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.popup" = {bg = normal.black;};
|
||||
"ui.window" = {bg = normal.black;};
|
||||
"ui.popup" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.window" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.help" = {
|
||||
bg = normal.black;
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
};
|
||||
"ui.text" = {
|
||||
inherit (util) fg;
|
||||
};
|
||||
"ui.text.focus" = {
|
||||
inherit (util) fg;
|
||||
};
|
||||
"ui.text" = {fg = util.fg;};
|
||||
"ui.text.focus" = {fg = util.fg;};
|
||||
"ui.selection" = {
|
||||
# modifiers = ["reversed"];
|
||||
bg = bright.yellow;
|
||||
};
|
||||
"ui.selection.primary" = {modifiers = ["reversed"];};
|
||||
"ui.selection.primary" = {
|
||||
modifiers = [ "reversed" ];
|
||||
};
|
||||
# "ui.selection.primary" = { bg = bright.cyan; };
|
||||
"ui.cursor.primary" = {
|
||||
bg = normal.white;
|
||||
fg = normal.black;
|
||||
};
|
||||
"ui.cursor.match" = {bg = bright.cyan;};
|
||||
"ui.cursor.match" = {
|
||||
bg = bright.cyan;
|
||||
};
|
||||
"ui.menu" = {
|
||||
fg = util.fg;
|
||||
inherit (util) fg;
|
||||
bg = bright.black;
|
||||
};
|
||||
"ui.menu.selected" = {
|
||||
fg = bright.black;
|
||||
bg = bright.blue;
|
||||
modifiers = ["bold"];
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"ui.virtual.whitespace" = bright.black;
|
||||
"ui.virtual.ruler" = {bg = normal.black;};
|
||||
"ui.virtual.inlay-hint" = {fg = normal.magenta;};
|
||||
"ui.virtual.ruler" = {
|
||||
bg = normal.black;
|
||||
};
|
||||
"ui.virtual.inlay-hint" = {
|
||||
fg = normal.magenta;
|
||||
};
|
||||
"diagnostic.warning" = {
|
||||
underline = {
|
||||
color = bright.yellow;
|
||||
|
@ -143,12 +170,18 @@ in {
|
|||
};
|
||||
};
|
||||
"markup.heading" = bright.cyan;
|
||||
"markup.bold" = {modifiers = ["bold"];};
|
||||
"markup.italic" = {modifiers = ["italic"];};
|
||||
"markup.strikethrough" = {modifiers = ["crossed_out"];};
|
||||
"markup.bold" = {
|
||||
modifiers = [ "bold" ];
|
||||
};
|
||||
"markup.italic" = {
|
||||
modifiers = [ "italic" ];
|
||||
};
|
||||
"markup.strikethrough" = {
|
||||
modifiers = [ "crossed_out" ];
|
||||
};
|
||||
"markup.link.url" = {
|
||||
fg = bright.green;
|
||||
modifiers = ["underlined"];
|
||||
modifiers = [ "underlined" ];
|
||||
};
|
||||
"markup.link.text" = bright.red;
|
||||
"markup.raw" = bright.red;
|
||||
|
@ -168,7 +201,13 @@ in {
|
|||
normal = "block";
|
||||
select = "underline";
|
||||
};
|
||||
statusline.left = ["mode" "spinner" "version-control" "file-name" "file-modification-indicator"];
|
||||
statusline.left = [
|
||||
"mode"
|
||||
"spinner"
|
||||
"version-control"
|
||||
"file-name"
|
||||
"file-modification-indicator"
|
||||
];
|
||||
lsp.display-messages = true;
|
||||
# keys = let
|
||||
# extend = {
|
||||
|
@ -186,15 +225,15 @@ in {
|
|||
language = [
|
||||
{
|
||||
name = "rust";
|
||||
language-servers = ["rust-analyzer"];
|
||||
language-servers = [ "rust-analyzer" ];
|
||||
}
|
||||
{
|
||||
name = "nix";
|
||||
language-servers = ["nil"];
|
||||
file-types = ["nix"];
|
||||
# auto-format = true;
|
||||
language-servers = [ "nil" ];
|
||||
file-types = [ "nix" ];
|
||||
auto-format = true;
|
||||
formatter = {
|
||||
command = "alejandra";
|
||||
command = "nixfmt";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
@ -219,7 +258,7 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
}; #language-server
|
||||
}; #languages
|
||||
}; #helix config
|
||||
}; # language-server
|
||||
}; # languages
|
||||
}; # helix config
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette;
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.kitty = with pkgs.rice; {
|
||||
enable = true;
|
||||
font = with fonts; {
|
||||
name = monospace.name;
|
||||
size = monospace.size;
|
||||
inherit (monospace) name;
|
||||
inherit (monospace) size;
|
||||
};
|
||||
settings = with palette-hex; {
|
||||
foreground = util.fg;
|
||||
background = util.bg;
|
||||
cursor = util.cursor;
|
||||
inherit (util) cursor;
|
||||
cursor_text = util.bg;
|
||||
selection_foreground = util.fg_sel;
|
||||
selection_background = util.bg_sel;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.murex = {
|
||||
enable = true;
|
||||
direnv = true;
|
||||
|
@ -60,25 +61,28 @@
|
|||
|
||||
fresh
|
||||
'';
|
||||
plugins = let
|
||||
inherit
|
||||
(pkgs)
|
||||
plugins =
|
||||
let
|
||||
inherit (pkgs)
|
||||
murex-jump
|
||||
murex-starship
|
||||
;
|
||||
in
|
||||
[
|
||||
murex-jump
|
||||
murex-starship
|
||||
;
|
||||
in [
|
||||
murex-jump
|
||||
murex-starship
|
||||
];
|
||||
];
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home.packages = let
|
||||
inherit (pkgs) jump;
|
||||
in [
|
||||
jump
|
||||
];
|
||||
home.packages =
|
||||
let
|
||||
inherit (pkgs) jump;
|
||||
in
|
||||
[
|
||||
jump
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,71 +3,76 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
xdg.desktopEntries.ollama = {
|
||||
name = "Ollama";
|
||||
type = "Application";
|
||||
icon = ../icons/ollama.png;
|
||||
exec = let
|
||||
inherit (lib) getExe getExe';
|
||||
notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"Ollama\"";
|
||||
systemctl = "${getExe' pkgs.systemd "systemctl"}";
|
||||
podman = "${getExe pkgs.podman}";
|
||||
in "${pkgs.writeShellScript "ollama" ''
|
||||
set -euo pipefail
|
||||
exec =
|
||||
let
|
||||
inherit (lib) getExe getExe';
|
||||
notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"Ollama\"";
|
||||
systemctl = "${getExe' pkgs.systemd "systemctl"}";
|
||||
podman = "${getExe pkgs.podman}";
|
||||
in
|
||||
"${pkgs.writeShellScript "ollama" ''
|
||||
set -euo pipefail
|
||||
|
||||
exit_error() {
|
||||
${notify-send} -w "Failure" $1
|
||||
exit 1
|
||||
}
|
||||
exit_error() {
|
||||
${notify-send} -w "Failure" $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
container_checks() {
|
||||
if [ "$(${podman} inspect -f {{.State.Health.Status}} ollama)" == "healthy" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
container_checks() {
|
||||
if [ "$(${podman} inspect -f {{.State.Health.Status}} ollama)" == "healthy" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
${notify-send} "Launching Ollama.." "Please be patient."
|
||||
${notify-send} "Launching Ollama.." "Please be patient."
|
||||
|
||||
${systemctl} --user start podman-ollama
|
||||
checks=0
|
||||
until container_checks; do
|
||||
sleep 2
|
||||
checks=$((checks+1))
|
||||
if [ $((checks%10)) -eq 0 ]; then
|
||||
${notify-send} "Launching.."
|
||||
fi
|
||||
if [ $checks -ge 60 ]; then
|
||||
${systemctl} --no-block --user stop podman-ollama.target
|
||||
exit_error "Failed to launch!"
|
||||
fi
|
||||
done
|
||||
${systemctl} --user start podman-ollama
|
||||
checks=0
|
||||
until container_checks; do
|
||||
sleep 2
|
||||
checks=$((checks+1))
|
||||
if [ $((checks%10)) -eq 0 ]; then
|
||||
${notify-send} "Launching.."
|
||||
fi
|
||||
if [ $checks -ge 60 ]; then
|
||||
${systemctl} --no-block --user stop podman-ollama.target
|
||||
exit_error "Failed to launch!"
|
||||
fi
|
||||
done
|
||||
|
||||
${notify-send} "Ollama serving on port 11434."
|
||||
''}";
|
||||
${notify-send} "Ollama serving on port 11434."
|
||||
''}";
|
||||
};
|
||||
|
||||
services.podman = {
|
||||
containers.ollama = let
|
||||
username = config.mainUser;
|
||||
in {
|
||||
image = "docker.io/ollama/ollama:latest";
|
||||
devices = ["nvidia.com/gpu=all"];
|
||||
autoStart = false;
|
||||
autoUpdate = "registry";
|
||||
network = ["ollama"];
|
||||
ports = ["11434:11434"];
|
||||
volumes = [
|
||||
"/home/${username}/.local/share/ollama:/models"
|
||||
];
|
||||
environment.OLLAMA_MODELS = "/models";
|
||||
extraPodmanArgs = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/11434'")
|
||||
];
|
||||
};
|
||||
containers.ollama =
|
||||
let
|
||||
username = config.mainUser;
|
||||
in
|
||||
{
|
||||
image = "docker.io/ollama/ollama:latest";
|
||||
devices = [ "nvidia.com/gpu=all" ];
|
||||
autoStart = false;
|
||||
autoUpdate = "registry";
|
||||
network = [ "ollama" ];
|
||||
ports = [ "11434:11434" ];
|
||||
volumes = [
|
||||
"/home/${username}/.local/share/ollama:/models"
|
||||
];
|
||||
environment.OLLAMA_MODELS = "/models";
|
||||
extraPodmanArgs = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/11434'")
|
||||
];
|
||||
};
|
||||
|
||||
networks.ollama = {
|
||||
subnet = "192.168.10.0/24";
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
port = 3021;
|
||||
in {
|
||||
imports = [./ollama.nix];
|
||||
in
|
||||
{
|
||||
imports = [ ./ollama.nix ];
|
||||
|
||||
localWebApps = {
|
||||
openwebui = {
|
||||
|
@ -13,28 +14,35 @@ in {
|
|||
genericName = "LLM";
|
||||
icon = ../icons/openwebui.png;
|
||||
inherit port;
|
||||
requires.containers = ["openwebui" "ollama"];
|
||||
requires.containers = [
|
||||
"openwebui"
|
||||
"ollama"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.podman = {
|
||||
containers.openwebui = let
|
||||
str = builtins.toString;
|
||||
in {
|
||||
# serviceName = "openwebui";
|
||||
image = "ghcr.io/open-webui/open-webui:main";
|
||||
ports = ["${str port}:${str port}"];
|
||||
environment = {
|
||||
WEBUI_AUTH = "False";
|
||||
PORT = "${str port}";
|
||||
containers.openwebui =
|
||||
let
|
||||
str = builtins.toString;
|
||||
in
|
||||
{
|
||||
# serviceName = "openwebui";
|
||||
image = "ghcr.io/open-webui/open-webui:main";
|
||||
ports = [ "${str port}:${str port}" ];
|
||||
environment = {
|
||||
WEBUI_AUTH = "False";
|
||||
PORT = "${str port}";
|
||||
};
|
||||
autoStart = false;
|
||||
networks = [ "ollama" ];
|
||||
unitConfig = {
|
||||
Requires = [ "podman-ollama.service" ];
|
||||
};
|
||||
extraOptions = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/${str port}'")
|
||||
];
|
||||
};
|
||||
autoStart = false;
|
||||
networks = ["ollama"];
|
||||
unitConfig = {Requires = ["podman-ollama.service"];};
|
||||
extraOptions = [
|
||||
"--health-cmd"
|
||||
(lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/${str port}'")
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe;
|
||||
inherit (config.home) homeDirectory;
|
||||
in {
|
||||
}:
|
||||
{
|
||||
localWebApps = {
|
||||
stable-diffusion = {
|
||||
name = "Stable Diffusion";
|
||||
|
@ -14,7 +11,7 @@ in {
|
|||
icon = ../icons/comfyui.png;
|
||||
id = 5;
|
||||
port = 7860;
|
||||
requires = ["stable-diffusion"];
|
||||
requires = [ "stable-diffusion" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
extensions = with pkgs.vscode-extensions; [
|
||||
extensions = with inputs.nix-vscode.extensions.x86_64-linux.vscode-marketplace; [
|
||||
rust-lang.rust-analyzer
|
||||
serayuzgur.crates
|
||||
ocamllabs.ocaml-platform
|
||||
jnoortheen.nix-ide
|
||||
# arrterian.nix-env-selector
|
||||
mkhl.direnv
|
||||
continue.continue
|
||||
# silverquark.dancehelix
|
||||
# gregoire.dance
|
||||
barbosshack.crates-io
|
||||
vadimcn.vscode-lldb
|
||||
kamadorueda.alejandra
|
||||
kend.dancehelixkey
|
||||
hikionori.kanagawa-vscode-theme
|
||||
];
|
||||
mutableExtensionsDir = true;
|
||||
mutableExtensionsDir = false;
|
||||
userSettings = {
|
||||
"window.titleBarStyle" = "custom";
|
||||
"editor.fontFamily" = "${pkgs.rice.fonts.monospace.name}";
|
||||
|
|
|
@ -1,39 +1,43 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.wlogout = {
|
||||
enable = true;
|
||||
package = pkgs.wleave;
|
||||
layout = builtins.fromJSON (builtins.readFile ../dots/wlogout/layout);
|
||||
style = with palette-hex; (builtins.replaceStrings
|
||||
[
|
||||
"/usr/share/wlogout"
|
||||
"/etc/wlogout"
|
||||
"#WINBG"
|
||||
"#BTNCOL"
|
||||
"#BTNBG"
|
||||
"#BTNFOCUSBG"
|
||||
"#WINLOGO"
|
||||
]
|
||||
[
|
||||
"${pkgs.wlogout}/share/wlogout"
|
||||
"${pkgs.wlogout}/etc/wlogout"
|
||||
util.bg
|
||||
bright.yellow
|
||||
util.bg
|
||||
normal.black
|
||||
(builtins.path {
|
||||
name = "winlogo";
|
||||
path = ../icons/winlogo.png;
|
||||
sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108";
|
||||
})
|
||||
]
|
||||
(builtins.readFile ../dots/wlogout/style.css));
|
||||
style =
|
||||
with palette-hex;
|
||||
(builtins.replaceStrings
|
||||
[
|
||||
"/usr/share/wlogout"
|
||||
"/etc/wlogout"
|
||||
"#WINBG"
|
||||
"#BTNCOL"
|
||||
"#BTNBG"
|
||||
"#BTNFOCUSBG"
|
||||
"#WINLOGO"
|
||||
]
|
||||
[
|
||||
"${pkgs.wlogout}/share/wlogout"
|
||||
"${pkgs.wlogout}/etc/wlogout"
|
||||
util.bg
|
||||
bright.yellow
|
||||
util.bg
|
||||
normal.black
|
||||
(builtins.path {
|
||||
name = "winlogo";
|
||||
path = ../icons/winlogo.png;
|
||||
sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108";
|
||||
})
|
||||
]
|
||||
(builtins.readFile ../dots/wlogout/style.css)
|
||||
);
|
||||
};
|
||||
# xdg.configFile = {
|
||||
# "wleave/layout".text = builtins.readFile ../dots/wlogout/layout;
|
||||
|
@ -63,5 +67,5 @@ in {
|
|||
# (builtins.readFile ../dots/wlogout/style.css));
|
||||
# };
|
||||
|
||||
home.packages = [pkgs.wlogout];
|
||||
home.packages = [ pkgs.wlogout ];
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) getExe;
|
||||
inherit (config.home) homeDirectory;
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
in {
|
||||
in
|
||||
{
|
||||
ezOneShots = with pkgs; {
|
||||
xrdb = "${getExe xorg.xrdb} -load ${homeDirectory}/.Xresources";
|
||||
};
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette;
|
||||
in {
|
||||
}:
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestion.enable = true;
|
||||
|
|
|
@ -3,363 +3,382 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
containerOptions = {...}: {
|
||||
options = {
|
||||
pullPolicy = mkOption {
|
||||
type = with types; str;
|
||||
description = "Podman container pulling policy";
|
||||
default = "newer";
|
||||
};
|
||||
image = mkOption {
|
||||
type = with types; str;
|
||||
description = "OCI image to run.";
|
||||
example = "library/hello-world";
|
||||
};
|
||||
|
||||
imageFile = mkOption {
|
||||
type = with types; nullOr package;
|
||||
default = null;
|
||||
description = ''
|
||||
Path to an image file to load before running the image. This can
|
||||
be used to bypass pulling the image from the registry.
|
||||
|
||||
The `image` attribute must match the name and
|
||||
tag of the image contained in this file, as they will be used to
|
||||
run the container with that image. If they do not match, the
|
||||
image will be pulled from the registry as usual.
|
||||
'';
|
||||
example = literalExpression "pkgs.dockerTools.buildImage {...};";
|
||||
};
|
||||
|
||||
login = {
|
||||
username = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Username for login.";
|
||||
}:
|
||||
let
|
||||
containerOptions =
|
||||
_:
|
||||
{
|
||||
options = {
|
||||
pullPolicy = mkOption {
|
||||
type = with types; str;
|
||||
description = "Podman container pulling policy";
|
||||
default = "newer";
|
||||
};
|
||||
image = mkOption {
|
||||
type = with types; str;
|
||||
description = "OCI image to run.";
|
||||
example = "library/hello-world";
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = with types; nullOr str;
|
||||
imageFile = mkOption {
|
||||
type = with types; nullOr package;
|
||||
default = null;
|
||||
description = "Path to file containing password.";
|
||||
example = "/etc/nixos/dockerhub-password.txt";
|
||||
description = ''
|
||||
Path to an image file to load before running the image. This can
|
||||
be used to bypass pulling the image from the registry.
|
||||
|
||||
The `image` attribute must match the name and
|
||||
tag of the image contained in this file, as they will be used to
|
||||
run the container with that image. If they do not match, the
|
||||
image will be pulled from the registry as usual.
|
||||
'';
|
||||
example = literalExpression "pkgs.dockerTools.buildImage {...};";
|
||||
};
|
||||
|
||||
registry = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Registry where to login to.";
|
||||
example = "https://docker.pkg.github.com";
|
||||
login = {
|
||||
username = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Username for login.";
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Path to file containing password.";
|
||||
example = "/etc/nixos/dockerhub-password.txt";
|
||||
};
|
||||
|
||||
registry = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Registry where to login to.";
|
||||
example = "https://docker.pkg.github.com";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
description = "Commandline arguments to pass to the image's entrypoint.";
|
||||
example = literalExpression ''
|
||||
["--port=9000"]
|
||||
'';
|
||||
};
|
||||
cmd = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = "Commandline arguments to pass to the image's entrypoint.";
|
||||
example = literalExpression ''
|
||||
["--port=9000"]
|
||||
'';
|
||||
};
|
||||
|
||||
labels = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
description = "Labels to attach to the container at runtime.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
"traefik.https.routers.example.rule" = "Host(`example.container`)";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
entrypoint = mkOption {
|
||||
type = with types; nullOr str;
|
||||
description = "Override the default entrypoint of the image.";
|
||||
default = null;
|
||||
example = "/bin/my-app";
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
description = "Environment variables to set for this container.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
DATABASE_HOST = "db.example.com";
|
||||
DATABASE_PORT = "3306";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
environmentFiles = mkOption {
|
||||
type = with types; listOf path;
|
||||
default = [];
|
||||
description = "Environment files for this container.";
|
||||
example = literalExpression ''
|
||||
[
|
||||
/path/to/.env
|
||||
/path/to/.env.secret
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
log-driver = mkOption {
|
||||
type = types.str;
|
||||
default = "journald";
|
||||
description = ''
|
||||
Logging driver for the container. The default of
|
||||
`"journald"` means that the container's logs will be
|
||||
handled as part of the systemd unit.
|
||||
|
||||
For more details and a full list of logging drivers, refer to podman documentation.
|
||||
|
||||
For Docker:
|
||||
[Docker engine documentation](https://docs.docker.com/engine/reference/run/#logging-drivers---log-driver)
|
||||
|
||||
For Podman:
|
||||
Refer to the docker-run(1) man page.
|
||||
'';
|
||||
};
|
||||
|
||||
ports = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Network ports to publish from the container to the outer host.
|
||||
|
||||
Valid formats:
|
||||
- `<ip>:<hostPort>:<containerPort>`
|
||||
- `<ip>::<containerPort>`
|
||||
- `<hostPort>:<containerPort>`
|
||||
- `<containerPort>`
|
||||
|
||||
Both `hostPort` and `containerPort` can be specified as a range of
|
||||
ports. When specifying ranges for both, the number of container
|
||||
ports in the range must match the number of host ports in the
|
||||
range. Example: `1234-1236:1234-1236/tcp`
|
||||
|
||||
When specifying a range for `hostPort` only, the `containerPort`
|
||||
must *not* be a range. In this case, the container port is published
|
||||
somewhere within the specified `hostPort` range.
|
||||
Example: `1234-1236:1234/tcp`
|
||||
|
||||
Refer to the
|
||||
[Docker engine documentation](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) for full details.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
"8080:9000"
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Override the username or UID (and optionally groupname or GID) used
|
||||
in the container.
|
||||
'';
|
||||
example = "nobody:nogroup";
|
||||
};
|
||||
|
||||
volumes = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
List of volumes to attach to this container.
|
||||
|
||||
Note that this is a list of `"src:dst"` strings to
|
||||
allow for `src` to refer to `/nix/store` paths, which
|
||||
would be difficult with an attribute set. There are
|
||||
also a variety of mount options available as a third
|
||||
field; please refer to the
|
||||
[docker engine documentation](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) for details.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
"volume_name:/path/inside/container"
|
||||
"/path/on/host:/path/inside/container"
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
workdir = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Override the default working directory for the container.";
|
||||
example = "/var/lib/hello_world";
|
||||
};
|
||||
|
||||
dependsOn = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Define which other containers this one depends on. They will be added to both After and Requires for the unit.
|
||||
|
||||
Use the same name as the attribute under `virtualisation.oci-containers.containers`.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
containers = {
|
||||
node1 = {};
|
||||
node2 = {
|
||||
dependsOn = [ "node1" ];
|
||||
labels = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
description = "Labels to attach to the container at runtime.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
"traefik.https.routers.example.rule" = "Host(`example.container`)";
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
entrypoint = mkOption {
|
||||
type = with types; nullOr str;
|
||||
description = "Override the default entrypoint of the image.";
|
||||
default = null;
|
||||
example = "/bin/my-app";
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
description = "Environment variables to set for this container.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
DATABASE_HOST = "db.example.com";
|
||||
DATABASE_PORT = "3306";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
environmentFiles = mkOption {
|
||||
type = with types; listOf path;
|
||||
default = [ ];
|
||||
description = "Environment files for this container.";
|
||||
example = literalExpression ''
|
||||
[
|
||||
/path/to/.env
|
||||
/path/to/.env.secret
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
log-driver = mkOption {
|
||||
type = types.str;
|
||||
default = "journald";
|
||||
description = ''
|
||||
Logging driver for the container. The default of
|
||||
`"journald"` means that the container's logs will be
|
||||
handled as part of the systemd unit.
|
||||
|
||||
For more details and a full list of logging drivers, refer to podman documentation.
|
||||
|
||||
For Docker:
|
||||
[Docker engine documentation](https://docs.docker.com/engine/reference/run/#logging-drivers---log-driver)
|
||||
|
||||
For Podman:
|
||||
Refer to the docker-run(1) man page.
|
||||
'';
|
||||
};
|
||||
|
||||
ports = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Network ports to publish from the container to the outer host.
|
||||
|
||||
Valid formats:
|
||||
- `<ip>:<hostPort>:<containerPort>`
|
||||
- `<ip>::<containerPort>`
|
||||
- `<hostPort>:<containerPort>`
|
||||
- `<containerPort>`
|
||||
|
||||
Both `hostPort` and `containerPort` can be specified as a range of
|
||||
ports. When specifying ranges for both, the number of container
|
||||
ports in the range must match the number of host ports in the
|
||||
range. Example: `1234-1236:1234-1236/tcp`
|
||||
|
||||
When specifying a range for `hostPort` only, the `containerPort`
|
||||
must *not* be a range. In this case, the container port is published
|
||||
somewhere within the specified `hostPort` range.
|
||||
Example: `1234-1236:1234/tcp`
|
||||
|
||||
Refer to the
|
||||
[Docker engine documentation](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) for full details.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
"8080:9000"
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Override the username or UID (and optionally groupname or GID) used
|
||||
in the container.
|
||||
'';
|
||||
example = "nobody:nogroup";
|
||||
};
|
||||
|
||||
volumes = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of volumes to attach to this container.
|
||||
|
||||
Note that this is a list of `"src:dst"` strings to
|
||||
allow for `src` to refer to `/nix/store` paths, which
|
||||
would be difficult with an attribute set. There are
|
||||
also a variety of mount options available as a third
|
||||
field; please refer to the
|
||||
[docker engine documentation](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) for details.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
"volume_name:/path/inside/container"
|
||||
"/path/on/host:/path/inside/container"
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
workdir = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "Override the default working directory for the container.";
|
||||
example = "/var/lib/hello_world";
|
||||
};
|
||||
|
||||
dependsOn = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Define which other containers this one depends on. They will be added to both After and Requires for the unit.
|
||||
|
||||
Use the same name as the attribute under `virtualisation.oci-containers.containers`.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
containers = {
|
||||
node1 = {};
|
||||
node2 = {
|
||||
dependsOn = [ "node1" ];
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
hostname = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "The hostname of the container.";
|
||||
example = "hello-world";
|
||||
};
|
||||
|
||||
preRunExtraOptions = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = "Extra options for podman that go before the `run` argument.";
|
||||
example = [
|
||||
"--runtime"
|
||||
"runsc"
|
||||
];
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = "Extra options for podman run`.";
|
||||
example = literalExpression ''
|
||||
["--network=host"]
|
||||
'';
|
||||
};
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
When enabled, the container is automatically started on boot.
|
||||
If this option is set to false, the container has to be started on-demand via its service.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mkService =
|
||||
name: container:
|
||||
let
|
||||
podman = lib.getExe pkgs.podman;
|
||||
rm = lib.getExe' pkgs.coreutils "rm";
|
||||
printf = lib.getExe' pkgs.coreutils "printf";
|
||||
getId = ''"$(${lib.getExe' pkgs.coreutils "id"} -u)"'';
|
||||
dependsOn = map (x: "podman-${x}.service") container.dependsOn;
|
||||
escapedName = lib.escapeShellArg name;
|
||||
preStartScript = pkgs.writeShellApplication {
|
||||
name = "pre-start";
|
||||
runtimeInputs = [ ];
|
||||
text = ''
|
||||
${printf} "Running pre-start script.."
|
||||
${podman} rm -f ${name} || true
|
||||
${lib.optionalString (container.imageFile != null) ''
|
||||
${podman} load -i ${container.imageFile}
|
||||
''}
|
||||
${rm} -f /run/user/${getId}/podman-${escapedName}.ctr-id
|
||||
${printf} " success.\nStarting Podman...\n"
|
||||
'';
|
||||
};
|
||||
script = concatStringsSep " \\\n " (
|
||||
[
|
||||
"exec ${podman} "
|
||||
]
|
||||
++ map escapeShellArg container.preRunExtraOptions
|
||||
++ [
|
||||
"run"
|
||||
"--log-level=debug"
|
||||
"--rm"
|
||||
"--name=${escapedName}"
|
||||
"--log-driver=${container.log-driver}"
|
||||
]
|
||||
++ optional (container.entrypoint != null) "--entrypoint=${escapeShellArg container.entrypoint}"
|
||||
++ optional (container.hostname != null) "--hostname=${escapeShellArg container.hostname}"
|
||||
++ optional (container.pullPolicy != null) "--pull=${container.pullPolicy}"
|
||||
++ [
|
||||
"--cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id"
|
||||
# "--sdnotify=ignore"
|
||||
"--cgroups=no-conmon"
|
||||
"--sdnotify=conmon"
|
||||
"-d"
|
||||
"--replace"
|
||||
]
|
||||
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
|
||||
++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
|
||||
++ map (p: "-p ${escapeShellArg p}") container.ports
|
||||
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
|
||||
++ map (v: "-v ${escapeShellArg v}") container.volumes
|
||||
++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels)
|
||||
++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
|
||||
++ map escapeShellArg container.extraOptions
|
||||
++ [ container.image ]
|
||||
++ map escapeShellArg container.cmd
|
||||
);
|
||||
|
||||
hostname = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "The hostname of the container.";
|
||||
example = "hello-world";
|
||||
inherit (lib)
|
||||
concatStringsSep
|
||||
escapeShellArg
|
||||
optional
|
||||
mapAttrsToList
|
||||
;
|
||||
in
|
||||
{
|
||||
Unit = {
|
||||
WantedBy = lib.optional container.autoStart "default.target"; # graphical-session instead maybe?
|
||||
After = dependsOn;
|
||||
Requires = dependsOn;
|
||||
# StopWhenUnneeded = true;
|
||||
};
|
||||
# TODO make network target..
|
||||
# wants = lib.optional (container.imageFile == null) "network-online.target";
|
||||
# after = lib.optionals (container.imageFile == null) [ "network-online.target" ]
|
||||
# ++ dependsOn;
|
||||
# environment = proxy_env;
|
||||
|
||||
preRunExtraOptions = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
description = "Extra options for podman that go before the `run` argument.";
|
||||
example = ["--runtime" "runsc"];
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
description = "Extra options for podman run`.";
|
||||
example = literalExpression ''
|
||||
["--network=host"]
|
||||
'';
|
||||
};
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
When enabled, the container is automatically started on boot.
|
||||
If this option is set to false, the container has to be started on-demand via its service.
|
||||
'';
|
||||
Service = {
|
||||
### There is no generalized way of supporting `reload` for docker
|
||||
### containers. Some containers may respond well to SIGHUP sent to their
|
||||
### init process, but it is not guaranteed; some apps have other reload
|
||||
### mechanisms, some don't have a reload signal at all, and some docker
|
||||
### images just have broken signal handling. The best compromise in this
|
||||
### case is probably to leave ExecReload undefined, so `systemctl reload`
|
||||
### will at least result in an error instead of potentially undefined
|
||||
### behaviour.
|
||||
###
|
||||
### Advanced users can still override this part of the unit to implement
|
||||
### a custom reload handler, since the result of all this is a normal
|
||||
### systemd service from the perspective of the NixOS module system.
|
||||
###
|
||||
# ExecReload = ...;
|
||||
###
|
||||
ExecStartPre = [ "${preStartScript}/bin/pre-start" ];
|
||||
ExecStart = [
|
||||
"${pkgs.writeShellScript "start" script}"
|
||||
];
|
||||
ExecStop = [
|
||||
"${podman} stop --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id"
|
||||
"${podman} rm -f --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id"
|
||||
];
|
||||
# TimeoutStartSec = 0;
|
||||
# TimeoutStopSec = 120;
|
||||
# Restart = "always";
|
||||
Environment = [ "PODMAN_SYSTEMD_UNIT=podman-${name}.service" ];
|
||||
Type = "notify";
|
||||
NotifyAccess = "all";
|
||||
# Type = "exec";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mkService = name: container: let
|
||||
podman = lib.getExe pkgs.podman;
|
||||
rm = lib.getExe' pkgs.coreutils "rm";
|
||||
printf = lib.getExe' pkgs.coreutils "printf";
|
||||
getId = ''"$(${lib.getExe' pkgs.coreutils "id"} -u)"'';
|
||||
dependsOn = map (x: "podman-${x}.service") container.dependsOn;
|
||||
escapedName = lib.escapeShellArg name;
|
||||
preStartScript = pkgs.writeShellApplication {
|
||||
name = "pre-start";
|
||||
runtimeInputs = [];
|
||||
text = ''
|
||||
${printf} "Running pre-start script.."
|
||||
${podman} rm -f ${name} || true
|
||||
${lib.optionalString (container.imageFile != null) ''
|
||||
${podman} load -i ${container.imageFile}
|
||||
''}
|
||||
${rm} -f /run/user/${getId}/podman-${escapedName}.ctr-id
|
||||
${printf} " success.\nStarting Podman...\n"
|
||||
'';
|
||||
};
|
||||
script = concatStringsSep " \\\n " (
|
||||
[
|
||||
"exec ${podman} "
|
||||
]
|
||||
++ map escapeShellArg container.preRunExtraOptions
|
||||
++ [
|
||||
"run"
|
||||
"--log-level=debug"
|
||||
"--rm"
|
||||
"--name=${escapedName}"
|
||||
"--log-driver=${container.log-driver}"
|
||||
]
|
||||
++ optional (container.entrypoint != null)
|
||||
"--entrypoint=${escapeShellArg container.entrypoint}"
|
||||
++ optional (container.hostname != null)
|
||||
"--hostname=${escapeShellArg container.hostname}"
|
||||
++ optional (container.pullPolicy != null)
|
||||
"--pull=${container.pullPolicy}"
|
||||
++ [
|
||||
"--cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id"
|
||||
# "--sdnotify=ignore"
|
||||
"--cgroups=no-conmon"
|
||||
"--sdnotify=conmon"
|
||||
"-d"
|
||||
"--replace"
|
||||
]
|
||||
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
|
||||
++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
|
||||
++ map (p: "-p ${escapeShellArg p}") container.ports
|
||||
++ optional (container.user != null) "-u ${escapeShellArg container.user}"
|
||||
++ map (v: "-v ${escapeShellArg v}") container.volumes
|
||||
++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels)
|
||||
++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
|
||||
++ map escapeShellArg container.extraOptions
|
||||
++ [container.image]
|
||||
++ map escapeShellArg container.cmd
|
||||
);
|
||||
|
||||
inherit (lib) concatStringsSep escapeShellArg optional mapAttrsToList;
|
||||
in {
|
||||
Unit = {
|
||||
WantedBy = [] ++ lib.optional (container.autoStart) "default.target"; # graphical-session instead maybe?
|
||||
After = dependsOn;
|
||||
Requires = dependsOn;
|
||||
# StopWhenUnneeded = true;
|
||||
};
|
||||
# TODO make network target..
|
||||
# wants = lib.optional (container.imageFile == null) "network-online.target";
|
||||
# after = lib.optionals (container.imageFile == null) [ "network-online.target" ]
|
||||
# ++ dependsOn;
|
||||
# environment = proxy_env;
|
||||
|
||||
Service = {
|
||||
### There is no generalized way of supporting `reload` for docker
|
||||
### containers. Some containers may respond well to SIGHUP sent to their
|
||||
### init process, but it is not guaranteed; some apps have other reload
|
||||
### mechanisms, some don't have a reload signal at all, and some docker
|
||||
### images just have broken signal handling. The best compromise in this
|
||||
### case is probably to leave ExecReload undefined, so `systemctl reload`
|
||||
### will at least result in an error instead of potentially undefined
|
||||
### behaviour.
|
||||
###
|
||||
### Advanced users can still override this part of the unit to implement
|
||||
### a custom reload handler, since the result of all this is a normal
|
||||
### systemd service from the perspective of the NixOS module system.
|
||||
###
|
||||
# ExecReload = ...;
|
||||
###
|
||||
ExecStartPre = ["${preStartScript}/bin/pre-start"];
|
||||
ExecStart = [
|
||||
"${pkgs.writeShellScript "start" script}"
|
||||
];
|
||||
ExecStop = [
|
||||
"${podman} stop --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id"
|
||||
"${podman} rm -f --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id"
|
||||
];
|
||||
# TimeoutStartSec = 0;
|
||||
# TimeoutStopSec = 120;
|
||||
# Restart = "always";
|
||||
Environment = ["PODMAN_SYSTEMD_UNIT=podman-${name}.service"];
|
||||
Type = "notify";
|
||||
NotifyAccess = "all";
|
||||
# Type = "exec";
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.containers;
|
||||
inherit (lib) mapAttrs' nameValuePair mkOption types mkIf literalExpression;
|
||||
in {
|
||||
inherit (lib)
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
mkOption
|
||||
types
|
||||
mkIf
|
||||
literalExpression
|
||||
;
|
||||
in
|
||||
{
|
||||
options.containers = mkOption {
|
||||
default = {};
|
||||
default = { };
|
||||
type = with types; attrsOf (submodule containerOptions);
|
||||
};
|
||||
|
||||
config = mkIf (cfg != {}) {
|
||||
config = mkIf (cfg != { }) {
|
||||
systemd.user.services = mapAttrs' (k: v: nameValuePair "podman-${k}" (mkService k v)) cfg;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,8 +2,20 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) filterAttrs concatStrings concatStringsSep mapAttrsToList concatLists foldlAttrs concatMapAttrs mapAttrs mapAttrs' nameValuePair boolToString;
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
concatStrings
|
||||
concatStringsSep
|
||||
mapAttrsToList
|
||||
concatLists
|
||||
foldlAttrs
|
||||
concatMapAttrs
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
boolToString
|
||||
;
|
||||
inherit (builtins) typeOf toString stringLength;
|
||||
|
||||
# build up serialisation machinery from here for various types
|
||||
|
@ -12,24 +24,33 @@
|
|||
array = a: "[${concatStringsSep "," a}]";
|
||||
# attrset -> hashmap
|
||||
_assoc = a: mapAttrsToList (name: val: "${name}: ${val}") a;
|
||||
assoc = a: '' {
|
||||
assoc = a: ''
|
||||
{
|
||||
${concatStringsSep ",\n" (concatLists (map _assoc a))}
|
||||
}'';
|
||||
# attrset -> struct
|
||||
_struct_kv = k: v:
|
||||
if v == null
|
||||
then ""
|
||||
else (concatStringsSep ":" [k (serialise.${typeOf v} v)]);
|
||||
_struct_concat = s:
|
||||
_struct_kv =
|
||||
k: v:
|
||||
if v == null then
|
||||
""
|
||||
else
|
||||
(concatStringsSep ":" [
|
||||
k
|
||||
(serialise.${typeOf v} v)
|
||||
]);
|
||||
_struct_concat =
|
||||
s:
|
||||
foldlAttrs (
|
||||
acc: k: v:
|
||||
if stringLength acc > 0
|
||||
then concatStringsSep ", " [acc (_struct_kv k v)]
|
||||
else _struct_kv k v
|
||||
) ""
|
||||
s;
|
||||
_struct_filt = s:
|
||||
_struct_concat (filterAttrs (k: v: v != null) s);
|
||||
if stringLength acc > 0 then
|
||||
concatStringsSep ", " [
|
||||
acc
|
||||
(_struct_kv k v)
|
||||
]
|
||||
else
|
||||
_struct_kv k v
|
||||
) "" s;
|
||||
_struct_filt = s: _struct_concat (filterAttrs (_k: v: v != null) s);
|
||||
struct = s: "(${_struct_filt s})";
|
||||
toQuotedString = s: ''"${toString s}"'';
|
||||
|
||||
|
@ -46,59 +67,68 @@
|
|||
};
|
||||
|
||||
# define the key for a keybind
|
||||
defineBinding = binding:
|
||||
defineBinding =
|
||||
binding:
|
||||
struct {
|
||||
inherit (binding) modifiers;
|
||||
key =
|
||||
if isNull binding.key
|
||||
then null
|
||||
else toQuotedString binding.key;
|
||||
key = if (binding.key == null) then null else toQuotedString binding.key;
|
||||
};
|
||||
|
||||
# map keybinding from list of attrset to hashmap of (mod,key): action
|
||||
_mapBindings = bindings:
|
||||
map (
|
||||
inner: {"${defineBinding inner}" = maybeToString (checkAction inner.action);}
|
||||
)
|
||||
bindings;
|
||||
mapBindings = bindings:
|
||||
assoc (_mapBindings bindings);
|
||||
_mapBindings =
|
||||
bindings:
|
||||
map (inner: { "${defineBinding inner}" = maybeToString (checkAction inner.action); }) bindings;
|
||||
mapBindings = bindings: assoc (_mapBindings bindings);
|
||||
|
||||
# check a keybinding's action
|
||||
# escape with quotes if it's a Spawn action
|
||||
checkAction = a:
|
||||
if typeOf a == "set" && a.type == "Spawn"
|
||||
then {
|
||||
inherit (a) type;
|
||||
data = toQuotedString a.data;
|
||||
}
|
||||
else a;
|
||||
checkAction =
|
||||
a:
|
||||
if typeOf a == "set" && a.type == "Spawn" then
|
||||
{
|
||||
inherit (a) type;
|
||||
data = toQuotedString a.data;
|
||||
}
|
||||
else
|
||||
a;
|
||||
|
||||
maybeToString = s:
|
||||
if typeOf s == "set"
|
||||
then concatStrings [s.type "(" (toString s.data) ")"]
|
||||
else s;
|
||||
maybeToString =
|
||||
s:
|
||||
if typeOf s == "set" then
|
||||
concatStrings [
|
||||
s.type
|
||||
"("
|
||||
(toString s.data)
|
||||
")"
|
||||
]
|
||||
else
|
||||
s;
|
||||
|
||||
mapCosmicSettings = application: options:
|
||||
mapAttrs' (k: v:
|
||||
mapCosmicSettings =
|
||||
application: options:
|
||||
mapAttrs' (
|
||||
k: v:
|
||||
nameValuePair "cosmic/${application}/v${options.version}/${k}" {
|
||||
enable = true;
|
||||
text = serialise.${typeOf v} v;
|
||||
})
|
||||
options.option;
|
||||
# deconstructKeybindAttr = attr: mapAttrs' (
|
||||
# name: value:
|
||||
# ) attr;
|
||||
# rec_attr = lib.types.attrsOf (lib.types.oneOf lib.types.string rec_attr);
|
||||
in {
|
||||
}
|
||||
) options.option;
|
||||
in
|
||||
# deconstructKeybindAttr = attr: mapAttrs' (
|
||||
# name: value:
|
||||
# ) attr;
|
||||
# rec_attr = lib.types.attrsOf (lib.types.oneOf lib.types.string rec_attr);
|
||||
{
|
||||
options.cosmic = {
|
||||
enable = with lib;
|
||||
enable =
|
||||
with lib;
|
||||
mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
defaultKeybindings = with lib;
|
||||
defaultKeybindings =
|
||||
with lib;
|
||||
mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
|
@ -110,15 +140,17 @@ in {
|
|||
# type = with types; rec_attr;
|
||||
# };
|
||||
|
||||
keybindings = with lib;
|
||||
keybindings =
|
||||
with lib;
|
||||
mkOption {
|
||||
default = [];
|
||||
type = with types;
|
||||
default = [ ];
|
||||
type =
|
||||
with types;
|
||||
listOf (submodule {
|
||||
options = {
|
||||
modifiers = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
key = mkOption {
|
||||
type = nullOr str;
|
||||
|
@ -131,7 +163,10 @@ in {
|
|||
type = str;
|
||||
};
|
||||
data = mkOption {
|
||||
type = oneOf [str int];
|
||||
type = oneOf [
|
||||
str
|
||||
int
|
||||
];
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
@ -141,10 +176,12 @@ in {
|
|||
});
|
||||
};
|
||||
|
||||
otherSettings = with lib;
|
||||
otherSettings =
|
||||
with lib;
|
||||
mkOption {
|
||||
default = {};
|
||||
type = with types;
|
||||
default = { };
|
||||
type =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
version = mkOption {
|
||||
|
@ -162,15 +199,14 @@ in {
|
|||
# TODO we need to split between system_actions, workspaces, custom
|
||||
config.xdg.configFile =
|
||||
{
|
||||
"cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom".text = mapBindings config.cosmic.keybindings;
|
||||
"cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom".text =
|
||||
mapBindings config.cosmic.keybindings;
|
||||
"cosmic/com.system76.CosmicSettings.Shortcuts/v1/defaults" = {
|
||||
text = "{}";
|
||||
enable = !config.cosmic.defaultKeybindings;
|
||||
};
|
||||
}
|
||||
// concatMapAttrs (
|
||||
application: options:
|
||||
mapCosmicSettings application options
|
||||
)
|
||||
config.cosmic.otherSettings;
|
||||
application: options: mapCosmicSettings application options
|
||||
) config.cosmic.otherSettings;
|
||||
}
|
||||
|
|
|
@ -2,30 +2,35 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
options = {
|
||||
ezServices = with lib;
|
||||
ezServices =
|
||||
with lib;
|
||||
mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
|
||||
ezOneShots = with lib;
|
||||
ezOneShots =
|
||||
with lib;
|
||||
mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
ezConf = with lib;
|
||||
ezConf =
|
||||
with lib;
|
||||
mkOption {
|
||||
type = with types; attrsOf path;
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
|
||||
# for specifying an additional systemd target
|
||||
extraTarget = with lib;
|
||||
extraTarget =
|
||||
with lib;
|
||||
mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -34,37 +39,33 @@
|
|||
builtins.mapAttrs (name: cmd: {
|
||||
Unit = {
|
||||
Description = "${name}";
|
||||
Requires = ["graphical-session.target"] ++ config.extraTarget;
|
||||
After = ["graphical-session.target"] ++ config.extraTarget;
|
||||
Requires = [ "graphical-session.target" ] ++ config.extraTarget;
|
||||
After = [ "graphical-session.target" ] ++ config.extraTarget;
|
||||
};
|
||||
Service = {
|
||||
ExecStart = cmd;
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"] ++ config.extraTarget;
|
||||
WantedBy = [ "graphical-session.target" ] ++ config.extraTarget;
|
||||
};
|
||||
})
|
||||
config.ezServices
|
||||
}) config.ezServices
|
||||
// builtins.mapAttrs (name: cmd: {
|
||||
Unit = {
|
||||
Description = "${name}";
|
||||
After = ["graphical-session.target"] ++ config.extraTarget;
|
||||
After = [ "graphical-session.target" ] ++ config.extraTarget;
|
||||
};
|
||||
Service = {
|
||||
ExecStart = cmd;
|
||||
Type = "oneshot";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"] ++ config.extraTarget;
|
||||
WantedBy = [ "graphical-session.target" ] ++ config.extraTarget;
|
||||
};
|
||||
})
|
||||
config.ezOneShots;
|
||||
}) config.ezOneShots;
|
||||
|
||||
xdg.configFile =
|
||||
builtins.mapAttrs (name: value: {
|
||||
enable = true;
|
||||
source = value;
|
||||
})
|
||||
config.ezConf;
|
||||
xdg.configFile = builtins.mapAttrs (_name: value: {
|
||||
enable = true;
|
||||
source = value;
|
||||
}) config.ezConf;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,22 +2,44 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (builtins) getAttr stringLength substring;
|
||||
inherit (lib) mkOption getExe listToAttrs attrsToList imap;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrs mapAttrs' nameValuePair;
|
||||
inherit (lib)
|
||||
mkOption
|
||||
getExe
|
||||
listToAttrs
|
||||
attrsToList
|
||||
imap
|
||||
;
|
||||
inherit (lib.attrsets)
|
||||
mapAttrs
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
;
|
||||
inherit (lib.strings) concatStringsSep toUpper;
|
||||
|
||||
enumerate = a:
|
||||
listToAttrs (imap (id: {
|
||||
name,
|
||||
value,
|
||||
}: {
|
||||
inherit name;
|
||||
value = value // {inherit id;};
|
||||
}) (attrsToList a));
|
||||
make-app-profiles = cfg:
|
||||
mapAttrs' (name: cfg:
|
||||
enumerate =
|
||||
a:
|
||||
listToAttrs (
|
||||
imap (
|
||||
id:
|
||||
{
|
||||
name,
|
||||
value,
|
||||
}:
|
||||
{
|
||||
inherit name;
|
||||
value = value // {
|
||||
inherit id;
|
||||
};
|
||||
}
|
||||
) (attrsToList a)
|
||||
);
|
||||
make-app-profiles =
|
||||
cfg:
|
||||
mapAttrs' (
|
||||
name: cfg:
|
||||
nameValuePair "home-manager-webapp-${name}" {
|
||||
inherit (cfg) id;
|
||||
userChrome = ''
|
||||
|
@ -46,39 +68,39 @@
|
|||
}
|
||||
'';
|
||||
|
||||
settings =
|
||||
cfg.extraSettings
|
||||
// {
|
||||
"browser.startup.homepage" = builtins.toString cfg.url;
|
||||
"browser.sessionstore.resume_session_once" = false;
|
||||
"browser.sessionstore.resume_from_crash" = false;
|
||||
"browser.cache.disk.enable" = false;
|
||||
"browser.cache.disk.capacity" = 0;
|
||||
"browser.cache.disk.filesystem_reported" = 1;
|
||||
"browser.cache.disk.smart_size.enabled" = false;
|
||||
"browser.cache.disk.smart_size.first_run" = false;
|
||||
"browser.cache.disk.smart_size.use_old_max" = false;
|
||||
"browser.ctrlTab.previews" = true;
|
||||
"browser.tabs.warnOnClose" = false;
|
||||
"plugin.state.flash" = 2;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.tabs.drawInTitlebar" = false;
|
||||
"browser.tabs.inTitlebar" = 0;
|
||||
"browser.contentblocking.category" = "strict";
|
||||
"network.cookie.lifetimePolicy" = 0;
|
||||
"layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme {
|
||||
dark = 0;
|
||||
light = 1;
|
||||
system = 2;
|
||||
};
|
||||
settings = cfg.extraSettings // {
|
||||
"browser.startup.homepage" = builtins.toString cfg.url;
|
||||
"browser.sessionstore.resume_session_once" = false;
|
||||
"browser.sessionstore.resume_from_crash" = false;
|
||||
"browser.cache.disk.enable" = false;
|
||||
"browser.cache.disk.capacity" = 0;
|
||||
"browser.cache.disk.filesystem_reported" = 1;
|
||||
"browser.cache.disk.smart_size.enabled" = false;
|
||||
"browser.cache.disk.smart_size.first_run" = false;
|
||||
"browser.cache.disk.smart_size.use_old_max" = false;
|
||||
"browser.ctrlTab.previews" = true;
|
||||
"browser.tabs.warnOnClose" = false;
|
||||
"plugin.state.flash" = 2;
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"browser.tabs.drawInTitlebar" = false;
|
||||
"browser.tabs.inTitlebar" = 0;
|
||||
"browser.contentblocking.category" = "strict";
|
||||
"network.cookie.lifetimePolicy" = 0;
|
||||
"layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme {
|
||||
dark = 0;
|
||||
light = 1;
|
||||
system = 2;
|
||||
};
|
||||
})
|
||||
cfg;
|
||||
in {
|
||||
};
|
||||
}
|
||||
) cfg;
|
||||
in
|
||||
{
|
||||
options.programs.firefox.webapps = mkOption {
|
||||
default = {};
|
||||
default = { };
|
||||
|
||||
type = with lib.types;
|
||||
type =
|
||||
with lib.types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
####################
|
||||
|
@ -102,13 +124,13 @@ in {
|
|||
|
||||
extraArgs = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Extra args to launch Firefox with.";
|
||||
};
|
||||
|
||||
extraSettings = mkOption {
|
||||
type = attrsOf (either bool (either int str));
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Additional Firefox profile settings.";
|
||||
};
|
||||
|
||||
|
@ -119,7 +141,11 @@ in {
|
|||
};
|
||||
|
||||
theme = mkOption {
|
||||
type = enum ["dark" "light" "system"];
|
||||
type = enum [
|
||||
"dark"
|
||||
"light"
|
||||
"system"
|
||||
];
|
||||
default = "system";
|
||||
description = "The application CSS theme to use, if supported.";
|
||||
};
|
||||
|
@ -138,7 +164,11 @@ in {
|
|||
mimeType = mkOption {
|
||||
description = "The MIME type(s) supported by this application.";
|
||||
type = nullOr (listOf str);
|
||||
default = ["text/html" "text/xml" "application/xhtml_xml"];
|
||||
default = [
|
||||
"text/html"
|
||||
"text/xml"
|
||||
"application/xhtml_xml"
|
||||
];
|
||||
};
|
||||
|
||||
# Copied verbatim from xdg.desktopEntries.
|
||||
|
@ -183,40 +213,48 @@ in {
|
|||
config = {
|
||||
programs.firefox.profiles = make-app-profiles (enumerate config.programs.firefox.webapps);
|
||||
|
||||
xdg.desktopEntries =
|
||||
mapAttrs (name: cfg: {
|
||||
inherit (cfg) genericName comment categories icon mimeType prefersNonDefaultGPU;
|
||||
xdg.desktopEntries = mapAttrs (name: cfg: {
|
||||
inherit (cfg)
|
||||
genericName
|
||||
comment
|
||||
categories
|
||||
icon
|
||||
mimeType
|
||||
prefersNonDefaultGPU
|
||||
;
|
||||
|
||||
name =
|
||||
if cfg.name == null
|
||||
then (toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name)
|
||||
else cfg.name;
|
||||
name =
|
||||
if cfg.name == null then
|
||||
(toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name)
|
||||
else
|
||||
cfg.name;
|
||||
|
||||
startupNotify = true;
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
startupNotify = true;
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
|
||||
exec = concatStringsSep " " ([
|
||||
"${getExe config.programs.firefox.package}"
|
||||
"--name"
|
||||
"${name}"
|
||||
"--app-id"
|
||||
"${name}"
|
||||
"--class"
|
||||
"${name}"
|
||||
"-P"
|
||||
"${config.programs.firefox.profiles."home-manager-webapp-${name}".path}"
|
||||
"--no-remote"
|
||||
]
|
||||
++ cfg.extraArgs
|
||||
++ ["${cfg.url}"]);
|
||||
exec = concatStringsSep " " (
|
||||
[
|
||||
"${getExe config.programs.firefox.package}"
|
||||
"--name"
|
||||
"${name}"
|
||||
"--app-id"
|
||||
"${name}"
|
||||
"--class"
|
||||
"${name}"
|
||||
"-P"
|
||||
"${config.programs.firefox.profiles."home-manager-webapp-${name}".path}"
|
||||
"--no-remote"
|
||||
]
|
||||
++ cfg.extraArgs
|
||||
++ [ "${cfg.url}" ]
|
||||
);
|
||||
|
||||
settings = {
|
||||
X-MultipleArgs = "false"; # Consider enabling, don't know what this does
|
||||
StartupWMClass = "${name}";
|
||||
NoDisplay = lib.boolToString cfg.hidden;
|
||||
};
|
||||
})
|
||||
config.programs.firefox.webapps;
|
||||
settings = {
|
||||
X-MultipleArgs = "false"; # Consider enabling, don't know what this does
|
||||
StartupWMClass = "${name}";
|
||||
NoDisplay = lib.boolToString cfg.hidden;
|
||||
};
|
||||
}) config.programs.firefox.webapps;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,62 +2,60 @@
|
|||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption;
|
||||
inherit (builtins) typeOf listToAttrs;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.flatpaks = mkOption {
|
||||
default = [];
|
||||
type = with lib.types;
|
||||
listOf (either str (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = str;
|
||||
default = [ ];
|
||||
type =
|
||||
with lib.types;
|
||||
listOf (
|
||||
either str (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = str;
|
||||
};
|
||||
overrides = mkOption {
|
||||
type = attrsOf (attrsOf (either str (listOf str)));
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
overrides = mkOption {
|
||||
type = attrsOf (attrsOf (either str (listOf str)));
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
}));
|
||||
})
|
||||
);
|
||||
};
|
||||
config.services.flatpak = let
|
||||
userOverrides = listToAttrs (
|
||||
map (
|
||||
fp:
|
||||
if (typeOf fp == "string")
|
||||
then {
|
||||
name = fp;
|
||||
value = {};
|
||||
}
|
||||
else {
|
||||
inherit (fp) name;
|
||||
value = fp.overrides;
|
||||
}
|
||||
)
|
||||
config.flatpaks
|
||||
);
|
||||
in {
|
||||
enable = true;
|
||||
uninstallUnmanaged = true;
|
||||
update.auto.enable = true;
|
||||
packages =
|
||||
map (
|
||||
fp:
|
||||
if (typeOf fp == "set")
|
||||
then fp.name
|
||||
else fp
|
||||
)
|
||||
config.flatpaks;
|
||||
overrides =
|
||||
userOverrides
|
||||
// {
|
||||
config.services.flatpak =
|
||||
let
|
||||
userOverrides = listToAttrs (
|
||||
map (
|
||||
fp:
|
||||
if (typeOf fp == "string") then
|
||||
{
|
||||
name = fp;
|
||||
value = { };
|
||||
}
|
||||
else
|
||||
{
|
||||
inherit (fp) name;
|
||||
value = fp.overrides;
|
||||
}
|
||||
) config.flatpaks
|
||||
);
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
uninstallUnmanaged = true;
|
||||
update.auto.enable = true;
|
||||
packages = map (fp: if (typeOf fp == "set") then fp.name else fp) config.flatpaks;
|
||||
overrides = userOverrides // {
|
||||
global = {
|
||||
Context.sockets = ["wayland"];
|
||||
Context.sockets = [ "wayland" ];
|
||||
Environment = {
|
||||
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
mkForce
|
||||
getExe
|
||||
|
@ -20,106 +20,104 @@
|
|||
replaceStrings
|
||||
concatMapStringsSep
|
||||
;
|
||||
partOf = cfg: "${replaceStrings [" "] ["-"] (toLower cfg.name)}.target";
|
||||
partOf = cfg: "${replaceStrings [ " " ] [ "-" ] (toLower cfg.name)}.target";
|
||||
# make a firefox webapp + hidden .desktop entry for the client app
|
||||
make-firefox = cfg:
|
||||
make-firefox =
|
||||
cfg:
|
||||
mapAttrs' (
|
||||
name: cfg:
|
||||
nameValuePair "${name}-client"
|
||||
{
|
||||
inherit (cfg) name;
|
||||
url = "http://127.0.0.1:${builtins.toString cfg.port}";
|
||||
extraSettings = config.programs.firefox.profiles.default.settings;
|
||||
hidden = true;
|
||||
}
|
||||
)
|
||||
cfg;
|
||||
# make a systemd service for running the frontend
|
||||
make-systemd-service = cfg:
|
||||
mapAttrs' (
|
||||
name: cfg:
|
||||
if
|
||||
(cfg.service
|
||||
!= null)
|
||||
then
|
||||
nameValuePair "${cfg.name}-frontend" {
|
||||
Unit = {
|
||||
Description = "${cfg.name} Frontend";
|
||||
WantedBy = mkForce [];
|
||||
};
|
||||
|
||||
Service = cfg.service;
|
||||
}
|
||||
else nameValuePair "" {}
|
||||
)
|
||||
cfg;
|
||||
# modify systemd units to be PartOf this target
|
||||
modify-systemd-services = cfg:
|
||||
listToAttrs (flatten (mapAttrsToList (
|
||||
name: cfg: (map (
|
||||
req: {
|
||||
name = "${req}";
|
||||
value = {
|
||||
Unit = {
|
||||
PartOf = partOf cfg;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
cfg.requires.services)
|
||||
)
|
||||
cfg));
|
||||
modify-quadlets = cfg:
|
||||
listToAttrs (flatten (mapAttrsToList (
|
||||
name: cfg: (map (
|
||||
req: {
|
||||
name = "${req}";
|
||||
value = {
|
||||
extraConfig.Unit.PartOf = partOf cfg;
|
||||
};
|
||||
}
|
||||
)
|
||||
cfg.requires.containers)
|
||||
)
|
||||
cfg));
|
||||
# make a systemd target to collate dependencies
|
||||
make-systemd-target = cfg:
|
||||
mapAttrs (
|
||||
name: cfg: {
|
||||
Unit = {
|
||||
Description = "${cfg.name} Target";
|
||||
WantedBy = mkForce [];
|
||||
Requires =
|
||||
(map (req: req + ".service") cfg.requires.services)
|
||||
++ (map (req: "podman-" + req + ".service") cfg.requires.containers);
|
||||
};
|
||||
nameValuePair "${name}-client" {
|
||||
inherit (cfg) name;
|
||||
url = "http://127.0.0.1:${builtins.toString cfg.port}";
|
||||
extraSettings = config.programs.firefox.profiles.default.settings;
|
||||
hidden = true;
|
||||
}
|
||||
)
|
||||
cfg;
|
||||
) cfg;
|
||||
# make a systemd service for running the frontend
|
||||
make-systemd-service =
|
||||
cfg:
|
||||
mapAttrs' (
|
||||
name: cfg:
|
||||
if (cfg.service != null) then
|
||||
nameValuePair "${cfg.name}-frontend" {
|
||||
Unit = {
|
||||
Description = "${cfg.name} Frontend";
|
||||
WantedBy = mkForce [ ];
|
||||
};
|
||||
|
||||
Service = cfg.service;
|
||||
}
|
||||
else
|
||||
nameValuePair "" { }
|
||||
) cfg;
|
||||
# modify systemd units to be PartOf this target
|
||||
modify-systemd-services =
|
||||
cfg:
|
||||
listToAttrs (
|
||||
flatten (
|
||||
mapAttrsToList (
|
||||
name: cfg:
|
||||
(map (req: {
|
||||
name = "${req}";
|
||||
value = {
|
||||
Unit = {
|
||||
PartOf = partOf cfg;
|
||||
};
|
||||
};
|
||||
}) cfg.requires.services)
|
||||
) cfg
|
||||
)
|
||||
);
|
||||
modify-quadlets =
|
||||
cfg:
|
||||
listToAttrs (
|
||||
flatten (
|
||||
mapAttrsToList (
|
||||
name: cfg:
|
||||
(map (req: {
|
||||
name = "${req}";
|
||||
value = {
|
||||
extraConfig.Unit.PartOf = partOf cfg;
|
||||
};
|
||||
}) cfg.requires.containers)
|
||||
) cfg
|
||||
)
|
||||
);
|
||||
# make a systemd target to collate dependencies
|
||||
make-systemd-target =
|
||||
cfg:
|
||||
mapAttrs (name: cfg: {
|
||||
Unit = {
|
||||
Description = "${cfg.name} Target";
|
||||
WantedBy = mkForce [ ];
|
||||
Requires =
|
||||
(map (req: req + ".service") cfg.requires.services)
|
||||
++ (map (req: "podman-" + req + ".service") cfg.requires.containers);
|
||||
};
|
||||
}) cfg;
|
||||
# make desktop shortcuts and a script which will handle starting everything
|
||||
make-xdg = cfg:
|
||||
mapAttrs (
|
||||
name: cfg: {
|
||||
inherit (cfg) name icon genericName;
|
||||
type = "Application";
|
||||
exec = "${let
|
||||
make-xdg =
|
||||
cfg:
|
||||
mapAttrs (name: cfg: {
|
||||
inherit (cfg) name icon genericName;
|
||||
type = "Application";
|
||||
exec = "${
|
||||
let
|
||||
notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"${cfg.name}\"";
|
||||
systemctl = "${getExe' pkgs.systemd "systemctl"}";
|
||||
dex = "${getExe pkgs.dex}";
|
||||
podman = "${getExe pkgs.podman}";
|
||||
makeContainerCheck = container: ''[ "$(${podman} inspect -f {{.State.Health.Status}} ${container})" == "healthy" ]'';
|
||||
makeContainerCheck =
|
||||
container: ''[ "$(${podman} inspect -f {{.State.Health.Status}} ${container})" == "healthy" ]'';
|
||||
# makeContainerCheck = container: ''
|
||||
# [ ${podman} inspect -f {{.State.Status}} ${container})" != "running" ]
|
||||
# '';
|
||||
containerChecks =
|
||||
if (cfg.requires.containers != [])
|
||||
then
|
||||
if (cfg.requires.containers != [ ]) then
|
||||
''
|
||||
container_checks() {
|
||||
if ''
|
||||
+ (concatMapStringsSep " && "
|
||||
(container: makeContainerCheck container)
|
||||
cfg.requires.containers)
|
||||
+ (concatMapStringsSep " && " makeContainerCheck cfg.requires.containers)
|
||||
+ ''
|
||||
; then
|
||||
return 0
|
||||
|
@ -128,54 +126,55 @@
|
|||
fi
|
||||
}
|
||||
''
|
||||
else ''
|
||||
container_checks() {
|
||||
return 0
|
||||
}
|
||||
'';
|
||||
else
|
||||
''
|
||||
container_checks() {
|
||||
return 0
|
||||
}
|
||||
'';
|
||||
in
|
||||
pkgs.writeShellScript "${name}"
|
||||
''
|
||||
set -euo pipefail
|
||||
pkgs.writeShellScript "${name}" ''
|
||||
set -euo pipefail
|
||||
|
||||
exit_error() {
|
||||
${notify-send} -w "Failure" $1
|
||||
exit 1
|
||||
}
|
||||
exit_error() {
|
||||
${notify-send} -w "Failure" $1
|
||||
exit 1
|
||||
}
|
||||
|
||||
${containerChecks}
|
||||
${containerChecks}
|
||||
|
||||
${notify-send} "Launching ${name} backend.." "Please be patient."
|
||||
${systemctl} --user start ${name}.target || exit_error "Failed to launch!"
|
||||
${notify-send} "Launching ${name} backend.." "Please be patient."
|
||||
${systemctl} --user start ${name}.target || exit_error "Failed to launch!"
|
||||
|
||||
checks=0
|
||||
until container_checks; do
|
||||
sleep 2
|
||||
checks=$((checks+1))
|
||||
if [ $((checks%10)) -eq 0 ]; then
|
||||
${notify-send} "Waiting for backend."
|
||||
fi
|
||||
if [ $checks -ge 60 ]; then
|
||||
${systemctl} --no-block --user stop ${name}.target
|
||||
exit_error "Failed to launch!"
|
||||
fi
|
||||
done
|
||||
checks=0
|
||||
until container_checks; do
|
||||
sleep 2
|
||||
checks=$((checks+1))
|
||||
if [ $((checks%10)) -eq 0 ]; then
|
||||
${notify-send} "Waiting for backend."
|
||||
fi
|
||||
if [ $checks -ge 60 ]; then
|
||||
${systemctl} --no-block --user stop ${name}.target
|
||||
exit_error "Failed to launch!"
|
||||
fi
|
||||
done
|
||||
|
||||
${notify-send} "Launching ${name}.."
|
||||
${dex} -w ~/.nix-profile/share/applications/${name}-client.desktop
|
||||
${notify-send} "Launching ${name}.."
|
||||
${dex} -w ~/.nix-profile/share/applications/${name}-client.desktop
|
||||
|
||||
${notify-send} "Goodbye" "Shutting down."
|
||||
${systemctl} --user stop ${name}.target
|
||||
exit 0
|
||||
''}";
|
||||
}
|
||||
)
|
||||
cfg;
|
||||
${notify-send} "Goodbye" "Shutting down."
|
||||
${systemctl} --user stop ${name}.target
|
||||
exit 0
|
||||
''
|
||||
}";
|
||||
}) cfg;
|
||||
cfg = config.localWebApps;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.localWebApps = mkOption {
|
||||
default = {};
|
||||
type = with lib.types;
|
||||
default = { };
|
||||
type =
|
||||
with lib.types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
|
@ -200,11 +199,11 @@ in {
|
|||
options = {
|
||||
containers = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
services = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption mkIf types;
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
inherit (builtins) listToAttrs;
|
||||
cfg = config.programs.murex;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.programs.murex = {
|
||||
enable = mkEnableOption "murex shell";
|
||||
managePlugins = mkEnableOption "plugin management";
|
||||
direnv = mkEnableOption "direnv integration";
|
||||
plugins = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
profile = mkOption {
|
||||
type = types.str;
|
||||
|
@ -27,16 +33,18 @@ in {
|
|||
useXdgConfig = mkEnableOption "override MUREX_{PRELOAD,MODULES,PROFILE} env vars to conform to XDG_CONFIG_HOME";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
home.file = let
|
||||
plugins = listToAttrs (map (plugin: {
|
||||
name = ".murex_modules/${plugin.pname}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = plugin;
|
||||
};
|
||||
})
|
||||
cfg.plugins);
|
||||
in
|
||||
home.file =
|
||||
let
|
||||
plugins = listToAttrs (
|
||||
map (plugin: {
|
||||
name = ".murex_modules/${plugin.pname}";
|
||||
value = {
|
||||
recursive = true;
|
||||
source = plugin;
|
||||
};
|
||||
}) cfg.plugins
|
||||
);
|
||||
in
|
||||
lib.mergeAttrs plugins {
|
||||
".murex_preload" = {
|
||||
text = cfg.preload;
|
||||
|
@ -47,31 +55,31 @@ in {
|
|||
text =
|
||||
cfg.profile
|
||||
+ (
|
||||
if cfg.direnv
|
||||
then ''
|
||||
direnv hook murex -> source
|
||||
''
|
||||
else ""
|
||||
if cfg.direnv then
|
||||
''
|
||||
direnv hook murex -> source
|
||||
''
|
||||
else
|
||||
""
|
||||
);
|
||||
executable = true;
|
||||
enable = cfg.direnv || cfg.profile != "";
|
||||
};
|
||||
".murex_modules/packages.json" = {
|
||||
text = builtins.toJSON (map (plugin: {
|
||||
text = builtins.toJSON (
|
||||
map (plugin: {
|
||||
Protocol = "nix";
|
||||
URI = "nix://managed.git";
|
||||
Package = plugin.pname;
|
||||
})
|
||||
cfg.plugins);
|
||||
enable = cfg.managePlugins && (cfg.plugins != []);
|
||||
}) cfg.plugins
|
||||
);
|
||||
enable = cfg.managePlugins && (cfg.plugins != [ ]);
|
||||
};
|
||||
};
|
||||
home.sessionVariables =
|
||||
mkIf
|
||||
cfg.useXdgConfig {
|
||||
MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_MODULES = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/";
|
||||
};
|
||||
home.sessionVariables = mkIf cfg.useXdgConfig {
|
||||
MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_MODULES = "$XDG_CONFIG_HOME/murex/";
|
||||
MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,16 +2,20 @@
|
|||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.mainUser = mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
config.home = let
|
||||
inherit (config) mainUser;
|
||||
in {
|
||||
username = mainUser;
|
||||
homeDirectory = "/home/${mainUser}";
|
||||
};
|
||||
config.home =
|
||||
let
|
||||
inherit (config) mainUser;
|
||||
in
|
||||
{
|
||||
username = mainUser;
|
||||
homeDirectory = "/home/${mainUser}";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue