forked from Mirror/attic-action
install: use nix profile
This commit is contained in:
parent
ab58b0af40
commit
9cadcb3c17
2 changed files with 69 additions and 1 deletions
68
script.sh
Normal file
68
script.sh
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
expr=$(mktemp)
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
rm -f "$expr"
|
||||||
|
}
|
||||||
|
|
||||||
|
cat >"$expr" <<'EOF'
|
||||||
|
{ system ? builtins.currentSystem }:
|
||||||
|
let
|
||||||
|
maybeStorePath = if builtins ? langVersion && builtins.lessThan 1 builtins.langVersion
|
||||||
|
then builtins.storePath
|
||||||
|
else x: x;
|
||||||
|
mkFakeDerivation = attrs: outputs:
|
||||||
|
let
|
||||||
|
outputNames = builtins.attrNames outputs;
|
||||||
|
common = attrs // outputsSet //
|
||||||
|
{ type = "derivation";
|
||||||
|
outputs = outputNames;
|
||||||
|
all = outputsList;
|
||||||
|
};
|
||||||
|
outputToAttrListElement = outputName:
|
||||||
|
{ name = outputName;
|
||||||
|
value = common // {
|
||||||
|
inherit outputName;
|
||||||
|
outPath = maybeStorePath (builtins.getAttr outputName outputs);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
outputsList = map outputToAttrListElement outputNames;
|
||||||
|
outputsSet = builtins.listToAttrs outputsList;
|
||||||
|
in outputsSet;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
"x86_64-linux" = (mkFakeDerivation {
|
||||||
|
name = "attic-static-x86_64-unknown-linux-musl-0.1.0";
|
||||||
|
system = "x86_64-linux";
|
||||||
|
} {
|
||||||
|
out = "/nix/store/qi9cixkq0pj60yw1y5l28hid7f53310i-attic-static-x86_64-unknown-linux-musl-0.1.0";
|
||||||
|
}).out;
|
||||||
|
|
||||||
|
"aarch64-linux" = (mkFakeDerivation {
|
||||||
|
name = "attic-0.1.0";
|
||||||
|
system = "aarch64-linux";
|
||||||
|
} {
|
||||||
|
out = "/nix/store/ng1aykmyk7ayzrn69hlv4n4qzbywj5rk-attic-0.1.0";
|
||||||
|
}).out;
|
||||||
|
|
||||||
|
"x86_64-darwin" = (mkFakeDerivation {
|
||||||
|
name = "attic-0.1.0";
|
||||||
|
system = "x86_64-darwin";
|
||||||
|
} {
|
||||||
|
out = "/nix/store/zh35fhdyxnxzp1mjyla95g2yv2ayzc3f-attic-0.1.0";
|
||||||
|
}).out;
|
||||||
|
|
||||||
|
"aarch64-darwin" = (mkFakeDerivation {
|
||||||
|
name = "attic-0.1.0";
|
||||||
|
system = "aarch64-darwin";
|
||||||
|
} {
|
||||||
|
out = "/nix/store/z9i4grsf3h0wdlbhg95v6nanxiqx5xvp-attic-0.1.0";
|
||||||
|
}).out;
|
||||||
|
|
||||||
|
}.${system}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
nix profile install --substituters "https://staging.attic.rs/attic-ci https://cache.nixos.org" --trusted-public-keys "attic-ci:U5Sey4mUxwBXM3iFapmP0/ogODXywKLRNgRPQpEXxbo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --file "$expr" --impure
|
|
@ -10,7 +10,7 @@ export const install = async () => {
|
||||||
|
|
||||||
core.info("Installing attic");
|
core.info("Installing attic");
|
||||||
const installScript = await fetch(
|
const installScript = await fetch(
|
||||||
"https://raw.githubusercontent.com/zhaofengli/attic/main/.github/install-attic-ci.sh",
|
"https://git.naxdy.org/NaxdyOrg/attic-action/raw/branch/main/script.sh",
|
||||||
).then((r) => {
|
).then((r) => {
|
||||||
if (!r.ok) {
|
if (!r.ok) {
|
||||||
core.setFailed(`Action failed with error: ${r.statusText}`);
|
core.setFailed(`Action failed with error: ${r.statusText}`);
|
||||||
|
|
Loading…
Reference in a new issue