From 0345b84f68fbd7d259fea3e358eb8bd8c79a1b58 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 6 Mar 2025 20:31:32 +0100 Subject: [PATCH 01/46] add empty template --- flake.nix | 9 +++++++++ template/flake.nix | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 template/flake.nix diff --git a/flake.nix b/flake.nix index a7a31d0..57b4211 100644 --- a/flake.nix +++ b/flake.nix @@ -70,6 +70,15 @@ }; flake = { schemas = inputs.flake-schemas.schemas; + templates = { + default = { + description = "nullkomma template"; + path = ./template; + welcomeText = '' + Welcome to the nullkomma template! + ''; + }; + }; }; }; } diff --git a/template/flake.nix b/template/flake.nix new file mode 100644 index 0000000..46d9dae --- /dev/null +++ b/template/flake.nix @@ -0,0 +1,10 @@ +{ + description = "nullkomma"; + + inputs = { + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; + }; + + outputs = {...}: { + }; +} From 5dcd15a4cc3cca02ba8fe5d6fa690f9f64d5473a Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 6 Mar 2025 22:33:06 +0100 Subject: [PATCH 02/46] add boilerplate for testing #44 --- flake.lock | 86 +++++++++++++++++++++++++++------ flake.nix | 115 +++++++++++++++++++++++++++------------------ template/flake.nix | 6 ++- 3 files changed, 145 insertions(+), 62 deletions(-) diff --git a/flake.lock b/flake.lock index f4c9913..78ba792 100644 --- a/flake.lock +++ b/flake.lock @@ -158,7 +158,9 @@ }, "flake-parts": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1738453229, @@ -241,6 +243,52 @@ "url": "https://flakehub.com/f/nix-community/naersk/0.1.%2A" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-unit": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1733705700, + "narHash": "sha256-stdx1z86yj66bChYswqjRw8BpdJRwxkH2XIJrsygpiM=", + "owner": "nix-community", + "repo": "nix-unit", + "rev": "d867d72d21da3b7d83f0feef73b0ac7f72b16437", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-unit", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1739758141, @@ -255,18 +303,6 @@ "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A.tar.gz" } }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1738452942, - "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1736200483, @@ -332,8 +368,9 @@ "flake-iter": "flake-iter", "flake-parts": "flake-parts", "flake-schemas": "flake-schemas_2", + "nix-unit": "nix-unit", "nixpkgs": "nixpkgs_4", - "treefmt-nix": "treefmt-nix" + "treefmt-nix": "treefmt-nix_2" } }, "rust-analyzer-src": { @@ -388,6 +425,27 @@ } }, "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708335038, + "narHash": "sha256-ETLZNFBVCabo7lJrpjD6cAbnE11eDOjaQnznmg/6hAE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e504621290a1fd896631ddbc5e9c16f4366c9f65", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { "inputs": { "nixpkgs": "nixpkgs_5" }, diff --git a/flake.nix b/flake.nix index 57b4211..36a6145 100644 --- a/flake.nix +++ b/flake.nix @@ -7,67 +7,90 @@ fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*"; + flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-parts.url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; + nix-unit.inputs.flake-parts.follows = "flake-parts"; + nix-unit.inputs.nixpkgs.follows = "nixpkgs"; + nix-unit.url = "github:nix-community/nix-unit"; treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204"; # keep-sorted end }; - outputs = {flake-parts, ...} @ inputs: - flake-parts.lib.mkFlake {inherit inputs;} { + outputs = + { flake-parts, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { imports = [ + # keep-sorted start + inputs.nix-unit.modules.flake.default inputs.treefmt-nix.flakeModule + # keep-sorted end ]; systems = [ - "x86_64-linux" - "aarch64-linux" + # keep-sorted start "aarch64-darwin" + "aarch64-linux" "x86_64-darwin" + "x86_64-linux" + # keep-sorted end ]; - perSystem = { - inputs', - pkgs, - self', - ... - }: { - devShells.default = pkgs.mkShell { - packages = [ - # keep-sorted start - inputs'.fh.packages.default - inputs'.flake-checker.packages.default - inputs'.flake-iter.packages.default - pkgs.git - pkgs.gnumake - pkgs.nixd - self'.formatter - # keep-sorted end - ]; - }; - treefmt = { - programs = { - # keep-sorted start - actionlint.enable = true; - alejandra.enable = true; - beautysh.enable = true; - black.enable = true; - cmake-format.enable = true; - deadnix.enable = true; - hclfmt.enable = true; - isort.enable = true; - jsonfmt.enable = true; - keep-sorted.enable = true; - mdformat.enable = true; - prettier.enable = true; - shellcheck.enable = true; - shfmt.enable = true; - sqlfluff.enable = true; - toml-sort.enable = true; - yamlfmt.enable = true; - # keep-sorted end + perSystem = + { + inputs', + pkgs, + self', + ... + }: + { + devShells.default = pkgs.mkShell { + packages = [ + # keep-sorted start + inputs'.fh.packages.default + inputs'.flake-checker.packages.default + inputs'.flake-iter.packages.default + pkgs.git + pkgs.gnumake + pkgs.nixd + self'.formatter + # keep-sorted end + ]; + }; + treefmt = { + programs = { + # keep-sorted start + actionlint.enable = true; + beautysh.enable = true; + black.enable = true; + cmake-format.enable = true; + deadnix.enable = true; + hclfmt.enable = true; + isort.enable = true; + jsonfmt.enable = true; + keep-sorted.enable = true; + mdformat.enable = true; + nixfmt.enable = true; + prettier.enable = true; + shellcheck.enable = true; + shfmt.enable = true; + sqlfluff.enable = true; + toml-sort.enable = true; + yamlfmt.enable = true; + # keep-sorted end + }; }; + nix-unit = { + inputs = { + inherit (inputs) nixpkgs flake-parts nix-unit; + }; + tests = { + "example" = { + expr = "1"; + expected = "1"; + }; + }; + }; + packages.default = pkgs.hello; }; - packages.default = pkgs.hello; - }; flake = { schemas = inputs.flake-schemas.schemas; templates = { diff --git a/template/flake.nix b/template/flake.nix index 46d9dae..79c2130 100644 --- a/template/flake.nix +++ b/template/flake.nix @@ -5,6 +5,8 @@ nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; }; - outputs = {...}: { - }; + outputs = + { ... }: + { + }; } From 627d690e0670b89f1d366eb11cb8b01cc3f2f724 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 6 Mar 2025 22:41:18 +0100 Subject: [PATCH 03/46] improve nesting --- flake.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 36a6145..f83ef10 100644 --- a/flake.nix +++ b/flake.nix @@ -7,14 +7,20 @@ fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*"; - flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; - flake-parts.url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; + # keep-sorted end + flake-parts = { + inputs.nixpkgs-lib.follows = "nixpkgs"; + url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; + }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; - nix-unit.inputs.flake-parts.follows = "flake-parts"; - nix-unit.inputs.nixpkgs.follows = "nixpkgs"; - nix-unit.url = "github:nix-community/nix-unit"; + nix-unit = { + url = "github:nix-community/nix-unit"; + inputs = { + flake-parts.follows = "flake-parts"; + nixpkgs.follows = "nixpkgs"; + }; + }; treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204"; - # keep-sorted end }; outputs = From 90f5e8c96abe716dc573cbf0bf32a2d92e52c233 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 16:41:29 +0100 Subject: [PATCH 04/46] bump up flake --- flake.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 78ba792..4eb3bc7 100644 --- a/flake.lock +++ b/flake.lock @@ -163,12 +163,12 @@ ] }, "locked": { - "lastModified": 1738453229, - "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", - "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", - "revCount": 360, + "lastModified": 1741352980, + "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "revCount": 369, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.360%2Brev-32ea77a06711b758da0ad9bd6a844c5740a87abd/0194c528-b815-7e20-a19c-07182c776e43/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.369%2Brev-f4330d22f1c5d2ba72d3d22df5597d123fdb60a9/019571ae-2e39-7402-8fe3-37c50d8c08b5/source.tar.gz" }, "original": { "type": "tarball", @@ -251,11 +251,11 @@ ] }, "locked": { - "lastModified": 1703863825, - "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "lastModified": 1731952509, + "narHash": "sha256-p4gB3Rhw8R6Ak4eMl8pqjCPOLCZRqaehZxdZ/mbFClM=", "owner": "nix-community", "repo": "nix-github-actions", - "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "rev": "7b5f051df789b6b20d259924d349a9ba3319b226", "type": "github" }, "original": { @@ -333,12 +333,12 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1740603184, - "narHash": "sha256-t+VaahjQAWyA+Ctn2idyo1yxRIYpaDxMgHkgCNiMJa4=", - "rev": "f44bd8ca21e026135061a0a57dcf3d0775b67a49", - "revCount": 714925, + "lastModified": 1741445498, + "narHash": "sha256-F5Em0iv/CxkN5mZ9hRn3vPknpoWdcdCyR0e4WklHwiE=", + "rev": "52e3095f6d812b91b22fb7ad0bfc1ab416453634", + "revCount": 715458, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.714925%2Brev-f44bd8ca21e026135061a0a57dcf3d0775b67a49/01954925-64dc-774f-8cc1-a596fc29244f/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715458%2Brev-52e3095f6d812b91b22fb7ad0bfc1ab416453634/01957cec-088e-7903-b447-238d0ea098e9/source.tar.gz" }, "original": { "type": "tarball", @@ -432,11 +432,11 @@ ] }, "locked": { - "lastModified": 1708335038, - "narHash": "sha256-ETLZNFBVCabo7lJrpjD6cAbnE11eDOjaQnznmg/6hAE=", + "lastModified": 1733662930, + "narHash": "sha256-9qOp6jNdezzLMxwwXaXZWPXosHbNqno+f7Ii/xftqZ8=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "e504621290a1fd896631ddbc5e9c16f4366c9f65", + "rev": "357cda84af1d74626afb7fb3bc12d6957167cda9", "type": "github" }, "original": { From 25805c29e25950fc080e3da8933719e8ed4f69d7 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 17:18:11 +0100 Subject: [PATCH 05/46] go back to old systems --- flake.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index f83ef10..4dd13b4 100644 --- a/flake.nix +++ b/flake.nix @@ -33,12 +33,10 @@ # keep-sorted end ]; systems = [ - # keep-sorted start - "aarch64-darwin" + "x86_64-linux" "aarch64-linux" + "aarch64-darwin" "x86_64-darwin" - "x86_64-linux" - # keep-sorted end ]; perSystem = { From c132dd50f6935b04d44fd2d0c4a7d47298d9db97 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 17:37:35 +0100 Subject: [PATCH 06/46] disable nix-unit inputs --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 4dd13b4..87574be 100644 --- a/flake.nix +++ b/flake.nix @@ -83,9 +83,9 @@ }; }; nix-unit = { - inputs = { - inherit (inputs) nixpkgs flake-parts nix-unit; - }; + # inputs = { + # inherit (inputs) nixpkgs flake-parts nix-unit; + # }; tests = { "example" = { expr = "1"; From 7e65b72b75d534bc9238996b69d446c782a88734 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 17:42:19 +0100 Subject: [PATCH 07/46] disable unit test --- flake.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 87574be..565184a 100644 --- a/flake.nix +++ b/flake.nix @@ -82,17 +82,17 @@ # keep-sorted end }; }; - nix-unit = { + # nix-unit = { # inputs = { # inherit (inputs) nixpkgs flake-parts nix-unit; # }; - tests = { - "example" = { - expr = "1"; - expected = "1"; - }; - }; - }; + # tests = { + # "example" = { + # expr = "1"; + # expected = "1"; + # }; + # }; + # }; packages.default = pkgs.hello; }; flake = { From 2eca22ade11227491a973361ca67d2346c8a9916 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 17:46:57 +0100 Subject: [PATCH 08/46] remove, not comment out nix-unit --- flake.nix | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/flake.nix b/flake.nix index 565184a..42930eb 100644 --- a/flake.nix +++ b/flake.nix @@ -82,17 +82,6 @@ # keep-sorted end }; }; - # nix-unit = { - # inputs = { - # inherit (inputs) nixpkgs flake-parts nix-unit; - # }; - # tests = { - # "example" = { - # expr = "1"; - # expected = "1"; - # }; - # }; - # }; packages.default = pkgs.hello; }; flake = { From 8e4f2e7821cf948544420c923e7f69eb0fd4d174 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 17:54:36 +0100 Subject: [PATCH 09/46] remove all the nix-unit tests --- flake.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 42930eb..a74aeb2 100644 --- a/flake.nix +++ b/flake.nix @@ -13,13 +13,6 @@ url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; - nix-unit = { - url = "github:nix-community/nix-unit"; - inputs = { - flake-parts.follows = "flake-parts"; - nixpkgs.follows = "nixpkgs"; - }; - }; treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204"; }; @@ -28,15 +21,14 @@ flake-parts.lib.mkFlake { inherit inputs; } { imports = [ # keep-sorted start - inputs.nix-unit.modules.flake.default inputs.treefmt-nix.flakeModule # keep-sorted end ]; systems = [ + "x86_64-darwin" "x86_64-linux" - "aarch64-linux" "aarch64-darwin" - "x86_64-darwin" + "aarch64-linux" ]; perSystem = { From 1d2e0176b7eae64ef505d93ce3dec885271027e7 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 18:05:59 +0100 Subject: [PATCH 10/46] remove unit test from lock file --- flake.lock | 70 +----------------------------------------------------- 1 file changed, 1 insertion(+), 69 deletions(-) diff --git a/flake.lock b/flake.lock index 4eb3bc7..afffed1 100644 --- a/flake.lock +++ b/flake.lock @@ -243,52 +243,6 @@ "url": "https://flakehub.com/f/nix-community/naersk/0.1.%2A" } }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "nix-unit", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1731952509, - "narHash": "sha256-p4gB3Rhw8R6Ak4eMl8pqjCPOLCZRqaehZxdZ/mbFClM=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "7b5f051df789b6b20d259924d349a9ba3319b226", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, - "nix-unit": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "nixpkgs" - ], - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1733705700, - "narHash": "sha256-stdx1z86yj66bChYswqjRw8BpdJRwxkH2XIJrsygpiM=", - "owner": "nix-community", - "repo": "nix-unit", - "rev": "d867d72d21da3b7d83f0feef73b0ac7f72b16437", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-unit", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1739758141, @@ -368,9 +322,8 @@ "flake-iter": "flake-iter", "flake-parts": "flake-parts", "flake-schemas": "flake-schemas_2", - "nix-unit": "nix-unit", "nixpkgs": "nixpkgs_4", - "treefmt-nix": "treefmt-nix_2" + "treefmt-nix": "treefmt-nix" } }, "rust-analyzer-src": { @@ -425,27 +378,6 @@ } }, "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nix-unit", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733662930, - "narHash": "sha256-9qOp6jNdezzLMxwwXaXZWPXosHbNqno+f7Ii/xftqZ8=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "357cda84af1d74626afb7fb3bc12d6957167cda9", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_2": { "inputs": { "nixpkgs": "nixpkgs_5" }, From 1364bff9220251fd73968d4f1ea9818d62dae145 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 18:12:19 +0100 Subject: [PATCH 11/46] change order again --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index a74aeb2..4c06dc0 100644 --- a/flake.nix +++ b/flake.nix @@ -25,10 +25,10 @@ # keep-sorted end ]; systems = [ - "x86_64-darwin" - "x86_64-linux" "aarch64-darwin" "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" ]; perSystem = { From 93ab1fa11eb9c1868962c0e949a21812744b6d9b Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 18:20:27 +0100 Subject: [PATCH 12/46] add sorting comments again --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index 4c06dc0..15a8d52 100644 --- a/flake.nix +++ b/flake.nix @@ -25,10 +25,12 @@ # keep-sorted end ]; systems = [ + # keep-sorted start "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" + # keep-sorted end ]; perSystem = { From 9a6b882bdce45d251eadda1972846f50478f11df Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 18:44:00 +0100 Subject: [PATCH 13/46] add nix-unit as a dep again --- flake.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flake.nix b/flake.nix index 15a8d52..cf09900 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,13 @@ url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; + nix-unit = { + url = "github:nix-community/nix-unit"; + inputs = { + flake-parts.follows = "flake-parts"; + nixpkgs.follows = "nixpkgs"; + }; + }; treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204"; }; From 63eeb035d791b952c4072fdc649eadc1477de4d2 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 19:00:42 +0100 Subject: [PATCH 14/46] pin nix-unit --- flake.lock | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 2 +- 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index afffed1..86622c7 100644 --- a/flake.lock +++ b/flake.lock @@ -203,6 +203,39 @@ "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.%2A" } }, + "mdbook-nixdoc": { + "inputs": { + "flake-parts": [ + "nix-unit", + "flake-parts" + ], + "nix-github-actions": [ + "nix-unit", + "nix-github-actions" + ], + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ], + "treefmt-nix": [ + "nix-unit", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1708342507, + "narHash": "sha256-KoaAog/peCdkrtapUPq7F9aneJLXZMwo6CCcQ3+OtOA=", + "owner": "adisbladis", + "repo": "mdbook-nixdoc", + "rev": "ce2d327032fb3d6f20144a54e7dc1195c108a1b1", + "type": "github" + }, + "original": { + "owner": "adisbladis", + "repo": "mdbook-nixdoc", + "type": "github" + } + }, "naersk": { "inputs": { "nixpkgs": [ @@ -243,6 +276,54 @@ "url": "https://flakehub.com/f/nix-community/naersk/0.1.%2A" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-unit": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "mdbook-nixdoc": "mdbook-nixdoc", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1719395214, + "narHash": "sha256-sDYeiwVo6+GL4/AHadeExVqE9j3wzdUsyMLs1OYQW7Y=", + "owner": "nix-community", + "repo": "nix-unit", + "rev": "7161c4bd2f857bc57332100f00d7e86fdfe7c56c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v2.23.0", + "repo": "nix-unit", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1739758141, @@ -322,8 +403,9 @@ "flake-iter": "flake-iter", "flake-parts": "flake-parts", "flake-schemas": "flake-schemas_2", + "nix-unit": "nix-unit", "nixpkgs": "nixpkgs_4", - "treefmt-nix": "treefmt-nix" + "treefmt-nix": "treefmt-nix_2" } }, "rust-analyzer-src": { @@ -378,6 +460,27 @@ } }, "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708335038, + "narHash": "sha256-ETLZNFBVCabo7lJrpjD6cAbnE11eDOjaQnznmg/6hAE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e504621290a1fd896631ddbc5e9c16f4366c9f65", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { "inputs": { "nixpkgs": "nixpkgs_5" }, diff --git a/flake.nix b/flake.nix index cf09900..da7b6bc 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,7 @@ }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; nix-unit = { - url = "github:nix-community/nix-unit"; + url = "github:nix-community/nix-unit/v2.23.0"; inputs = { flake-parts.follows = "flake-parts"; nixpkgs.follows = "nixpkgs"; From 0a948520597d4896f66720495de0175ab15bda7d Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 10 Mar 2025 20:04:09 +0100 Subject: [PATCH 15/46] add test boilerplate --- flake.lock | 41 +++-------------------------------------- flake.nix | 14 +++++++++++++- 2 files changed, 16 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index 86622c7..90c8829 100644 --- a/flake.lock +++ b/flake.lock @@ -203,39 +203,6 @@ "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.%2A" } }, - "mdbook-nixdoc": { - "inputs": { - "flake-parts": [ - "nix-unit", - "flake-parts" - ], - "nix-github-actions": [ - "nix-unit", - "nix-github-actions" - ], - "nixpkgs": [ - "nix-unit", - "nixpkgs" - ], - "treefmt-nix": [ - "nix-unit", - "treefmt-nix" - ] - }, - "locked": { - "lastModified": 1708342507, - "narHash": "sha256-KoaAog/peCdkrtapUPq7F9aneJLXZMwo6CCcQ3+OtOA=", - "owner": "adisbladis", - "repo": "mdbook-nixdoc", - "rev": "ce2d327032fb3d6f20144a54e7dc1195c108a1b1", - "type": "github" - }, - "original": { - "owner": "adisbladis", - "repo": "mdbook-nixdoc", - "type": "github" - } - }, "naersk": { "inputs": { "nixpkgs": [ @@ -302,7 +269,6 @@ "flake-parts": [ "flake-parts" ], - "mdbook-nixdoc": "mdbook-nixdoc", "nix-github-actions": "nix-github-actions", "nixpkgs": [ "nixpkgs" @@ -310,16 +276,15 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1719395214, - "narHash": "sha256-sDYeiwVo6+GL4/AHadeExVqE9j3wzdUsyMLs1OYQW7Y=", + "lastModified": 1741624954, + "narHash": "sha256-VjLS010BEfwuK343Dst08NnQNS8SRtVCDkz1zTsHuvI=", "owner": "nix-community", "repo": "nix-unit", - "rev": "7161c4bd2f857bc57332100f00d7e86fdfe7c56c", + "rev": "e9d81f6cffe67681e7c04a967d29f18c2c540af5", "type": "github" }, "original": { "owner": "nix-community", - "ref": "v2.23.0", "repo": "nix-unit", "type": "github" } diff --git a/flake.nix b/flake.nix index da7b6bc..5819fdb 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,7 @@ }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; nix-unit = { - url = "github:nix-community/nix-unit/v2.23.0"; + url = "github:nix-community/nix-unit/?tag=v2.23.0"; inputs = { flake-parts.follows = "flake-parts"; nixpkgs.follows = "nixpkgs"; @@ -28,6 +28,7 @@ flake-parts.lib.mkFlake { inherit inputs; } { imports = [ # keep-sorted start + inputs.nix-unit.modules.flake.default inputs.treefmt-nix.flakeModule # keep-sorted end ]; @@ -84,6 +85,17 @@ }; }; packages.default = pkgs.hello; + nix-unit = { + inputs = { + inherit (inputs) nixpkgs flake-parts nix-unit; + }; + tests = { + "example" = { + expr = "1"; + expected = "1"; + }; + }; + }; }; flake = { schemas = inputs.flake-schemas.schemas; From 6428711101c614f8c440f9027402bfb020e5792f Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 18:31:49 +0100 Subject: [PATCH 16/46] try with vanilla unit test --- flake.lock | 380 ++--------------------------------------------------- flake.nix | 115 ++++------------ 2 files changed, 42 insertions(+), 453 deletions(-) diff --git a/flake.lock b/flake.lock index 90c8829..8667612 100644 --- a/flake.lock +++ b/flake.lock @@ -1,161 +1,5 @@ { "nodes": { - "crane": { - "inputs": { - "nixpkgs": [ - "flake-iter", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717383740, - "narHash": "sha256-559HbY4uhNeoYvK3H6AMZAtVfmR3y8plXZ1x6ON/cWU=", - "rev": "b65673fce97d277934488a451724be94cc62499a", - "revCount": 580, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.17.3/018fdc0e-176b-7a0f-92ce-cc2d0db7b735/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/ipetkov/crane/0.17.3" - } - }, - "fenix": { - "inputs": { - "nixpkgs": [ - "fh", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1735713283, - "narHash": "sha256-xC6X49L55xo7AV+pAYclOj5UNWtBo/xx5aB5IehJD0M=", - "rev": "bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c", - "revCount": 2125, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2125%2Brev-bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c/019420f1-c64f-7176-bdf5-3f4f4fe2bac6/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/fenix/0.1.1584.tar.gz" - } - }, - "fenix_2": { - "inputs": { - "nixpkgs": [ - "flake-checker", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src_2" - }, - "locked": { - "lastModified": 1735713283, - "narHash": "sha256-xC6X49L55xo7AV+pAYclOj5UNWtBo/xx5aB5IehJD0M=", - "rev": "bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c", - "revCount": 2125, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2125%2Brev-bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c/019420f1-c64f-7176-bdf5-3f4f4fe2bac6/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A" - } - }, - "fenix_3": { - "inputs": { - "nixpkgs": [ - "flake-iter", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src_3" - }, - "locked": { - "lastModified": 1727764514, - "narHash": "sha256-tvN9v5gTxLI5zOKsNvYl1aUxIitHm8Nj3vKdXNfJo50=", - "rev": "a9d2e5fa8d77af05240230c9569bbbddd28ccfaf", - "revCount": 2029, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2029%2Brev-a9d2e5fa8d77af05240230c9569bbbddd28ccfaf/01924729-44b5-7df4-a70d-d5e64656e243/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/fenix/0.1.1885" - } - }, - "fh": { - "inputs": { - "fenix": "fenix", - "naersk": "naersk", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1740069727, - "narHash": "sha256-yOqXcn/OMfC97t002V8yzZn1PhuV8lIp5szPA7eys1Q=", - "rev": "ed73c2dd1d4ccc6d1588809078ebb2f38431dddc", - "revCount": 683, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/fh/0.1.22/0195244a-b1c2-7264-b779-0e1e34d9735f/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/fh/0.1.%2A" - } - }, - "flake-checker": { - "inputs": { - "fenix": "fenix_2", - "naersk": "naersk_2", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1736892386, - "narHash": "sha256-K5E1sarWIUl4QavHBoS8sPr5Cp8ZndWjLYDLm++d7v0=", - "rev": "93ec61a573f9980b480f514132073233bf8eceb9", - "revCount": 568, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-checker/0.2.4/01946f7b-08b5-7c81-9dd7-f9fb131c894d/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.%2A" - } - }, - "flake-compat": { - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "revCount": 57, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/%2A" - } - }, - "flake-iter": { - "inputs": { - "crane": "crane", - "fenix": "fenix_3", - "flake-compat": "flake-compat", - "flake-schemas": "flake-schemas", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1729934312, - "narHash": "sha256-65GKjEGwxf6oVHngJ0KCAI7NXbX421ey/a4zibwCk1c=", - "rev": "a193bafe3a6b294cf2f5e1f38415784f9b6e631f", - "revCount": 92, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-iter/0.1.92%2Brev-a193bafe3a6b294cf2f5e1f38415784f9b6e631f/0192c82f-82bd-79b2-a3ff-8ad69907bf96/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.%2A" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -165,82 +9,15 @@ "locked": { "lastModified": 1741352980, "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "owner": "hercules-ci", + "repo": "flake-parts", "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", - "revCount": 369, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.369%2Brev-f4330d22f1c5d2ba72d3d22df5597d123fdb60a9/019571ae-2e39-7402-8fe3-37c50d8c08b5/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1.%2A" - } - }, - "flake-schemas": { - "locked": { - "lastModified": 1721999734, - "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", - "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", - "revCount": 75, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A" - } - }, - "flake-schemas_2": { - "locked": { - "lastModified": 1721999734, - "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", - "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", - "revCount": 75, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.%2A" - } - }, - "naersk": { - "inputs": { - "nixpkgs": [ - "fh", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1736429049, - "narHash": "sha256-np2K6lbTOq7yugwS0IsEmy+02vxTAF62bp8APnBHsE4=", - "rev": "5891bae1b7fbd8d3a138773fd751e7a532f914aa", - "revCount": 352, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/naersk/0.1.352%2Brev-5891bae1b7fbd8d3a138773fd751e7a532f914aa/01944b3d-93aa-7d30-8c2b-bd5902521c73/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/naersk/0.1.345.tar.gz" - } - }, - "naersk_2": { - "inputs": { - "nixpkgs": [ - "flake-checker", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1736269059, - "narHash": "sha256-VaZlkrcfZOl85fz3o+GnNv+FkMG4RtnZA1eVa6v2TJs=", - "rev": "38a563a865a0218d9f30f14333327aafc40eea75", - "revCount": 350, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/naersk/0.1.350%2Brev-38a563a865a0218d9f30f14333327aafc40eea75/019441b4-40db-71af-aed5-f78c77cc6abc/source.tar.gz" + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/naersk/0.1.%2A" + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" } }, "nix-github-actions": { @@ -291,137 +68,25 @@ }, "nixpkgs": { "locked": { - "lastModified": 1739758141, - "narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=", - "rev": "c618e28f70257593de75a7044438efc1c1fc0791", - "revCount": 714614, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.714614%2Brev-c618e28f70257593de75a7044438efc1c1fc0791/0195155d-20df-7b25-ad70-45871483b8d2/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A.tar.gz" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1736200483, - "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", - "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", - "revCount": 712512, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.712512%2Brev-3f0a8ac25fb674611b98089ca3a5dd6480175751/01944209-0c88-7bd6-8aac-65b5af418928/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1729449015, - "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", - "rev": "89172919243df199fe237ba0f776c3e3e3d72367", - "revCount": 636030, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.636030%2Brev-89172919243df199fe237ba0f776c3e3e3d72367/0192b3f3-a2eb-7013-a563-55056c1705cd/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2405.%2A" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1741445498, - "narHash": "sha256-F5Em0iv/CxkN5mZ9hRn3vPknpoWdcdCyR0e4WklHwiE=", - "rev": "52e3095f6d812b91b22fb7ad0bfc1ab416453634", - "revCount": 715458, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715458%2Brev-52e3095f6d812b91b22fb7ad0bfc1ab416453634/01957cec-088e-7903-b447-238d0ea098e9/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" - } - }, - "nixpkgs_5": { - "locked": { - "lastModified": 1735554305, - "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", - "owner": "nixos", + "lastModified": 1741513245, + "narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", + "rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "fh": "fh", - "flake-checker": "flake-checker", - "flake-iter": "flake-iter", "flake-parts": "flake-parts", - "flake-schemas": "flake-schemas_2", "nix-unit": "nix-unit", - "nixpkgs": "nixpkgs_4", - "treefmt-nix": "treefmt-nix_2" - } - }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1735659655, - "narHash": "sha256-DQgwi3pwaasWWDfNtXIX0lW5KvxQ+qVhxO1J7l68Qcc=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "085ad107943996c344633d58f26467b05f8e2ff0", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "rust-analyzer-src_2": { - "flake": false, - "locked": { - "lastModified": 1735659655, - "narHash": "sha256-DQgwi3pwaasWWDfNtXIX0lW5KvxQ+qVhxO1J7l68Qcc=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "085ad107943996c344633d58f26467b05f8e2ff0", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "rust-analyzer-src_3": { - "flake": false, - "locked": { - "lastModified": 1727706011, - "narHash": "sha256-xxgUHwwJ+1xQQoUWvLDo807IZ0MDldkfr9N1G4fvNJU=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "28830ff2f1158ee92f4852ef3ec35af0935d1562", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" + "nixpkgs": "nixpkgs" } }, "treefmt-nix": { @@ -444,25 +109,6 @@ "repo": "treefmt-nix", "type": "github" } - }, - "treefmt-nix_2": { - "inputs": { - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1739829690, - "narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "3d0579f5cc93436052d94b73925b48973a104204", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "3d0579f5cc93436052d94b73925b48973a104204", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 5819fdb..e61ac4e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,112 +1,55 @@ { - description = "nullkomma"; + description = "Description for the project"; inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; - # keep-sorted start - fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; - flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; - flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*"; - # keep-sorted end - flake-parts = { - inputs.nixpkgs-lib.follows = "nixpkgs"; - url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; - }; - flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; - nix-unit = { - url = "github:nix-community/nix-unit/?tag=v2.23.0"; - inputs = { - flake-parts.follows = "flake-parts"; - nixpkgs.follows = "nixpkgs"; - }; - }; - treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nix-unit.url = "github:nix-community/nix-unit"; + nix-unit.inputs.nixpkgs.follows = "nixpkgs"; + nix-unit.inputs.flake-parts.follows = "flake-parts"; }; outputs = - { flake-parts, ... }@inputs: + inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ - # keep-sorted start inputs.nix-unit.modules.flake.default - inputs.treefmt-nix.flakeModule - # keep-sorted end ]; systems = [ - # keep-sorted start - "aarch64-darwin" + "x86_64-linux" "aarch64-linux" + "aarch64-darwin" "x86_64-darwin" - "x86_64-linux" - # keep-sorted end ]; perSystem = + { ... }: { - inputs', - pkgs, - self', - ... - }: - { - devShells.default = pkgs.mkShell { - packages = [ - # keep-sorted start - inputs'.fh.packages.default - inputs'.flake-checker.packages.default - inputs'.flake-iter.packages.default - pkgs.git - pkgs.gnumake - pkgs.nixd - self'.formatter - # keep-sorted end - ]; + nix-unit.inputs = { + # NOTE: a `nixpkgs-lib` follows rule is currently required + inherit (inputs) nixpkgs flake-parts nix-unit; }; - treefmt = { - programs = { - # keep-sorted start - actionlint.enable = true; - beautysh.enable = true; - black.enable = true; - cmake-format.enable = true; - deadnix.enable = true; - hclfmt.enable = true; - isort.enable = true; - jsonfmt.enable = true; - keep-sorted.enable = true; - mdformat.enable = true; - nixfmt.enable = true; - prettier.enable = true; - shellcheck.enable = true; - shfmt.enable = true; - sqlfluff.enable = true; - toml-sort.enable = true; - yamlfmt.enable = true; - # keep-sorted end + # Tests specified here may refer to system-specific attributes that are + # available in the `perSystem` context + nix-unit.tests = { + "test integer equality is reflexive" = { + expr = "123"; + expected = "123"; }; - }; - packages.default = pkgs.hello; - nix-unit = { - inputs = { - inherit (inputs) nixpkgs flake-parts nix-unit; - }; - tests = { - "example" = { - expr = "1"; - expected = "1"; + "frobnicator" = { + "testFoo" = { + expr = "foo"; + expected = "foo"; }; }; }; }; flake = { - schemas = inputs.flake-schemas.schemas; - templates = { - default = { - description = "nullkomma template"; - path = ./template; - welcomeText = '' - Welcome to the nullkomma template! - ''; - }; + # System-agnostic tests can be defined here, and will be picked up by + # `nix flake check` + tests.testBar = { + expr = "bar"; + expected = "bar"; }; }; }; From 096d4a6bbbf2b70370667ebdd221db2f5d9f9d6a Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 20:20:41 +0100 Subject: [PATCH 17/46] go back to full version --- flake.lock | 392 ++++++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 114 ++++++++++++---- 2 files changed, 458 insertions(+), 48 deletions(-) diff --git a/flake.lock b/flake.lock index 8667612..bf4a817 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,161 @@ { "nodes": { + "crane": { + "inputs": { + "nixpkgs": [ + "flake-iter", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717383740, + "narHash": "sha256-559HbY4uhNeoYvK3H6AMZAtVfmR3y8plXZ1x6ON/cWU=", + "rev": "b65673fce97d277934488a451724be94cc62499a", + "revCount": 580, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.17.3/018fdc0e-176b-7a0f-92ce-cc2d0db7b735/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/ipetkov/crane/0.17.3" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "fh", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1735713283, + "narHash": "sha256-xC6X49L55xo7AV+pAYclOj5UNWtBo/xx5aB5IehJD0M=", + "rev": "bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c", + "revCount": 2125, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2125%2Brev-bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c/019420f1-c64f-7176-bdf5-3f4f4fe2bac6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/fenix/0.1.1584.tar.gz" + } + }, + "fenix_2": { + "inputs": { + "nixpkgs": [ + "flake-checker", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src_2" + }, + "locked": { + "lastModified": 1735713283, + "narHash": "sha256-xC6X49L55xo7AV+pAYclOj5UNWtBo/xx5aB5IehJD0M=", + "rev": "bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c", + "revCount": 2125, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2125%2Brev-bfba822a4220b0e2c4dc7f36a35e4c8450cd9a9c/019420f1-c64f-7176-bdf5-3f4f4fe2bac6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A" + } + }, + "fenix_3": { + "inputs": { + "nixpkgs": [ + "flake-iter", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src_3" + }, + "locked": { + "lastModified": 1727764514, + "narHash": "sha256-tvN9v5gTxLI5zOKsNvYl1aUxIitHm8Nj3vKdXNfJo50=", + "rev": "a9d2e5fa8d77af05240230c9569bbbddd28ccfaf", + "revCount": 2029, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2029%2Brev-a9d2e5fa8d77af05240230c9569bbbddd28ccfaf/01924729-44b5-7df4-a70d-d5e64656e243/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/fenix/0.1.1885" + } + }, + "fh": { + "inputs": { + "fenix": "fenix", + "naersk": "naersk", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1740069727, + "narHash": "sha256-yOqXcn/OMfC97t002V8yzZn1PhuV8lIp5szPA7eys1Q=", + "rev": "ed73c2dd1d4ccc6d1588809078ebb2f38431dddc", + "revCount": 683, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/fh/0.1.22/0195244a-b1c2-7264-b779-0e1e34d9735f/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/fh/0.1.%2A" + } + }, + "flake-checker": { + "inputs": { + "fenix": "fenix_2", + "naersk": "naersk_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1736892386, + "narHash": "sha256-K5E1sarWIUl4QavHBoS8sPr5Cp8ZndWjLYDLm++d7v0=", + "rev": "93ec61a573f9980b480f514132073233bf8eceb9", + "revCount": 568, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-checker/0.2.4/01946f7b-08b5-7c81-9dd7-f9fb131c894d/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.%2A" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/%2A" + } + }, + "flake-iter": { + "inputs": { + "crane": "crane", + "fenix": "fenix_3", + "flake-compat": "flake-compat", + "flake-schemas": "flake-schemas", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1729934312, + "narHash": "sha256-65GKjEGwxf6oVHngJ0KCAI7NXbX421ey/a4zibwCk1c=", + "rev": "a193bafe3a6b294cf2f5e1f38415784f9b6e631f", + "revCount": 92, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-iter/0.1.92%2Brev-a193bafe3a6b294cf2f5e1f38415784f9b6e631f/0192c82f-82bd-79b2-a3ff-8ad69907bf96/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.%2A" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -9,15 +165,82 @@ "locked": { "lastModified": 1741352980, "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", - "owner": "hercules-ci", - "repo": "flake-parts", "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", - "type": "github" + "revCount": 369, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.369%2Brev-f4330d22f1c5d2ba72d3d22df5597d123fdb60a9/019571ae-2e39-7402-8fe3-37c50d8c08b5/source.tar.gz" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1.%2A" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A" + } + }, + "flake-schemas_2": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.%2A" + } + }, + "naersk": { + "inputs": { + "nixpkgs": [ + "fh", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736429049, + "narHash": "sha256-np2K6lbTOq7yugwS0IsEmy+02vxTAF62bp8APnBHsE4=", + "rev": "5891bae1b7fbd8d3a138773fd751e7a532f914aa", + "revCount": 352, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/naersk/0.1.352%2Brev-5891bae1b7fbd8d3a138773fd751e7a532f914aa/01944b3d-93aa-7d30-8c2b-bd5902521c73/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/naersk/0.1.345.tar.gz" + } + }, + "naersk_2": { + "inputs": { + "nixpkgs": [ + "flake-checker", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736269059, + "narHash": "sha256-VaZlkrcfZOl85fz3o+GnNv+FkMG4RtnZA1eVa6v2TJs=", + "rev": "38a563a865a0218d9f30f14333327aafc40eea75", + "revCount": 350, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/naersk/0.1.350%2Brev-38a563a865a0218d9f30f14333327aafc40eea75/019441b4-40db-71af-aed5-f78c77cc6abc/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/naersk/0.1.%2A" } }, "nix-github-actions": { @@ -28,11 +251,11 @@ ] }, "locked": { - "lastModified": 1703863825, - "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "lastModified": 1731952509, + "narHash": "sha256-p4gB3Rhw8R6Ak4eMl8pqjCPOLCZRqaehZxdZ/mbFClM=", "owner": "nix-community", "repo": "nix-github-actions", - "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "rev": "7b5f051df789b6b20d259924d349a9ba3319b226", "type": "github" }, "original": { @@ -68,25 +291,137 @@ }, "nixpkgs": { "locked": { - "lastModified": 1741513245, - "narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=", - "owner": "NixOS", + "lastModified": 1739758141, + "narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=", + "rev": "c618e28f70257593de75a7044438efc1c1fc0791", + "revCount": 714614, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.714614%2Brev-c618e28f70257593de75a7044438efc1c1fc0791/0195155d-20df-7b25-ad70-45871483b8d2/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1736200483, + "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", + "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", + "revCount": 712512, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.712512%2Brev-3f0a8ac25fb674611b98089ca3a5dd6480175751/01944209-0c88-7bd6-8aac-65b5af418928/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1729449015, + "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", + "rev": "89172919243df199fe237ba0f776c3e3e3d72367", + "revCount": 636030, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.636030%2Brev-89172919243df199fe237ba0f776c3e3e3d72367/0192b3f3-a2eb-7013-a563-55056c1705cd/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2405.%2A" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1741600792, + "narHash": "sha256-yfDy6chHcM7pXpMF4wycuuV+ILSTG486Z/vLx/Bdi6Y=", + "rev": "ebe2788eafd539477f83775ef93c3c7e244421d3", + "revCount": 715519, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715519%2Brev-ebe2788eafd539477f83775ef93c3c7e244421d3/01958352-2268-7c6e-9e1d-17ff6642211b/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1735554305, + "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1", + "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", + "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { + "fh": "fh", + "flake-checker": "flake-checker", + "flake-iter": "flake-iter", "flake-parts": "flake-parts", + "flake-schemas": "flake-schemas_2", "nix-unit": "nix-unit", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_4", + "treefmt-nix": "treefmt-nix_2" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1735659655, + "narHash": "sha256-DQgwi3pwaasWWDfNtXIX0lW5KvxQ+qVhxO1J7l68Qcc=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "085ad107943996c344633d58f26467b05f8e2ff0", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-analyzer-src_2": { + "flake": false, + "locked": { + "lastModified": 1735659655, + "narHash": "sha256-DQgwi3pwaasWWDfNtXIX0lW5KvxQ+qVhxO1J7l68Qcc=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "085ad107943996c344633d58f26467b05f8e2ff0", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-analyzer-src_3": { + "flake": false, + "locked": { + "lastModified": 1727706011, + "narHash": "sha256-xxgUHwwJ+1xQQoUWvLDo807IZ0MDldkfr9N1G4fvNJU=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "28830ff2f1158ee92f4852ef3ec35af0935d1562", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" } }, "treefmt-nix": { @@ -97,16 +432,35 @@ ] }, "locked": { - "lastModified": 1708335038, - "narHash": "sha256-ETLZNFBVCabo7lJrpjD6cAbnE11eDOjaQnznmg/6hAE=", + "lastModified": 1733662930, + "narHash": "sha256-9qOp6jNdezzLMxwwXaXZWPXosHbNqno+f7Ii/xftqZ8=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "357cda84af1d74626afb7fb3bc12d6957167cda9", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1739829690, + "narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "e504621290a1fd896631ddbc5e9c16f4366c9f65", + "rev": "3d0579f5cc93436052d94b73925b48973a104204", "type": "github" }, "original": { "owner": "numtide", "repo": "treefmt-nix", + "rev": "3d0579f5cc93436052d94b73925b48973a104204", "type": "github" } } diff --git a/flake.nix b/flake.nix index e61ac4e..af2ef7e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,55 +1,111 @@ { - description = "Description for the project"; + description = "nullkomma"; inputs = { - flake-parts.url = "github:hercules-ci/flake-parts"; - flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nix-unit.url = "github:nix-community/nix-unit"; - nix-unit.inputs.nixpkgs.follows = "nixpkgs"; - nix-unit.inputs.flake-parts.follows = "flake-parts"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; + # keep-sorted start + fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; + flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; + flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*"; + # keep-sorted end + flake-parts = { + inputs.nixpkgs-lib.follows = "nixpkgs"; + url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; + }; + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; + nix-unit = { + url = "github:nix-community/nix-unit/?tag=v2.23.0"; + inputs = { + flake-parts.follows = "flake-parts"; + nixpkgs.follows = "nixpkgs"; + }; + }; + treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204"; }; outputs = - inputs@{ flake-parts, ... }: + { flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ + # keep-sorted start inputs.nix-unit.modules.flake.default + inputs.treefmt-nix.flakeModule + # keep-sorted end ]; systems = [ - "x86_64-linux" - "aarch64-linux" + # keep-sorted start "aarch64-darwin" + "aarch64-linux" "x86_64-darwin" + "x86_64-linux" + # keep-sorted end ]; perSystem = - { ... }: { - nix-unit.inputs = { - # NOTE: a `nixpkgs-lib` follows rule is currently required - inherit (inputs) nixpkgs flake-parts nix-unit; + inputs', + pkgs, + self', + ... + }: + { + devShells.default = pkgs.mkShell { + packages = [ + # keep-sorted start + inputs'.fh.packages.default + inputs'.flake-checker.packages.default + inputs'.flake-iter.packages.default + pkgs.git + pkgs.gnumake + pkgs.nixd + self'.formatter + # keep-sorted end + ]; }; - # Tests specified here may refer to system-specific attributes that are - # available in the `perSystem` context - nix-unit.tests = { - "test integer equality is reflexive" = { - expr = "123"; - expected = "123"; + treefmt = { + programs = { + # keep-sorted start + actionlint.enable = true; + beautysh.enable = true; + black.enable = true; + cmake-format.enable = true; + deadnix.enable = true; + hclfmt.enable = true; + isort.enable = true; + jsonfmt.enable = true; + keep-sorted.enable = true; + mdformat.enable = true; + nixfmt.enable = true; + prettier.enable = true; + shellcheck.enable = true; + shfmt.enable = true; + sqlfluff.enable = true; + toml-sort.enable = true; + yamlfmt.enable = true; + # keep-sorted end }; - "frobnicator" = { - "testFoo" = { - expr = "foo"; - expected = "foo"; + }; + nix-unit = { + inputs = { + inherit (inputs) nixpkgs flake-parts nix-unit; + }; + tests = { + "test example" = { + expr = "1"; + expected = "1"; }; }; }; }; flake = { - # System-agnostic tests can be defined here, and will be picked up by - # `nix flake check` - tests.testBar = { - expr = "bar"; - expected = "bar"; + schemas = inputs.flake-schemas.schemas; + templates = { + default = { + description = "nullkomma template"; + path = ./template; + welcomeText = '' + Welcome to the nullkomma template! + ''; + }; }; }; }; From ef589e176e73a5d572b1950faa2c5040191e59ef Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 20:27:04 +0100 Subject: [PATCH 18/46] only run on mac --- flake.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/flake.nix b/flake.nix index af2ef7e..1e84d4b 100644 --- a/flake.nix +++ b/flake.nix @@ -35,9 +35,6 @@ systems = [ # keep-sorted start "aarch64-darwin" - "aarch64-linux" - "x86_64-darwin" - "x86_64-linux" # keep-sorted end ]; perSystem = From 7529559e2679ea906f5d2b56f8dff9034aa8ad10 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 20:37:51 +0100 Subject: [PATCH 19/46] add arch linux --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 1e84d4b..e1d29d4 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ ]; systems = [ # keep-sorted start + "aarch64-linux" "aarch64-darwin" # keep-sorted end ]; From 4b51b659eb747abf292e8e672f7dc2e6c7a9c1e3 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 20:43:09 +0100 Subject: [PATCH 20/46] fix order --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index e1d29d4..02780f5 100644 --- a/flake.nix +++ b/flake.nix @@ -34,8 +34,8 @@ ]; systems = [ # keep-sorted start - "aarch64-linux" "aarch64-darwin" + "aarch64-linux" # keep-sorted end ]; perSystem = From 2ebc315505a892432eecd2d6dccfd4c8ed91b961 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 20:49:51 +0100 Subject: [PATCH 21/46] try other two systems --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 02780f5..504df6b 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ systems = [ # keep-sorted start "aarch64-darwin" - "aarch64-linux" + "x86_64-darwin" # keep-sorted end ]; perSystem = From cb0fef8babda637022c860384a1bed894b9feed0 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 20:59:47 +0100 Subject: [PATCH 22/46] add all systems again --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index 504df6b..8efccaf 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,8 @@ systems = [ # keep-sorted start "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" "x86_64-darwin" # keep-sorted end ]; From 0e5944b86206d2a5e034113ce89262d65e074678 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:05:15 +0100 Subject: [PATCH 23/46] try only breaking linux --- flake.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 8efccaf..0d4123e 100644 --- a/flake.nix +++ b/flake.nix @@ -34,10 +34,7 @@ ]; systems = [ # keep-sorted start - "aarch64-darwin" - "aarch64-linux" - "x86_64-darwin" - "x86_64-darwin" + "x86_64-linux" # keep-sorted end ]; perSystem = From e372b3dc9ec4d04d005eb41f32ce3813b3923559 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:12:03 +0100 Subject: [PATCH 24/46] try with unstable --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 0d4123e..3bc7123 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "nullkomma"; inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # keep-sorted start fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; From 86715d400452d9007e2a72bfd4b42ff9739f73ec Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:18:57 +0100 Subject: [PATCH 25/46] try main flake-parts --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 3bc7123..46b8e76 100644 --- a/flake.nix +++ b/flake.nix @@ -2,15 +2,15 @@ description = "nullkomma"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; # keep-sorted start fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*"; # keep-sorted end flake-parts = { + url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; - url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; nix-unit = { From 211b4d25e684e28dd9de64e60b1f107944a9a037 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:20:43 +0100 Subject: [PATCH 26/46] Revert "try main flake-parts" This reverts commit 86715d400452d9007e2a72bfd4b42ff9739f73ec. --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 46b8e76..3bc7123 100644 --- a/flake.nix +++ b/flake.nix @@ -2,15 +2,15 @@ description = "nullkomma"; inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # keep-sorted start fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*"; # keep-sorted end flake-parts = { - url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; + url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*"; }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; nix-unit = { From fea38cf45f79ef59900e604d02dab42ec8e40457 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:37:42 +0100 Subject: [PATCH 27/46] bump up lock file --- flake.lock | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index bf4a817..c74b0d0 100644 --- a/flake.lock +++ b/flake.lock @@ -333,16 +333,18 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1741600792, - "narHash": "sha256-yfDy6chHcM7pXpMF4wycuuV+ILSTG486Z/vLx/Bdi6Y=", - "rev": "ebe2788eafd539477f83775ef93c3c7e244421d3", - "revCount": 715519, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715519%2Brev-ebe2788eafd539477f83775ef93c3c7e244421d3/01958352-2268-7c6e-9e1d-17ff6642211b/source.tar.gz" + "lastModified": 1741513245, + "narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_5": { From 163adfc12dde6d00a0dafe89cd81b291efe76ac1 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:41:07 +0100 Subject: [PATCH 28/46] use main nix-unit --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3bc7123..3fd0786 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,7 @@ }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; nix-unit = { - url = "github:nix-community/nix-unit/?tag=v2.23.0"; + url = "github:nix-community/nix-unit"; inputs = { flake-parts.follows = "flake-parts"; nixpkgs.follows = "nixpkgs"; From 557803e2c290cc6a98115725b52e6b2d34e80298 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:47:13 +0100 Subject: [PATCH 29/46] use last tagged nix-unit --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 3fd0786..33f58e0 100644 --- a/flake.nix +++ b/flake.nix @@ -14,7 +14,7 @@ }; flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*"; nix-unit = { - url = "github:nix-community/nix-unit"; + url = "github:nix-community/nix-unit/?tag=v2.24.1"; inputs = { flake-parts.follows = "flake-parts"; nixpkgs.follows = "nixpkgs"; From f6fe2d3e569ce50cc7a377a481fe71938395ad14 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:52:37 +0100 Subject: [PATCH 30/46] use only some systems --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 33f58e0..b210e51 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,9 @@ ]; systems = [ # keep-sorted start - "x86_64-linux" + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" # keep-sorted end ]; perSystem = From d75d0374761ec7ca74ab366c0272f1aa8f2e287f Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 21:53:42 +0100 Subject: [PATCH 31/46] use nixpkgs from flakehub --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b210e51..57c89a1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "nullkomma"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; # keep-sorted start fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*"; flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*"; From fb7f205040fad38b444b51b92daf78f086f0c78b Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 22:00:57 +0100 Subject: [PATCH 32/46] remove bad system --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 57c89a1..252c912 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,6 @@ systems = [ # keep-sorted start "aarch64-darwin" - "aarch64-linux" "x86_64-darwin" # keep-sorted end ]; From 2e049a6498ee964643c1e4c2dfb58f6f58f48d5c Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 22:10:06 +0100 Subject: [PATCH 33/46] bump up lock file --- flake.lock | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index c74b0d0..bf4a817 100644 --- a/flake.lock +++ b/flake.lock @@ -333,18 +333,16 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1741513245, - "narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1", - "type": "github" + "lastModified": 1741600792, + "narHash": "sha256-yfDy6chHcM7pXpMF4wycuuV+ILSTG486Z/vLx/Bdi6Y=", + "rev": "ebe2788eafd539477f83775ef93c3c7e244421d3", + "revCount": 715519, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715519%2Brev-ebe2788eafd539477f83775ef93c3c7e244421d3/01958352-2268-7c6e-9e1d-17ff6642211b/source.tar.gz" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" } }, "nixpkgs_5": { From 3936825c094bc315a46bdd67d0a0dc590330bb00 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 22:23:26 +0100 Subject: [PATCH 34/46] try all systems with agnostic test --- flake.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 252c912..cdbeda2 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,9 @@ systems = [ # keep-sorted start "aarch64-darwin" + "aarch64-linux" "x86_64-darwin" + "x86_64-linux" # keep-sorted end ]; perSystem = @@ -87,7 +89,7 @@ inherit (inputs) nixpkgs flake-parts nix-unit; }; tests = { - "test example" = { + "test example system-specific" = { expr = "1"; expected = "1"; }; @@ -105,6 +107,12 @@ ''; }; }; + tests = { + "test example system-agnostic" = { + expr = "2"; + expected = "2"; + }; + }; }; }; } From 51b3e8188dbdfc664f12e734f33aa8bfd1eebcf7 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 11 Mar 2025 22:40:53 +0100 Subject: [PATCH 35/46] remove linux systems --- flake.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/flake.nix b/flake.nix index cdbeda2..a093239 100644 --- a/flake.nix +++ b/flake.nix @@ -35,9 +35,7 @@ systems = [ # keep-sorted start "aarch64-darwin" - "aarch64-linux" "x86_64-darwin" - "x86_64-linux" # keep-sorted end ]; perSystem = From fc9993cb26ff650caef1bd77a268071732932b77 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 13 Mar 2025 12:59:28 +0100 Subject: [PATCH 36/46] fix treefmt issue closes #80 --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a093239..2f24341 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,9 @@ systems = [ # keep-sorted start "aarch64-darwin" + "aarch64-linux" "x86_64-darwin" + "x86_64-linux" # keep-sorted end ]; perSystem = @@ -84,7 +86,7 @@ }; nix-unit = { inputs = { - inherit (inputs) nixpkgs flake-parts nix-unit; + inherit (inputs) nixpkgs flake-parts nix-unit treefmt-nix; }; tests = { "test example system-specific" = { From 1cc57f4084bee2fad470afad16976b0fa9a2687d Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 13 Mar 2025 13:11:30 +0100 Subject: [PATCH 37/46] fix lint --- flake.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 2f24341..ec20a5e 100644 --- a/flake.nix +++ b/flake.nix @@ -86,7 +86,12 @@ }; nix-unit = { inputs = { - inherit (inputs) nixpkgs flake-parts nix-unit treefmt-nix; + inherit (inputs) + nixpkgs + flake-parts + nix-unit + treefmt-nix + ; }; tests = { "test example system-specific" = { From 657ae83d4e376effed76e2149d156b373613ab8a Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 13 Mar 2025 16:02:22 +0100 Subject: [PATCH 38/46] run on all systems --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa28ad5..5de7729 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ concurrency: cancel-in-progress: true jobs: DeterminateCI: - uses: DeterminateSystems/ci/.github/workflows/workflow.yml@main + uses: DeterminateSystems/dataheld/.github/workflows/workflow.yml@pass-thru-failearly permissions: id-token: "write" contents: "read" From 544292dcb1d0c84e9c4bb182ae48d4751abcddb2 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Mon, 17 Mar 2025 22:53:43 +0100 Subject: [PATCH 39/46] fix path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5de7729..fc9a130 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ concurrency: cancel-in-progress: true jobs: DeterminateCI: - uses: DeterminateSystems/dataheld/.github/workflows/workflow.yml@pass-thru-failearly + uses: dataheld/ci/.github/workflows/workflow.yml@pass-thru-failearly permissions: id-token: "write" contents: "read" From f89feadb968810517c0e0a93bad7092961ae78f1 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 18 Mar 2025 22:55:28 +0100 Subject: [PATCH 40/46] document template setup --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 79728a0..831b88d 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ extra-[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) 🤌 ## Installing > \[!NOTE\] +> This is not another flake or development framework. +> It is much less; just the set of composable nix flakes and modules that I use for my projects. + +> \[!TIP\] > This is the software you need to have on your _system_. > All project-specific software is handled automatically. @@ -22,7 +26,11 @@ extra-[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) 🤌 1. (optional) Install [nix-direnv](https://github.com/nix-community/nix-direnv) for better performance during development. -1. (if not already done) Clone the repo +1. Add the necessary boilerplate files. + + ```sh + nix flake init --template "https://flakehub.com/f/dataheld/nullkomma/0.1.*#default" + ``` 1. (one-time only) Inside the repo, run `direnv allow` > \[!TIP\] From ed672924443eeb0cdeea6a8eb84c38a9d06dc145 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 18 Mar 2025 23:00:17 +0100 Subject: [PATCH 41/46] bump up versions --- flake.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index bf4a817..7dac35d 100644 --- a/flake.lock +++ b/flake.lock @@ -333,12 +333,12 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1741600792, - "narHash": "sha256-yfDy6chHcM7pXpMF4wycuuV+ILSTG486Z/vLx/Bdi6Y=", - "rev": "ebe2788eafd539477f83775ef93c3c7e244421d3", - "revCount": 715519, + "lastModified": 1742268799, + "narHash": "sha256-IhnK4LhkBlf14/F8THvUy3xi/TxSQkp9hikfDZRD4Ic=", + "rev": "da044451c6a70518db5b730fe277b70f494188f1", + "revCount": 715814, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715519%2Brev-ebe2788eafd539477f83775ef93c3c7e244421d3/01958352-2268-7c6e-9e1d-17ff6642211b/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.715814%2Brev-da044451c6a70518db5b730fe277b70f494188f1/0195a953-6802-701a-a1d1-1b8453be1416/source.tar.gz" }, "original": { "type": "tarball", From 224e729cbaca558553df03b0a5e212f0f44884dd Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 18 Mar 2025 23:12:53 +0100 Subject: [PATCH 42/46] add more files to template --- .envrc | 7 +------ flake.nix | 9 +++++---- template/base/.envrc | 6 ++++++ template/{ => base}/flake.nix | 0 4 files changed, 12 insertions(+), 10 deletions(-) mode change 100644 => 120000 .envrc create mode 100644 template/base/.envrc rename template/{ => base}/flake.nix (100%) diff --git a/.envrc b/.envrc deleted file mode 100644 index a93dec4..0000000 --- a/.envrc +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" -fi -use flake diff --git a/.envrc b/.envrc new file mode 120000 index 0000000..0b67630 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +template/.envrc \ No newline at end of file diff --git a/flake.nix b/flake.nix index ec20a5e..b61bd54 100644 --- a/flake.nix +++ b/flake.nix @@ -103,14 +103,15 @@ }; flake = { schemas = inputs.flake-schemas.schemas; - templates = { - default = { + templates = rec { + base = { description = "nullkomma template"; - path = ./template; + path = ./templates/base; welcomeText = '' - Welcome to the nullkomma template! + Welcome to the nullkomma template ''; }; + default = base; }; tests = { "test example system-agnostic" = { diff --git a/template/base/.envrc b/template/base/.envrc new file mode 100644 index 0000000..a93dec4 --- /dev/null +++ b/template/base/.envrc @@ -0,0 +1,6 @@ +#!/bin/bash + +if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" +fi +use flake diff --git a/template/flake.nix b/template/base/flake.nix similarity index 100% rename from template/flake.nix rename to template/base/flake.nix From fd1a3f45ed0d8be98a7f9c3bd311759050eb4977 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 18 Mar 2025 23:15:16 +0100 Subject: [PATCH 43/46] fix path --- {template => templates}/base/.envrc | 0 {template => templates}/base/flake.nix | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {template => templates}/base/.envrc (100%) rename {template => templates}/base/flake.nix (100%) diff --git a/template/base/.envrc b/templates/base/.envrc similarity index 100% rename from template/base/.envrc rename to templates/base/.envrc diff --git a/template/base/flake.nix b/templates/base/flake.nix similarity index 100% rename from template/base/flake.nix rename to templates/base/flake.nix From 57675d4cd15c87a326adaf8ea6a7d2f69457b9e1 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 18 Mar 2025 23:23:50 +0100 Subject: [PATCH 44/46] fix formatting --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 831b88d..a17368d 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,19 @@ extra-[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) 🤌 1. Install Nix (the package manager). The [Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer) is recommended. + 1. Install [direnv](https://direnv.net). + 1. (optional) Install [nix-direnv](https://github.com/nix-community/nix-direnv) for better performance during development. + 1. Add the necessary boilerplate files. - - ```sh - nix flake init --template "https://flakehub.com/f/dataheld/nullkomma/0.1.*#default" - ``` + + ```sh + nix flake init --template "https://flakehub.com/f/dataheld/nullkomma/0.1.*#default" + ``` + 1. (one-time only) Inside the repo, run `direnv allow` > \[!TIP\] From e8ec7f8a553454cc33d6c0770be6f0d371ccb4a0 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Tue, 18 Mar 2025 23:26:12 +0100 Subject: [PATCH 45/46] add boilerplate test for template --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b61bd54..a7fb171 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ }; outputs = - { flake-parts, ... }@inputs: + { flake-parts, self, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ # keep-sorted start @@ -118,6 +118,10 @@ expr = "2"; expected = "2"; }; + "test template welcome text" = { + expr = self.templates.default.description; + expected = "nullkomma template"; + }; }; }; }; From f4b0aed2ad40af824e90aaec6d8cca59e67bd287 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Wed, 19 Mar 2025 16:25:52 +0100 Subject: [PATCH 46/46] also add ci yaml --- templates/base/.github/workflows/ci.yml | 22 +++++++++++++++++ .../.github/workflows/nix_maintenance.yml | 24 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 templates/base/.github/workflows/ci.yml create mode 100644 templates/base/.github/workflows/nix_maintenance.yml diff --git a/templates/base/.github/workflows/ci.yml b/templates/base/.github/workflows/ci.yml new file mode 100644 index 0000000..aa28ad5 --- /dev/null +++ b/templates/base/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI +on: + pull_request: + workflow_dispatch: + push: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + DeterminateCI: + uses: DeterminateSystems/ci/.github/workflows/workflow.yml@main + permissions: + id-token: "write" + contents: "read" + with: + visibility: public + flake-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check Nix flake Nixpkgs inputs + uses: DeterminateSystems/flake-checker-action@v9 diff --git a/templates/base/.github/workflows/nix_maintenance.yml b/templates/base/.github/workflows/nix_maintenance.yml new file mode 100644 index 0000000..41a2484 --- /dev/null +++ b/templates/base/.github/workflows/nix_maintenance.yml @@ -0,0 +1,24 @@ +name: Maintenance +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 0" # runs weekly on Sunday at 01:00 +jobs: + nix-maintenance: + name: Nix Maintenance + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + with: + determinate: true + - uses: DeterminateSystems/flakehub-cache-action@main + - uses: DeterminateSystems/update-flake-lock@main + with: + pr-title: "Update flake.lock" + pr-labels: | + dependencies + automated + - uses: DeterminateSystems/flake-checker-action@main + with: + fail-mode: true