From b3ddb341d8bfe6fb5f618dfee1f720a3deeee47d Mon Sep 17 00:00:00 2001 From: Kaare Hoff Skovgaard Date: Sat, 5 Jul 2025 15:09:30 +0200 Subject: [PATCH] Attempt to make usage a bit cleaner --- flake.lock | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 23 +++++---- 2 files changed, 152 insertions(+), 10 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d2bca51 --- /dev/null +++ b/flake.lock @@ -0,0 +1,139 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils-plus": { + "inputs": { + "flake-utils": "flake-utils" + }, + "locked": { + "lastModified": 1715533576, + "narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1751582995, + "narHash": "sha256-u7ubvtxdTnFPpV27AHpgoKn7qHuE7sgWgza/1oj5nzA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7a732ed41ca0dd64b4b71b563ab9805a80a7d693", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "snowfall-lib": "snowfall-lib", + "treefmt-nix": "treefmt-nix" + } + }, + "snowfall-lib": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils-plus": "flake-utils-plus", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736130495, + "narHash": "sha256-4i9nAJEZFv7vZMmrE0YG55I3Ggrtfo5/T07JEpEZ/RM=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "02d941739f98a09e81f3d2d9b3ab08918958beac", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750931469, + "narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index c207487..cd4ec41 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,6 @@ "aarch64-linux" "aarch64-darwin" ], - checks ? pkgs: { }, devShellPackages ? (pkgs: [ ]), treeFmtFile ? ./treefmt.nix, ... @@ -61,8 +60,9 @@ "devShellPackages" "treeFmtFile" ]; + flake = snowfall-lib.mkFlake snowfallOptions; in - (snowfall-lib.mkFlake snowfallOptions) + flake // (self.lib.eachSystem flakeBaseSystems ( system: let @@ -70,15 +70,18 @@ treeFmtEval = treefmt-nix.lib.evalModule pkgs treeFmtFile; in { - formatter = treeFmtEval.config.build.wrapper; - checks = { + formatter = flake.formatter.${system} or treeFmtEval.config.build.wrapper; + checks = flake.checks.${system} // { fmt = treeFmtEval.config.build.check self; - } // (checks pkgs); - devShells.default = pkgs.mkShell { - packages = [ - pkgs.nixfmt-rfc-style - pkgs.nixd - ] ++ (devShellPackages pkgs); + }; + devShells = flake.devShells.${system} // { + default = + flake.devShells.${system}.default or (pkgs.mkShell { + packages = [ + pkgs.nixfmt-rfc-style + pkgs.nixd + ] ++ (devShellPackages pkgs); + }); }; } ));