diff --git a/flake.lock b/flake.lock index 3dc7c61..9447d36 100644 --- a/flake.lock +++ b/flake.lock @@ -50,6 +50,22 @@ "type": "github" } }, + "nixos-unified": { + "locked": { + "lastModified": 1729435982, + "narHash": "sha256-FsTSOvkYk2CcJJIucAroNUDBe418To+JJlfzfrBdxEo=", + "owner": "srid", + "repo": "nixos-unified", + "rev": "4653654f2c4799eaeb8aafe7d91a1ba8954c7dcf", + "type": "github" + }, + "original": { + "owner": "srid", + "ref": "mkFlake", + "repo": "nixos-unified", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1729265718, @@ -71,26 +87,11 @@ "flake-parts": "flake-parts", "fourmolu-nix": "fourmolu-nix", "haskell-flake": "haskell-flake", + "nixos-unified": "nixos-unified", "nixpkgs": "nixpkgs", - "systems": "systems", "treefmt-nix": "treefmt-nix" } }, - "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": [ diff --git a/flake.nix b/flake.nix index 7f349f1..0370d40 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,9 @@ description = "Nix template for Haskell projects"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - systems.url = "github:nix-systems/default"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; + nixos-unified.url = "github:srid/nixos-unified/mkFlake"; haskell-flake.url = "github:srid/haskell-flake"; treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; @@ -12,13 +12,6 @@ }; outputs = inputs: - inputs.flake-parts.lib.mkFlake { inherit inputs; } { - systems = import inputs.systems; - - # See ./nix/modules/*.nix for the modules that are imported here. - imports = with builtins; - map - (fn: ./nix/modules/${fn}) - (attrNames (readDir ./nix/modules)); - }; + inputs.nixos-unified.lib.mkFlake + { inherit inputs; root = ./.; }; } diff --git a/nix/modules/devshell.nix b/nix/modules/flake-parts/devshell.nix similarity index 100% rename from nix/modules/devshell.nix rename to nix/modules/flake-parts/devshell.nix diff --git a/nix/modules/formatter.nix b/nix/modules/flake-parts/formatter.nix similarity index 100% rename from nix/modules/formatter.nix rename to nix/modules/flake-parts/formatter.nix diff --git a/nix/modules/haskell.nix b/nix/modules/flake-parts/haskell.nix similarity index 90% rename from nix/modules/haskell.nix rename to nix/modules/flake-parts/haskell.nix index 4e873a9..64fd871 100644 --- a/nix/modules/haskell.nix +++ b/nix/modules/flake-parts/haskell.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ root, inputs, ... }: { imports = [ inputs.haskell-flake.flakeModule @@ -11,12 +11,12 @@ # To avoid unnecessary rebuilds, we filter projectRoot: # https://community.flake.parts/haskell-flake/local#rebuild projectRoot = builtins.toString (lib.fileset.toSource { - root = ../..; + inherit root; fileset = lib.fileset.unions [ - ../../src - ../../haskell-template.cabal - ../../LICENSE - ../../README.md + (root + /src) + (root + /haskell-template.cabal) + (root + /LICENSE) + (root + /README.md) ]; }); diff --git a/nix/modules/template.nix b/nix/modules/flake-parts/template.nix similarity index 100% rename from nix/modules/template.nix rename to nix/modules/flake-parts/template.nix