Compare commits

...

16 Commits

Author SHA1 Message Date
Graham Christensen c5a866b6ab Update to determinate by default (#208)
* Update to determinate by default

Implements https://github.com/DeterminateSystems/nix-src/issues/201

* Fixup the version verification script
2025-11-10 09:48:50 -05:00
Graham Christensen 89b1f59ae9 Drop x86_64-darwin (#207)
* Drop x86_64-darwin

Implements https://github.com/DeterminateSystems/nix-src/issues/224

* Force back to v3.12.2 for users who don't otherwise specify a tag

* ci: don't try to render the devshell on intel macOS

* Try an error?

* Update messaging to be more action-oriented
2025-11-09 22:55:22 -05:00
Luc Perkins 86a5f59de1 Merge pull request #206 from detsys-pr-bot/detsys-ts-update-cb28f5861548d8a85d054c4d6e8e0cd3d3c94329
Update `detsys-ts`: Merge pull request #114 from DeterminateSystems/dependabot/npm_and_yarn/npm-deps-47c548f420
2025-11-07 13:02:42 -03:00
lucperkins 64a1e1d1cb Update detsys-ts for: Merge pull request #114 from DeterminateSystems/dependabot/npm_and_yarn/npm-deps-47c548f420 (cb28f5861548d8a85d054c4d6e8e0cd3d3c94329) 2025-11-07 15:52:50 +00:00
Graham Christensen 2fd3724578 If determinate is false, pass --prefer-upstream (#202)
* If determinate is false, pass --prefer-upstream

* Regenerate

* Update to an installer version that supports preferring upstream

* Delete the rev test, since rev uploads appoar to have broken a long time ago

* Fixup: expect upstream nix at the moment
2025-10-24 22:24:28 -04:00
Luc Perkins 45a18a6995 Merge pull request #203 from detsys-pr-bot/detsys-ts-update-285768c0d657f9709cb689893f12895c36923093
Update `detsys-ts`: Merge pull request #109 from DeterminateSystems/tsup-to-tsdown
2025-09-12 14:50:59 +02:00
lucperkins d3ddf0223c Update detsys-ts for: Merge pull request #109 from DeterminateSystems/tsup-to-tsdown (285768c0d657f9709cb689893f12895c36923093) 2025-09-12 12:39:38 +00:00
gustavderdrache 786fff0690 Apply fixups from CodeRabbit review (#200) 2025-09-09 10:54:24 -04:00
gustavderdrache f161ab07ed Treat FlakeHub logins as a funnel (#199) 2025-09-09 10:40:05 -04:00
gustavderdrache 61ce7897f4 Merge pull request #198 from DeterminateSystems/gustavderdrache/push-mzwwpswkrrup
Record events if authentication is skipped
2025-09-09 09:58:05 -04:00
gustavderdrache 44f3801e21 Improve messages for when auth isn't available 2025-09-09 09:48:10 -04:00
gustavderdrache cb6d4e86fa Standardize login failure events 2025-09-09 09:44:32 -04:00
gustavderdrache e686131f84 Record events if authentication is skipped 2025-09-08 16:04:19 -04:00
Graham Christensen 2c3a2981f1 Report the number of nix builds that passed / failed (#196)
* Report the number of nix builds that passed / failed

* Upgrade
2025-09-03 12:03:09 -04:00
detsys-pr-bot 18b667a294 Update detsys-ts for: Capture the version of Nix in addition to the nix store version (#108) (c7303495f43d348cac78091ef434443b1ef22485) (#197)
Co-authored-by: grahamc <76716+grahamc@users.noreply.github.com>
2025-09-03 15:37:20 +00:00
detsys-pr-bot 428f3c64a3 Update detsys-ts for: Merge pull request #106 from DeterminateSystems/fix-dependabot-warning (6d3f1c5a5781e58b3cd8060cfb578c0c95eeb51e) (#194)
Co-authored-by: lucperkins <1523104+lucperkins@users.noreply.github.com>
2025-07-30 15:59:25 +00:00
9 changed files with 36063 additions and 30315 deletions
+1 -2
View File
@@ -7,9 +7,8 @@ EXPECTED_VERSION="${1}"
INSTALLED_NIX_VERSION_OUTPUT=$(nix --version)
INSTALLED_NIX_VERSION=$(echo "${INSTALLED_NIX_VERSION_OUTPUT}" | awk '{print $NF}')
EXPECTED_OUTPUT="nix (Nix) ${EXPECTED_VERSION}"
if [ "${INSTALLED_NIX_VERSION_OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
if [ "${INSTALLED_NIX_VERSION}" != "${EXPECTED_VERSION}" ]; then
echo "Nix version ${INSTALLED_NIX_VERSION} didn't match expected version ${EXPECTED_VERSION}"
exit 1
else
+4 -8
View File
@@ -78,7 +78,7 @@ jobs:
run: echo $PATH
- name: Render the devshell
if: success() || failure()
if: (success() || failure()) && matrix.runner != 'macos-13-large' && matrix.runner != 'macos-14-large'
run: |
nix develop --command date
@@ -150,14 +150,10 @@ jobs:
strategy:
matrix:
inputs:
# https://github.com/DeterminateSystems/nix-installer/blob/v0.18.0
# https://github.com/DeterminateSystems/nix-installer/blob/v3.11.3
- key: url
value: https://github.com/DeterminateSystems/nix-installer/releases/download/v0.18.0/nix-installer-x86_64-linux
nix-version: "2.21.2"
# https://github.com/DeterminateSystems/nix-installer/tree/7011c077ec491da410fbc39f68676b0908b9ce7e
- key: revision
value: 7011c077ec491da410fbc39f68676b0908b9ce7e
nix-version: "2.19.2"
value: https://github.com/DeterminateSystems/nix-installer/releases/download/v3.11.3/nix-installer-x86_64-linux
nix-version: "2.31.2" # 3.11.3 is based on 2.31.2
steps:
- uses: actions/checkout@v4
+1 -1
View File
@@ -96,7 +96,7 @@ Differing from the upstream [Nix](https://github.com/NixOS/nix) installer script
| Parameter | Description | Type | Default |
| :---------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------- | :------------------------------------------------------------- |
| `backtrace` | The setting for [`RUST_BACKTRACE`][backtrace] | string | |
| `determinate` | Whether to install [Determinate Nix](https://determinate.systems/enterprise) and log in to FlakeHub for private Flakes and binary caches. | Boolean | `false` |
| `determinate` | Whether to install [Determinate Nix](https://determinate.systems/enterprise) and log in to FlakeHub for private Flakes and binary caches. | Boolean | `true` |
| `extra-args` | Extra arguments to pass to the planner (prefer using structured `with:` arguments unless using a custom [planner]!) | string | |
| `extra-conf` | Extra configuration lines for `/etc/nix/nix.conf` (includes `access-tokens` with `secrets.GITHUB_TOKEN` automatically if `github-token` is set) | string | |
| `flakehub` | Deprecated. Implies `determinate`. | Boolean | `false` |
+1 -1
View File
@@ -10,7 +10,7 @@ inputs:
determinate:
description: |
Whether to install [Determinate Nix](https://determinate.systems/enterprise) and log in to FlakeHub for private Flakes and binary caches.
default: false
default: true
extra-args:
description: Extra args to pass to the planner (prefer using structured `with:` arguments unless using a custom planner!)
required: false
Generated Vendored
+35400 -29739
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -9,7 +9,7 @@
outputs = { self, flake-schemas, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-darwin" "aarch64-linux" "x86_64-darwin" ];
supportedSystems = [ "x86_64-linux" "aarch64-darwin" "aarch64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
+5 -5
View File
@@ -30,23 +30,23 @@
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.1",
"detsys-ts": "github:DeterminateSystems/detsys-ts",
"got": "^14.4.7",
"got": "^14.6.2",
"string-argv": "^0.3.2",
"vitest": "^3.2.4"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^20.19.7",
"@types/node": "^20.19.24",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@vercel/ncc": "^0.38.3",
"@vercel/ncc": "^0.38.4",
"eslint": "^8.57.1",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-prettier": "^5.5.4",
"prettier": "^3.6.2",
"tsup": "^8.5.0",
"typescript": "^5.8.3"
"typescript": "^5.9.3"
}
}
+585 -549
View File
File diff suppressed because it is too large Load Diff
+65 -9
View File
@@ -12,7 +12,7 @@ import got from "got";
import { setTimeout } from "node:timers/promises";
import { getFixHashes } from "./fixHashes.js";
import { annotateMismatches } from "./annotate.js";
import { getRecentEvents } from "./events.js";
import { DEvent, getRecentEvents } from "./events.js";
import { makeMermaidReport } from "./mermaid.js";
import { summarizeFailures } from "./failuresummary.js";
import { SpawnOptions, spawn } from "node:child_process";
@@ -20,12 +20,15 @@ import { SpawnOptions, spawn } from "node:child_process";
// Nix installation events
const EVENT_INSTALL_NIX_FAILURE = "install_nix_failure";
const EVENT_INSTALL_NIX_START = "install_nix_start";
const EVENT_INSTALL_NIX_SUCCESS = "install_nix_start";
const EVENT_INSTALL_NIX_SUCCESS = "install_nix_success";
const EVENT_SETUP_KVM = "setup_kvm";
const EVENT_UNINSTALL_NIX = "uninstall";
// FlakeHub events
const EVENT_LOGIN_TO_FLAKEHUB = "login_to_flakehub";
const EVENT_LOGIN_START = "flakehub-login:start";
const EVENT_LOGIN_FAILURE = "flakehub-login:failure";
const EVENT_LOGIN_SUCCESS = "flakehub-login:success";
const EVENT_LOGIN_END = "flakehub-login:end";
// Other events
const EVENT_CONCLUDE_JOB = "conclude_job";
@@ -45,6 +48,7 @@ const FACT_SENT_SIGTERM = "sent_sigterm";
// Flags
const FLAG_DETERMINATE = "--determinate";
const FLAG_PREFER_UPSTREAM_NIX = "--prefer-upstream-nix";
// Pre/post state keys
const STATE_DAEMONDIR = "DNI_DAEMONDIR";
@@ -86,6 +90,20 @@ class NixInstallerAction extends DetSysAction {
runnerOs: string | undefined;
constructor() {
if (platform.getArchOs() === "X64-macOS") {
// Holy guacamole this is ugly
actionsCore.error(
"Determinate Nix Installer no longer supports macOS on Intel. Please migrate to Apple Silicon, and use Nix's built-in Rosetta support to build for Intel. See: https://github.com/DeterminateSystems/nix-src/issues/224",
);
const sourceTag = inputs.getStringOrUndefined("source-tag");
if (sourceTag === undefined) {
actionsCore.notice(
"Pinning the installer tag to v3.12.2 (the last version to support Intel Macs) as a temporary fallback.",
);
process.env["INPUT_SOURCE-TAG"] = "v3.12.2";
}
}
super({
name: "nix-installer",
fetchStyle: "nix-style",
@@ -138,10 +156,10 @@ class NixInstallerAction extends DetSysAction {
}
async main(): Promise<void> {
actionsCore.saveState(STATE_START_DATETIME, new Date().toISOString());
await this.scienceDebugFly();
await this.detectAndForceNoSystemd();
await this.install();
actionsCore.saveState(STATE_START_DATETIME, new Date().toISOString());
}
async post(): Promise<void> {
@@ -282,7 +300,7 @@ class NixInstallerAction extends DetSysAction {
}
if (this.nixBuildUserBase !== null) {
executionEnv.NIX_INSTALLER_NIX_BUILD_USER_ID_BASE = `${this.nixBuildUserCount}`;
executionEnv.NIX_INSTALLER_NIX_BUILD_USER_ID_BASE = `${this.nixBuildUserBase}`;
}
if (this.nixPackageUrl !== null) {
@@ -429,6 +447,8 @@ class NixInstallerAction extends DetSysAction {
if (this.extraArgs && !this.extraArgs.includes(FLAG_DETERMINATE)) {
args.push(FLAG_DETERMINATE);
}
} else {
args.push(FLAG_PREFER_UPSTREAM_NIX);
}
return args;
@@ -616,6 +636,8 @@ class NixInstallerAction extends DetSysAction {
const startDate = new Date(actionsCore.getState(STATE_START_DATETIME));
const { events, hasMismatches } = await getRecentEvents(startDate);
await this.reportPassFailCount(events);
const mermaidSummary = makeMermaidReport(events);
const failureSummary = await summarizeFailures(events);
@@ -666,6 +688,29 @@ class NixInstallerAction extends DetSysAction {
}
}
async reportPassFailCount(events: DEvent[]): Promise<void> {
let built = 0;
let failed = 0;
let unknown = 0;
for (const event of events) {
switch (event.c) {
case "BuiltPathResponseEventV1":
built++;
break;
case "BuildFailureResponseEventV1":
failed++;
break;
default:
unknown++;
}
}
this.addFact("nix_builds_succeeded", built);
this.addFact("nix_builds_failed", failed);
this.addFact("nix_builds_unknown_event", unknown);
}
async setGithubPath(): Promise<void> {
// Interim versions of the `nix-installer` crate may have already manipulated `$GITHUB_PATH`, as root even! Accessing that will be an error.
try {
@@ -690,6 +735,8 @@ class NixInstallerAction extends DetSysAction {
}
async flakehubLogin(): Promise<void> {
this.recordEvent(EVENT_LOGIN_START);
const canLogin =
process.env["ACTIONS_ID_TOKEN_REQUEST_URL"] &&
process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];
@@ -700,14 +747,20 @@ class NixInstallerAction extends DetSysAction {
const head = pr?.head?.repo?.full_name;
if (pr && base !== head) {
this.recordEvent(EVENT_LOGIN_FAILURE, { reason: "fork" });
this.recordEvent(EVENT_LOGIN_END);
actionsCore.info(
`Not logging in to FlakeHub: GitHub Actions does not allow OIDC authentication from forked repositories ("${head}" is not the same repository as "${base}").`,
`FlakeHub is disabled because this is a fork. GitHub Actions does not allow OIDC authentication from forked repositories ("${head}" is not from the same repository as "${base}").`,
);
return;
}
this.recordEvent(EVENT_LOGIN_FAILURE, { reason: "not-configured" });
this.recordEvent(EVENT_LOGIN_END);
actionsCore.info(
`Not logging in to FlakeHub: GitHub Actions has not provided OIDC token endpoints; please make sure that \`id-token: write\` and \`contents: read\` are set for this step's (or job's) permissions.`,
"FlakeHub is disabled because the workflow is misconfigured. Please make sure that `id-token: write` and `contents: read` are set for this step's (or job's) permissions so that GitHub Actions provides OIDC token endpoints.",
);
actionsCore.info(
`For more information, see https://docs.determinate.systems/guides/github-actions/#nix-installer-action`,
@@ -716,15 +769,18 @@ class NixInstallerAction extends DetSysAction {
}
actionsCore.startGroup("Logging in to FlakeHub");
this.recordEvent(EVENT_LOGIN_TO_FLAKEHUB);
try {
await actionsExec.exec(`determinate-nixd`, ["login", "github-action"]);
this.recordEvent(EVENT_LOGIN_SUCCESS);
} catch (e: unknown) {
actionsCore.warning(`FlakeHub Login failure: ${stringifyError(e)}`);
this.recordEvent("flakehub-login:failure", {
this.recordEvent(EVENT_LOGIN_FAILURE, {
reason: "failed",
exception: stringifyError(e),
});
}
this.recordEvent(EVENT_LOGIN_END);
actionsCore.endGroup();
}