diff --git a/content/config/nushell/scripts/remoting.nu.tmpl b/content/config/nushell/scripts/remoting.nu.tmpl index 8376062..76b73a0 100644 --- a/content/config/nushell/scripts/remoting.nu.tmpl +++ b/content/config/nushell/scripts/remoting.nu.tmpl @@ -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 } } diff --git a/content/config/systemd/user/pueued.service b/content/config/systemd/user/pueued.service.tmpl similarity index 85% rename from content/config/systemd/user/pueued.service rename to content/config/systemd/user/pueued.service.tmpl index 51102e6..47bc0ff 100644 --- a/content/config/systemd/user/pueued.service +++ b/content/config/systemd/user/pueued.service.tmpl @@ -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 diff --git a/hooks/home-manager.hook.lua b/hooks/home-manager.hook.lua index 01ad02b..7bef03d 100644 --- a/hooks/home-manager.hook.lua +++ b/hooks/home-manager.hook.lua @@ -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") diff --git a/silo-utils.lua b/silo-utils.lua index a6a0d9e..5b337a1 100644 --- a/silo-utils.lua +++ b/silo-utils.lua @@ -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) diff --git a/silo.config.lua b/silo.config.lua index cde279d..39a9204 100644 --- a/silo.config.lua +++ b/silo.config.lua @@ -58,6 +58,7 @@ config.modules = { 'gitlint', 'commitlint', 'meld', + 'pueue', }, gui = mod { 'kdePackages.breeze-icons',