Skip to content

Commit 1a0c35d

Browse files
committed
ci(nix): add flake and dedicated CI job for reproducible builds
- Enable fully reproducible builds via flake.nix - Allow Nix users to build/run sso-mib-tool without manual setup - Add GitHub Actions job running inside Nix to detect implicit dependencies and non-portable compiler assumptions Signed-off-by: Michael Adler <michael.adler@siemens.com>
1 parent 3c5dcdb commit 1a0c35d

6 files changed

Lines changed: 172 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
reuse lint
3939
40-
build:
40+
build-ubuntu:
4141
runs-on: ubuntu-24.04
4242
steps:
4343
- name: checkout repository
@@ -72,6 +72,18 @@ jobs:
7272
with:
7373
path: build/api/
7474

75+
build-nix:
76+
runs-on: ubuntu-24.04
77+
steps:
78+
- name: checkout repository
79+
uses: actions/checkout@v4
80+
with:
81+
fetch-depth: 0
82+
- name: Install Nix
83+
uses: cachix/install-nix-action@v31
84+
- name: Build with Nix
85+
run: nix build
86+
7587
package:
7688
strategy:
7789
matrix:
@@ -145,7 +157,7 @@ jobs:
145157
146158
deploy:
147159
runs-on: ubuntu-24.04
148-
needs: build
160+
needs: build-ubuntu
149161
permissions:
150162
pages: write
151163
id-token: write

REUSE.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SPDX-FileCopyrightText = "2025 Siemens AG"
1010
SPDX-License-Identifier = "MIT"
1111

1212
[[annotations]]
13-
path = ["README.md", "dbus/spec/com.microsoft.identity.broker1.xml"]
13+
path = ["README.md", "dbus/spec/com.microsoft.identity.broker1.xml", "flake.lock"]
1414
precedence = "aggregate"
1515
SPDX-FileCopyrightText = "2025 Siemens AG"
1616
SPDX-License-Identifier = "MIT"

flake.lock

Lines changed: 42 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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-FileCopyrightText: (C) 2025 Siemens
2+
# SPDX-License-Identifier: MIT
3+
{
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-25.05";
5+
6+
outputs =
7+
{
8+
self,
9+
nixpkgs,
10+
systems,
11+
...
12+
}@inputs:
13+
let
14+
inherit (nixpkgs) lib;
15+
eachSystem = lib.genAttrs (import systems);
16+
pkgsFor = eachSystem (
17+
system:
18+
import nixpkgs {
19+
localSystem.system = system;
20+
overlays = with self.overlays; [ default ];
21+
}
22+
);
23+
in
24+
{
25+
overlays = import ./nix/overlays.nix { inherit inputs lib self; };
26+
27+
packages = eachSystem (system: {
28+
default = self.packages.${system}.sso-mib;
29+
inherit (pkgsFor.${system}) sso-mib;
30+
});
31+
32+
};
33+
}

nix/overlays.nix

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-FileCopyrightText: (C) 2025 Siemens
2+
# SPDX-License-Identifier: MIT
3+
{
4+
lib,
5+
inputs,
6+
self,
7+
}:
8+
9+
let
10+
mkDate =
11+
longDate:
12+
(lib.concatStringsSep "-" [
13+
(builtins.substring 0 4 longDate)
14+
(builtins.substring 4 2 longDate)
15+
(builtins.substring 6 2 longDate)
16+
]);
17+
18+
lines = lib.strings.splitString "\n" (builtins.readFile ../meson.build);
19+
matchVersion = lib.strings.match "[ ]*version[ ]*:.*([0-9]+\.[0-9]+\.[0-9]+).*";
20+
version = builtins.head (
21+
lib.lists.findFirst (x: !builtins.isNull x) "git" (lib.lists.map matchVersion lines)
22+
);
23+
in
24+
25+
{
26+
default = inputs.self.overlays.sso-mib;
27+
sso-mib = final: prev: {
28+
sso-mib = prev.callPackage ./sso-mib.nix {
29+
version =
30+
version
31+
+ "+date="
32+
+ (mkDate (inputs.self.lastModifiedDate or "19700101"))
33+
+ "_"
34+
+ (inputs.self.shortRev or "dirty");
35+
};
36+
};
37+
}

nix/sso-mib.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPDX-FileCopyrightText: (C) 2025 Siemens
2+
# SPDX-License-Identifier: MIT
3+
{
4+
lib,
5+
stdenv,
6+
meson,
7+
ninja,
8+
pkg-config,
9+
libjwt,
10+
libuuid,
11+
glib,
12+
json-glib,
13+
version ? "git",
14+
}:
15+
16+
stdenv.mkDerivation {
17+
pname = "sso-mib";
18+
inherit version;
19+
20+
src = ../.;
21+
22+
nativeBuildInputs = [
23+
pkg-config
24+
meson
25+
ninja
26+
];
27+
28+
buildInputs = [
29+
libjwt
30+
libuuid
31+
glib
32+
json-glib
33+
];
34+
35+
meta = with lib; {
36+
homepage = "https://github.com/siemens/sso-mib";
37+
description = "C library to interact with a locally running microsoft-identity-broker to get various authentication tokens via DBus.";
38+
maintainers = [ maintainers.michaeladler ];
39+
platforms = platforms.all;
40+
license = [
41+
licenses.gpl2Only
42+
licenses.lgpl21Only
43+
];
44+
};
45+
}

0 commit comments

Comments
 (0)