dotfiles
bugabingas dorkfiles
owned by bugabinga
package.nu: force link when reinstalling
3d2e86feed8be40c8b8cb6180e8f2c7cc70231a5
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Changed files (7)
deleted file mode 100644 3 - let device_directory =
'/sys/class/power_supply/BAT0' 4 - if ( not (
$device_directory | path exists) ) {
5 - print --stderr $
"Could not find ($device_directory). Does this device have a battery? Maybe under another path?" 8 - let energy_full = (open ([
$device_directory energy_full] | path join) | into int)
9 - let energy_now = (open ([
$device_directory energy_now] | path join) | into int)
10 - let current_energy =
$energy_now /
$energy_full 11 - let current_energy_percent =
$current_energy *
100 | into int
12 - let icon = battery_icon
$current_energy_percent 13 - print $
"($icon) ($current_energy_percent)%" 19 - let index = ( (
$percent | math ceil) /
10 | math floor | into int)
32 - return (
$icons | get
$index)
nushell/modules/akku.nu
Addednew file mode 100644 3 + let device_directory =
'/sys/class/power_supply/BAT0' 4 + if ( not (
$device_directory | path exists) ) {
5 + print --stderr $
"Could not find ($device_directory). Does this device have a battery? Maybe under another path?" 8 + let energy_full = (open ([
$device_directory energy_full] | path join) | into int)
9 + let energy_now = (open ([
$device_directory energy_now] | path join) | into int)
10 + let current_energy =
$energy_now /
$energy_full 11 + let current_energy_percent =
$current_energy *
100 | into int
12 + let icon = battery_icon
$current_energy_percent 13 + print $
"($icon) ($current_energy_percent)%" 19 + let index = ( (
$percent | math ceil) /
10 | math floor | into int)
32 + return (
$icons | get
$index)
nushell/modules/package/environment_path.nu
Addednew file mode 100644 6 +export def --env set-system-path [] {
7 + let bin = (folders binaries)
8 + match $nu.os-info.family {
10 + if (
$env.PATH | find
$bin | is-empty) {
11 + let envd = [
$nu.home-dir .config environment.d] | path join
12 + if(not (
$envd | path exists)) {
13 + error make {msg: $
"systemd environment.d must exist under ($envd)!"}
15 + let packgage_path = $
'PATH = "$PATH:($bin)"' 16 + $packgage_path | save --raw ([
$envd package.conf] | path join)
17 + $env | upsert PATH
$bin 21 + if (
$env.Path | find
$bin | is-empty ) {
23 + $newPath = [Environment]::GetEnvironmentVariable\(\"Path\", \"User\"\) + \";(
$bin)\"
24 + [Environment]::SetEnvironmentVariable\(\
"Path\", $newPath, \"User\"\)" 25 + run-external powershell
'-EncodedCommand' (
$ps_command | endode base64)
26 + $env | upsert Path
$bin nushell/modules/package/installer.nu
Modified 55 55 let destination = [(folders programs)
$manifest.organisation $manifest.name $manifest.version] | path join
56 + let bin =
$manifest.'relative binary path' 57 + let source = [
$destination $bin] | path join
56 59 if (
$destination | path exists) {
61 + force_slink
$source $bin 57 62 print $
'($manifest.name)/($manifest.organisation) already installed. Doing nothing.' 77 82 if (not (
$artifact_path | path exists)) {
78 83 http get --raw --max-time 30sec
$url | save --progress --raw
$artifact_path 82 87 extractor unpack
$artifact_path $destination 84 - let bin =
$manifest.'relative binary path' 85 89 if (
$bin | is-empty) {
86 90 print $
"Manifest for ($manifest.organisation)/($manifest.name) contains to binary path." 89 - let source = [
$destination $bin] | path join
90 93 if ( not (
$source | path exists)) {
91 94 error make { msg: $
"Faulty manifest! Relative binary path [($source)] points to non-existent path in ($destination)." }
96 + force_slink
$source $bin 94 103 match (
$source | path type) {
96 - let target = ([(folders binaries) (
$bin | path basename)] | path join)
105 + let target = ([(folders binaries) (
$target | path basename)] | path join)
97 106 print $
'Linking ($source) to ($target)' 107 + if (
$target | path exists) {
98 110 slink
$source $target 107 119 let target = ([(folders binaries) (
$file | path basename)] | path join)
120 + print $
'Linking ($source) to ($target)' 121 + if (
$target | path exists) {
108 124 slink (
$file | path expand)
$target nushell/modules/package/path.nu
Deleteddeleted file mode 100644 6 -export def --env set-system-path [] {
7 - let bin = (folders binaries)
8 - match $nu.os-info.family {
10 - if (
$env.PATH | find
$bin | is-empty) {
11 - let envd = [
$nu.home-dir .config environment.d] | path join
12 - if(not (
$envd | path exists)) {
13 - error make {msg: $
"systemd environment.d must exist under ($envd)!"}
15 - let packgage_path = $
'PATH = "$PATH:($bin)"' 16 - $packgage_path | save --raw ([
$envd package.conf] | path join)
17 - $env | upsert PATH
$bin 21 - if (
$env.Path | find
$bin | is-empty ) {
23 - $newPath = [Environment]::GetEnvironmentVariable\(\"Path\", \"User\"\) + \";(
$bin)\"
24 - [Environment]::SetEnvironmentVariable\(\
"Path\", $newPath, \"User\"\)" 25 - run-external powershell
'-EncodedCommand' (
$ps_command | endode base64)
26 - $env | upsert Path
$bin nushell/modules/package/provider.nu
Modified 11 +use ./environment_path.nu
14 14 export def provision [] {
46 + environment_path setup