Rewrite without systems import

This commit is contained in:
Andreas Zweili 2024-03-14 20:25:07 +01:00
parent 82fd375392
commit 3a173390b4
2 changed files with 32 additions and 60 deletions

View File

@ -1,23 +1,5 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1708296515,
@ -36,24 +18,8 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -2,36 +2,42 @@
description = "A simple flake to generate DKIM reports.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self, nixpkgs }:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
forEachSystem = nixpkgs.lib.genAttrs systems;
in
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
reports = pkgs.writeShellApplication {
name = "reports";
runtimeInputs = [
pkgs.dmarc-report-converter
pkgs.python3
];
text = (builtins.readFile ./reports.sh);
};
in
{
packages.dkim-report = reports;
packages.default = reports;
apps.dkim-report = {
packages = forEachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
dkim-report = pkgs.writeShellApplication {
name = "reports";
runtimeInputs = [
pkgs.dmarc-report-converter
pkgs.python3
];
text = (builtins.readFile ./reports.sh);
};
default = self.packages.${system}.dkim-report;
}
);
apps = forEachSystem (system: {
dkim-report = {
type = "app";
program = "${self.packages.${system}.dkim-report}/bin/reports";
};
apps.default = self.apps.${system}.dkim-report;
}
);
default = self.apps.${system}.dkim-report;
});
};
}