Add silo utils

main
Julius Riegel 8 months ago
parent a16f0d496b
commit 78ee26fc1b

@ -1,35 +1,23 @@
package.path = package.path .. ";../?.lua"
local silo = require 'silo' local silo = require 'silo'
local utils = require 'utils' local sutils = require "silo-utils"
local log = require 'log'
local config = { local config = sutils.enhance_dircfg {
path = silo.dirs.config, path = silo.dirs.config,
mode = "exclude", mode = "exclude",
exclude = {}, exclude = {},
} }
local function not_installed(program) config:needs("broot", "broot")
return utils.nu ("which "..program.." | is-empty") == "true\n" config:needs("firecfg", "firejail")
end config:needs("btm", "bottom")
config:needs("helix", "helix")
local function needs(program, glob) config:needs("home-manager", "home-manager")
if not_installed(program) then config:needs("nix", "nixpkgs")
table.insert(config.exclude, glob) config:needs("nu", "nushell")
end config:needs("systemctl", "systemd")
end config:needs("wezterm", "wezterm")
config:needs("zellij", "zellij")
needs("broot", "broot") config:needs("starship", "starship")
needs("firecfg", "firejail")
needs("btm", "bottom")
needs("helix", "helix")
needs("home-manager", "home-manager")
needs("nix", "nixpkgs")
needs("nu", "nushell")
needs("systemctl", "systemd")
needs("wezterm", "wezterm")
needs("zellij", "zellij")
needs("starship", "starship")
log.debug(config)
return config return config

@ -0,0 +1,25 @@
local utils = require 'utils'
-- dirconfig
local function not_installed(program)
return utils.nu("which " .. program .. " | is-empty") == "true\n"
end
local function needs(config, program, glob)
if not_installed(program) then
table.insert(config.exclude, glob)
end
end
local function enhanced_dircfg(config)
setmetatable(config, { __index = { needs = needs } })
return config
end
return {
not_installed = not_installed,
needs = needs,
enhance_dircfg = enhanced_dircfg,
}
Loading…
Cancel
Save