aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--flake.lock71
-rw-r--r--flake.nix84
-rw-r--r--treefmt.nix9
3 files changed, 134 insertions, 30 deletions
diff --git a/flake.lock b/flake.lock
index 8dc25a3..e3ba5a3 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,23 @@
{
"nodes": {
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": "nixpkgs-lib"
+ },
+ "locked": {
+ "lastModified": 1763759067,
+ "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1762363567,
@@ -16,9 +34,60 @@
"type": "github"
}
},
+ "nixpkgs-lib": {
+ "locked": {
+ "lastModified": 1761765539,
+ "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "type": "github"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1761236834,
+ "narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs",
+ "treefmt-nix": "treefmt-nix"
+ }
+ },
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": "nixpkgs_2"
+ },
+ "locked": {
+ "lastModified": 1762938485,
+ "narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 249b892..f0afc44 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,36 +1,62 @@
{
- description = "A very basic flake";
+ description = "Domino's flakes";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
- };
- outputs = { self, nixpkgs, ... }:
- let
- systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
- forAllSystems = nixpkgs.lib.genAttrs systems;
- in {
- packages = forAllSystems (system:
- let
- pkgs = nixpkgs.legacyPackages.${system};
- in {
- hello = pkgs.hello;
- default = pkgs.hello;
- }
- );
-
- devShells = forAllSystems (system:
- let
- pkgs = nixpkgs.legacyPackages.${system};
- in {
- default = pkgs.mkShell {
- packages = with pkgs; [
- erlang_28
- erlang-language-platform
- rebar3
- ];
- };
- }
- );
+ flake-parts = {
+ url = "github:hercules-ci/flake-parts";
+ };
+
+ treefmt-nix.url = "github:numtide/treefmt-nix";
};
+
+ outputs =
+ { self,
+ nixpkgs,
+ flake-parts,
+ treefmt-nix,
+ ...
+ }@inputs:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
+
+ perSystem =
+ { pkgs, system, ... }:
+ let
+ treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
+ in
+ {
+ # This sets `pkgs` to a nixpkgs with allowUnfree option set.
+ _module.args.pkgs = import nixpkgs {
+ inherit system;
+ config.allowUnfree = true;
+ };
+
+ # nix build
+ packages = {
+ hello = pkgs.hello;
+ default = pkgs.hello;
+ };
+
+ devShells =
+ {
+ default = pkgs.mkShell {
+ packages = with pkgs; [
+ erlang_28
+ erlang-language-platform
+ rebar3
+ ];
+ };
+ };
+
+ # nix fmt
+ formatter = treefmtEval.config.build.wrapper;
+
+ # nix flake check --all-systems
+ checks = {
+ formatting = treefmtEval.config.build.check self;
+ };
+ };
+ };
}
diff --git a/treefmt.nix b/treefmt.nix
new file mode 100644
index 0000000..4341016
--- /dev/null
+++ b/treefmt.nix
@@ -0,0 +1,9 @@
+# treefmt.nix
+{ pkgs, ... }:
+{
+ # Used to find the project root
+ projectRootFile = "flake.nix";
+ programs = {
+ erlfmt.enable = true;
+ };
+}