Adjust config for new lua functions

main
trivernis 8 months ago
parent 5a046686f6
commit 0b69c1aa13
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -2,10 +2,26 @@
def hosts [] {
[
{{#each cfg.ssh_hosts}}
"{{this}}"
{
nu: false
name: (non-empty "{{this.name}}")
ip: (non-empty "{{this.ip}}")
port: (non-empty "{{this.port}}")
username: (non-empty "{{this.username}}")
mac: (non-empty "{{this.mac}}")
}
{{/each}}
]
}
def non-empty [entry: string] {
if ($entry | str length) == 0 {
null
} else {
$entry
}
}
def "nu-complete wol" [] {
hosts
|where mac != ''
@ -46,6 +62,9 @@ export def ssh [
...args # commands you wish to run on the host
] {
let host = (hosts|where name == $hostname|get -i 0)
if $host == null {
^ssh $hostname ...$args
}
if ($host.nu) {
if ($args|length) > 0 {
^ssh (get-url $host) (build-string ($args|str join ' ') '|to json -r')|from json
@ -53,7 +72,7 @@ export def ssh [
^ssh (get-url $host)
}
} else {
^ssh (get-url $host) $args
^ssh (get-url $host) ...$args
}
}

@ -7,7 +7,7 @@ Description=Pueue Daemon - CLI process scheduler and manager
[Service]
Restart=no
ExecStart=/home/jri/.nix-profile/bin/pueued -vv
ExecStart={{dirs.home}}/.nix-profile/bin/pueued -vv
[Install]
WantedBy=default.target

@ -1,15 +1,17 @@
local utils = require 'utils'
local silo = require 'silo'
local log = require 'log'
local path = require 'path'
local exports = {}
local shasum = utils.ext_piped "shasum"
local ha_checksum = ""
local homenix = path.join { silo.dirs.config, "home-manager/home.nix" }
if utils.nu("'" .. silo.dirs.config .. "/home-manager/home.nix' | path exists") == "true\n" then
ha_checksum = (shasum { silo.dirs.config .. "/home-manager/home.nix" }).stdout
if path.exists(homenix) then
ha_checksum = (shasum {homenix}).stdout
log.debug(ha_checksum)
end
@ -40,7 +42,7 @@ local function link_apps()
end
exports.after_apply_all = function()
if utils.nu "which home-manager | is-empty" == "false\n" and (shasum { silo.dirs.config .. "/home-manager/home.nix" }).stdout ~= ha_checksum then
if utils.which "home-manager" == nil and (shasum {homenix}).stdout ~= ha_checksum then
local hm = utils.ext "home-manager"
log.info("Applying home-manager config")

@ -3,7 +3,7 @@ local utils = require 'utils'
-- dirconfig
local function not_installed(program)
return utils.nu("which " .. program .. " | is-empty") == "true\n"
return utils.which(program) == nil
end
local function needs(config, program, glob)

@ -58,6 +58,7 @@ config.modules = {
'gitlint',
'commitlint',
'meld',
'pueue',
},
gui = mod {
'kdePackages.breeze-icons',

Loading…
Cancel
Save