Skip to content

Commit

Permalink
- deconcur
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Mar 6, 2024
1 parent b8009f8 commit 52a2df9
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions f
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,43 @@ const map = [

const hosts = $map.name

let get_map = { |per| $map | filter {|i| $i.name == $per } }
let get_map = { |per| $map | where name == $per }

let get_addr = { |b| do $get_map $b | $in.addr.0 }

def "main p" [
target: string
nodes?: list<string> = $hosts
node?: string
] {
let drv = { |name| nix eval --raw $'.#nixosConfigurations.($name).config.age.rekey.derivation' }

let push = { |t_addr, path| nix copy --substitute-on-destination --to $'ssh://($t_addr)' $path -vvv }

let target_addr = do $get_addr $target

$map |
par-each {
|per|
let name = $per.name
if $name in $nodes {

do $push ($target_addr) (do $drv $per.name)

}
}
do $push ($target_addr) (do $drv $node)
}

def "main b" [
nodes?: list<string> = $hosts
node?: string
--builder (-b): string = "hastur"
] {

let target_addr = do $get_addr $builder

$map |
par-each {
|per|
let name = $per.name
if $name in $nodes {
nom build $'.#nixosConfigurations.($name).config.system.build.toplevel' --builders $"($target_addr)"
}
}
nom build $'.#nixosConfigurations.($node).config.system.build.toplevel' --builders $"($target_addr)"

}

def "main d" [
nodes?: list<string> = $hosts
node?: string
mode?: string = "switch"
--builder (-b): string = "hastur"
] {

let builder_addr = do $get_addr $builder

$map |
par-each {
|per|
let name = $per.name
if $name in $nodes {
nixos-rebuild $mode --flake $'.#($name)' --target-host (do $get_addr $name) --build-host $"($builder_addr)" --use-remote-sudo
}
}
nixos-rebuild $mode --flake $'.#($node)' --target-host (do $get_addr $node) --build-host $"($builder_addr)" --use-remote-sudo

}

Expand Down

0 comments on commit 52a2df9

Please sign in to comment.