git.delta.rocks / jrsonnet / refs/commits / 914d5f43698e

difftreelog

ci use flake-parts

Yaroslav Bolyukin2024-06-18parent: #18dc4db.patch.diff
in: master

2 files changed

modifiedflake.lockdiffbeforeafterboth
20 "type": "github"20 "type": "github"
21 }21 }
22 },22 },
23 "flake-parts": {
24 "inputs": {
25 "nixpkgs-lib": [
26 "nixpkgs"
27 ]
28 },
29 "locked": {
30 "lastModified": 1717285511,
31 "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
32 "owner": "hercules-ci",
33 "repo": "flake-parts",
34 "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
35 "type": "github"
36 },
37 "original": {
38 "owner": "hercules-ci",
39 "repo": "flake-parts",
40 "type": "github"
41 }
42 },
23 "flake-utils": {43 "flake-utils": {
24 "inputs": {44 "inputs": {
25 "systems": "systems"45 "systems": "systems"
56 "root": {76 "root": {
57 "inputs": {77 "inputs": {
58 "crane": "crane",78 "crane": "crane",
59 "flake-utils": "flake-utils",79 "flake-parts": "flake-parts",
60 "nixpkgs": "nixpkgs",80 "nixpkgs": "nixpkgs",
61 "rust-overlay": "rust-overlay"81 "rust-overlay": "rust-overlay",
82 "shelly": "shelly"
62 }83 }
63 },84 },
64 "rust-overlay": {85 "rust-overlay": {
65 "inputs": {86 "inputs": {
66 "flake-utils": [87 "flake-utils": "flake-utils",
67 "flake-utils"
68 ],
69 "nixpkgs": [88 "nixpkgs": [
70 "nixpkgs"89 "nixpkgs"
71 ]90 ]
84 "type": "github"103 "type": "github"
85 }104 }
86 },105 },
106 "shelly": {
107 "inputs": {
108 "flake-parts": [
109 "flake-parts"
110 ],
111 "nixpkgs": [
112 "nixpkgs"
113 ]
114 },
115 "locked": {
116 "lastModified": 1718420551,
117 "narHash": "sha256-NU8NBXVPj0KuY4Tl/LtZPrbX3PmmmgPuhk/1pzm9cyk=",
118 "owner": "CertainLach",
119 "repo": "shelly",
120 "rev": "4f70221f3f9ad9058f590eefb25251b6760aaa47",
121 "type": "github"
122 },
123 "original": {
124 "owner": "CertainLach",
125 "repo": "shelly",
126 "type": "github"
127 }
128 },
87 "systems": {129 "systems": {
88 "locked": {130 "locked": {
89 "lastModified": 1681028828,131 "lastModified": 1681028828,
modifiedflake.nixdiffbeforeafterboth
--- a/flake.nix
+++ b/flake.nix
@@ -2,28 +2,42 @@
   description = "Jrsonnet";
   inputs = {
     nixpkgs.url = "github:nixos/nixpkgs";
-    flake-utils.url = "github:numtide/flake-utils";
     rust-overlay = {
       url = "github:oxalica/rust-overlay";
-      inputs = {
-        nixpkgs.follows = "nixpkgs";
-        flake-utils.follows = "flake-utils";
-      };
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    flake-parts = {
+      url = "github:hercules-ci/flake-parts";
+      inputs.nixpkgs-lib.follows = "nixpkgs";
     };
     crane = {
       url = "github:ipetkov/crane";
       inputs.nixpkgs.follows = "nixpkgs";
     };
+    shelly = {
+      url = "github:CertainLach/shelly";
+      inputs = {
+        flake-parts.follows = "flake-parts";
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
   };
-  outputs = {
+  outputs = inputs @ {
     nixpkgs,
-    flake-utils,
+    flake-parts,
     rust-overlay,
     crane,
+    shelly,
     ...
   }:
-    flake-utils.lib.eachDefaultSystem (
-      system: let
+    flake-parts.lib.mkFlake {inherit inputs;} {
+      imports = [shelly.flakeModule];
+      systems = ["x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" "mingw-w64"];
+      perSystem = {
+        config,
+        system,
+        ...
+      }: let
         pkgs = import nixpkgs {
           inherit system;
           overlays = [rust-overlay.overlays.default];
@@ -32,14 +46,18 @@
         rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
         craneLib = (crane.mkLib pkgs).overrideToolchain rust;
       in {
+        legacyPackages = {
+          jsonnetImpls = {
+            go-jsonnet = pkgs.callPackage ./nix/go-jsonnet.nix {};
+            sjsonnet = pkgs.callPackage ./nix/sjsonnet.nix {};
+            jsonnet = pkgs.callPackage ./nix/jsonnet.nix {};
+            # I didn't managed to build it, and nixpkgs version is marked as broken
+            # haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { };
+            rsjsonnet = pkgs.callPackage ./nix/rsjsonnet.nix {};
+          };
+        };
         packages = rec {
           default = jrsonnet;
-          go-jsonnet = pkgs.callPackage ./nix/go-jsonnet.nix {};
-          sjsonnet = pkgs.callPackage ./nix/sjsonnet.nix {};
-          jsonnet = pkgs.callPackage ./nix/jsonnet.nix {};
-          # I didn't managed to build it, and nixpkgs version is marked as broken
-          # haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { };
-          rsjsonnet = pkgs.callPackage ./nix/rsjsonnet.nix {};
 
           jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix {
             inherit craneLib;
@@ -61,7 +79,7 @@
           };
 
           benchmarks = pkgs.callPackage ./nix/benchmarks.nix {
-            inherit go-jsonnet sjsonnet jsonnet rsjsonnet;
+            inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
             jrsonnetVariants = [
               {
                 drv = jrsonnet.override {forBenchmarks = true;};
@@ -70,7 +88,7 @@
             ];
           };
           benchmarks-quick = pkgs.callPackage ./nix/benchmarks.nix {
-            inherit go-jsonnet sjsonnet jsonnet rsjsonnet;
+            inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
             quick = true;
             jrsonnetVariants = [
               {
@@ -80,7 +98,7 @@
             ];
           };
           benchmarks-against-release = pkgs.callPackage ./nix/benchmarks.nix {
-            inherit go-jsonnet sjsonnet jsonnet rsjsonnet;
+            inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
             jrsonnetVariants = [
               {
                 drv = jrsonnet.override {forBenchmarks = true;};
@@ -97,7 +115,7 @@
             ];
           };
           benchmarks-quick-against-release = pkgs.callPackage ./nix/benchmarks.nix {
-            inherit go-jsonnet sjsonnet jsonnet rsjsonnet;
+            inherit (config.legacyPackages.jsonnetImpls) go-jsonnet sjsonnet jsonnet rsjsonnet;
             quick = true;
             jrsonnetVariants = [
               {
@@ -115,22 +133,25 @@
             ];
           };
         };
-        devShells.default = craneLib.devShell {
-          packages = with pkgs; [
-            alejandra
-            cargo-edit
-            cargo-asm
-            cargo-outdated
-            cargo-watch
-            cargo-insta
-            lld
-            hyperfine
-            graphviz
-          ] ++ lib.optionals (!stdenv.isDarwin) [
-            valgrind
-            kcachegrind
-          ];
+        shelly.shells.default = {
+          factory = craneLib.devShell;
+          packages = with pkgs;
+            [
+              alejandra
+              cargo-edit
+              cargo-asm
+              cargo-outdated
+              cargo-watch
+              cargo-insta
+              lld
+              hyperfine
+              graphviz
+            ]
+            ++ lib.optionals (!stdenv.isDarwin) [
+              valgrind
+              kcachegrind
+            ];
         };
-      }
-    );
+      };
+    };
 }