Created
December 12, 2024 13:14
-
-
Save jcaesar/4612c9a2051397aa2195c49a6d5902bb to your computer and use it in GitHub Desktop.
copy flake and apply
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nu | |
def main [target: string] { | |
cd $env.FILE_PWD | |
let flakemeta = nix flake metadata --json | from json | |
let flakepath = $"path:($flakemeta.path)?($flakemeta.locked | select -i lastModified narHash rev revCount | url build-query)" | |
let sshopts = [-q -oCompression=yes -oControlMaster=auto -oControlPath=/tmp/ssh-check-nix-build-%C -oControlPersist=60] | |
$env.NIX_SSHOPTS = $sshopts | str join " " | |
nix copy --to ssh://($target) $flakemeta.path | |
ssh -tt ...$sshopts $target nh os switch -Ra $"'($flakepath)'" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment