aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
authorMarcos Benevides <marcos.schonfinkel@gmail.com>2025-12-04 09:01:16 -0400
committerGitHub <noreply@github.com>2025-12-04 09:01:16 -0400
commitd4049e9cbb634bfedaea409ab0fdaee32a3b2282 (patch)
treefc978654ff492fc2d88b0520303a734e7595cc22 /flake.nix
parentc4e1b573dacd67277ea9df1751574ef2dfb44601 (diff)
downloadSakura-d4049e9cbb634bfedaea409ab0fdaee32a3b2282.tar.gz
Sakura-d4049e9cbb634bfedaea409ab0fdaee32a3b2282.zip
#32 REFACTOR Nix setup (#33)
Diffstat (limited to '')
-rw-r--r--flake.nix84
1 files changed, 55 insertions, 29 deletions
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;
+ };
+ };
+ };
}