Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,68 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Check rustfmt
run: nix develop --command cargo fmt -- --check
- uses: actions/checkout@v6
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Check rustfmt
run: nix develop --command cargo fmt -- --check

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Build
run: nix build -L
- uses: actions/checkout@v6
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Build
run: nix build -L

NixFlakeCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: DeterminateSystems/flake-checker-action@main
with:
fail-mode: false
- uses: actions/checkout@v6
- uses: DeterminateSystems/flake-checker-action@main
with:
fail-mode: false

NixFormatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Check nixpkgs-fmt formatting
run: nix develop --command sh -c "git ls-files '*.nix' | xargs nixpkgs-fmt --check"
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Check Nix formatting
run: nix develop --command sh -c "git ls-files '*.nix' | xargs nixfmt check"

EditorConfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: greut/eclint-action@v0

ValidateJsonSchema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Validate JSON Schema
run: nix develop --command jv ./schema.json
- name: Validate JSON Schema against example
run: nix develop --command jv ./schema.json ./bootspec/rfc0125_spec.json
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Validate JSON Schema
run: nix develop --command jv ./schema.json
- name: Validate JSON Schema against example
run: nix develop --command jv ./schema.json ./bootspec/rfc0125_spec.json

SynthesizeIntegration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Verify synthesize integration test still passes
run: nix develop -c ./synthesize/integration-test-cases/verify.sh
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Verify synthesize integration test still passes
run: nix develop -c ./synthesize/integration-test-cases/verify.sh
38 changes: 19 additions & 19 deletions .github/workflows/json-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ jobs:
pages: write
id-token: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Set up GitHub Pages
uses: actions/configure-pages@v5
- name: Generate JSON Schema docs
id: generate
run: |
mkdir -p dist
nix develop --command generate-schema-doc --config expand_buttons=true schema.json dist/index.html
- name: Upload docs
uses: actions/upload-pages-artifact@v4
with:
path: ./dist
- name: Publish docs to GitHub Pages
id: publish
uses: actions/deploy-pages@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: Set up GitHub Pages
uses: actions/configure-pages@v5
- name: Generate JSON Schema docs
id: generate
run: |
mkdir -p dist
nix develop --command generate-schema-doc --config expand_buttons=true schema.json dist/index.html
- name: Upload docs
uses: actions/upload-pages-artifact@v4
with:
path: ./dist
- name: Publish docs to GitHub Pages
id: publish
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions .github/workflows/update-flake-lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: update-flake-lock
on:
workflow_dispatch: # enable manual triggering
schedule:
- cron: '0 0 * * 0' # every Sunday at midnight
- cron: "0 0 * * 0" # every Sunday at midnight

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: DeterminateSystems/determinate-nix-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- uses: DeterminateSystems/update-flake-lock@main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: update-flake-lock
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Check flake
uses: DeterminateSystems/flake-checker-action@main
with:
Expand Down
18 changes: 12 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
(import
(fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
})
{ src = ./.; }).defaultNix
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
nodeName = lock.nodes.root.inputs.flake-compat;
in
fetchTarball {
url =
lock.nodes.${nodeName}.locked.url
or "https://github.com/NixOS/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
sha256 = lock.nodes.${nodeName}.locked.narHash;
}
) { src = ./.; }).defaultNix
33 changes: 23 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 60 additions & 41 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,49 +1,68 @@
{
description = "bootloader-experimentation";
description = "Bootspec: an implementation of RFC-0125's data type and synthesis tooling";

inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1";
};

outputs = inputs:
outputs =
{ self, ... }@inputs:
let
nameValuePair = name: value: { inherit name value; };
genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];

forAllSystems = f: genAttrs allSystems (system: f {
inherit system;
pkgs = import inputs.nixpkgs { inherit system; };
});
inherit (inputs.nixpkgs) lib;

supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];

forEachSupportedSystem =
f:
lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = import inputs.nixpkgs { inherit system; };
}
);
in
{
devShell = forAllSystems ({ system, pkgs, ... }:
pkgs.mkShell {
name = "bootspec";

buildInputs = with pkgs; [
cargo
rustc
clippy
codespell
nixpkgs-fmt
rustfmt
jsonschema # provides the jv tool
json-schema-for-humans # provides the generate-schema-doc tool
];
});

packages = forAllSystems
({ system, pkgs, ... }:
{
package = pkgs.rustPlatform.buildRustPackage rec {
pname = "bootspec";
version = "unreleased";

src = inputs.self;

cargoLock.lockFile = ./Cargo.lock;
};
});

defaultPackage = forAllSystems ({ system, ... }: inputs.self.packages.${system}.package);
devShells = forEachSupportedSystem (
{ pkgs, system }:
{
default = pkgs.mkShell {
name = "bootspec";

packages = with pkgs; [
cargo
rustc
clippy
codespell
rustfmt
jsonschema # provides the jv tool
json-schema-for-humans # provides the generate-schema-doc tool
self.formatter.${system}
];
};
}
);

packages = forEachSupportedSystem (
{ pkgs, system }:
{
default = self.packages.${system}.bootspec;
bootspec = pkgs.rustPlatform.buildRustPackage {
pname = "bootspec";
version = "unreleased";

src = self;

cargoLock.lockFile = ./Cargo.lock;
};
}
);

formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt);
};
}
18 changes: 12 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
(import
(fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
})
{ src = ./.; }).shellNix
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
nodeName = lock.nodes.root.inputs.flake-compat;
in
fetchTarball {
url =
lock.nodes.${nodeName}.locked.url
or "https://github.com/NixOS/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
sha256 = lock.nodes.${nodeName}.locked.narHash;
}
) { src = ./.; }).shellNix
13 changes: 8 additions & 5 deletions synthesize/integration-test-cases/21.11-specialisations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ in
configuration = {
imports = [
"${src}/nixos/modules/virtualisation/qemu-vm.nix"
({ pkgs, ... }: {
specialisation.example.configuration = {
environment.systemPackages = [ pkgs.hello ];
};
})
(
{ pkgs, ... }:
{
specialisation.example.configuration = {
environment.systemPackages = [ pkgs.hello ];
};
}
)
];
};
}).config.system.build.toplevel
Loading