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": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708296515, "lastModified": 1708296515,
@ -36,24 +18,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "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", "root": "root",

View File

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