Skip to content

Commit 6f399be

Browse files
committed
nix: switch to flake
1 parent 04a7307 commit 6f399be

File tree

7 files changed

+62
-231
lines changed

7 files changed

+62
-231
lines changed

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
use nix
1+
use flake

.github/workflows/integrationtest.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@ jobs:
2626
steps:
2727
- name: Check out
2828
uses: actions/checkout@v4
29-
- uses: cachix/install-nix-action@v30
30-
with:
31-
# This channel is only required to invoke "nix-shell".
32-
# Everything inside that nix-shell will use a pinned version of
33-
# nixpkgs.
34-
nix_path: nixpkgs=channel:nixos-23.11
35-
- uses: DeterminateSystems/magic-nix-cache-action@main
29+
- uses: cachix/install-nix-action@v31
3630
- name: Set up cargo cache
3731
uses: actions/cache@v4
3832
continue-on-error: false
@@ -48,6 +42,6 @@ jobs:
4842
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }}
4943
# Have all the "copying into Nix store" messages in a dedicated step for
5044
# better log visibility.
51-
- run: nix-shell --run "echo OK"
45+
- run: nix develop --command bash -c "echo OK"
5246
# Now, run the actual test.
53-
- run: nix-shell --run run-integrationtest
47+
- run: nix develop --command bash -c "run-integrationtest"

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
description = "multiboot2-rs";
3+
4+
inputs = {
5+
# We follow the latest stable release of nixpkgs
6+
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
7+
};
8+
9+
outputs =
10+
inputs@{ self, nixpkgs, ... }:
11+
let
12+
# Systems definition for dev shells and exported packages,
13+
# independent of the NixOS configurations and modules defined here. We
14+
# just use "every system" here to not restrict any user. However, it
15+
# likely happens that certain packages don't build for/under certain
16+
# systems.
17+
systems = nixpkgs.lib.systems.flakeExposed;
18+
forAllSystems =
19+
function: nixpkgs.lib.genAttrs systems (system: function nixpkgs.legacyPackages.${system});
20+
in
21+
{
22+
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
23+
devShells = forAllSystems (pkgs: {
24+
default = import ./shell.nix {
25+
inherit pkgs;
26+
};
27+
});
28+
};
29+
}

nix/sources.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

nix/sources.nix

Lines changed: 0 additions & 198 deletions
This file was deleted.

shell.nix

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
let
2-
sources = import ./nix/sources.nix;
3-
pkgs = import sources.nixpkgs {};
4-
in
1+
{ pkgs ? import <nixpkgs> {} }:
2+
53
pkgs.mkShell rec {
64
packages = with pkgs; [
75
# general
@@ -18,9 +16,4 @@ pkgs.mkShell rec {
1816
./integration-test/run.sh
1917
'')
2018
];
21-
22-
# To invoke "nix-shell" in the CI-runner, we need a global Nix channel.
23-
# For better reproducibility inside the Nix shell, we override this channel
24-
# with the pinned nixpkgs version.
25-
NIX_PATH = "nixpkgs=${sources.nixpkgs}";
2619
}

0 commit comments

Comments
 (0)