From cb7b138ac86a2188b8a09566b7e9e58fc11a2166 Mon Sep 17 00:00:00 2001 From: Jasi Date: Tue, 5 Aug 2025 00:27:59 -0400 Subject: [PATCH 1/4] flake: use outputs pattern from self --- flake.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 58b7b273..5543af82 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ outputs = { self, ... }@inputs: let + inherit (self) outputs; # build platforms supported for uboot in nixpkgs systems = [ "aarch64-linux" @@ -39,14 +40,14 @@ formatting = treefmtEval.${system}.config.build.check self; }); - overlays = rec { + overlays = { apple-silicon-overlay = import ./apple-silicon-support/packages/overlay.nix; - default = apple-silicon-overlay; + default = outputs.overlays.apple-silicon-overlay; }; - nixosModules = rec { + nixosModules = { apple-silicon-support = ./apple-silicon-support; - default = apple-silicon-support; + default = outputs.nixosModules.apple-silicon-support; }; packages = forAllSystems ( @@ -56,7 +57,7 @@ crossSystem.system = "aarch64-linux"; localSystem.system = system; overlays = [ - self.overlays.default + outputs.overlays.default ]; }; in @@ -80,7 +81,7 @@ pkgs = import inputs.nixpkgs { crossSystem.system = "aarch64-linux"; localSystem.system = system; - overlays = [ self.overlays.default ]; + overlays = [ outputs.overlays.default ]; }; specialArgs = { From 199ba40d0def5250e3820371ac36a4e848239f74 Mon Sep 17 00:00:00 2001 From: Jasi Date: Sat, 30 Aug 2025 20:09:07 -0400 Subject: [PATCH 2/4] flake: remove treefmt-nix input for `nixfmt-tree` package --- flake.lock | 23 +---------------------- flake.nix | 17 ++--------------- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/flake.lock b/flake.lock index b7cbaec2..b2fddfec 100644 --- a/flake.lock +++ b/flake.lock @@ -34,28 +34,7 @@ "root": { "inputs": { "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs", - "treefmt-nix": "treefmt-nix" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1754847726, - "narHash": "sha256-2vX8QjO5lRsDbNYvN9hVHXLU6oMl+V/PsmIiJREG4rE=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "7d81f6fb2e19bf84f1c65135d1060d829fae2408", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 5543af82..a012eab9 100644 --- a/flake.nix +++ b/flake.nix @@ -7,8 +7,6 @@ }; flake-compat.url = "github:nix-community/flake-compat"; - treefmt-nix.url = "github:numtide/treefmt-nix"; - treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = @@ -22,22 +20,11 @@ ]; # "i686-linux" omitted forAllSystems = inputs.nixpkgs.lib.genAttrs systems; - - treefmtEval = forAllSystems ( - system: - let - pkgs = inputs.nixpkgs.legacyPackages.${system}; - in - inputs.treefmt-nix.lib.evalModule pkgs { - projectRootFile = "flake.nix"; - programs.nixfmt.enable = true; - } - ); in { - formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper); + formatter = forAllSystems (system: inputs.nixpkgs.legacyPackages.${system}.nixfmt-tree); checks = forAllSystems (system: { - formatting = treefmtEval.${system}.config.build.check self; + formatting = outputs.formatter.${system}; }); overlays = { From 4f1f73242aa7e2eeea5fdb28b2d08e5f1ae7308f Mon Sep 17 00:00:00 2001 From: Jasi Date: Tue, 5 Aug 2025 00:25:25 -0400 Subject: [PATCH 3/4] flake: add devShells attribute; integrate direnv support --- .envrc | 1 + .gitignore | 1 + flake.nix | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 1aca8d47..9b4bb157 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /rootfs /installer bootbits/ +/.direnv/ diff --git a/flake.nix b/flake.nix index a012eab9..55f2f507 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,12 @@ formatting = outputs.formatter.${system}; }); + devShells = forAllSystems (system: { + default = inputs.nixpkgs.legacyPackages.${system}.mkShellNoCC { + packages = [ outputs.formatter.${system} ]; + }; + }); + overlays = { apple-silicon-overlay = import ./apple-silicon-support/packages/overlay.nix; default = outputs.overlays.apple-silicon-overlay; From 1812c9a728f747cd7b06fcb6890ac0f8d3423a45 Mon Sep 17 00:00:00 2001 From: Jasi Date: Mon, 4 Aug 2025 21:08:58 -0400 Subject: [PATCH 4/4] flake: flatten nixpkgs input attribute set --- flake.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 55f2f507..5ca5fa2d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,10 +2,7 @@ description = "Apple Silicon support for NixOS"; inputs = { - nixpkgs = { - url = "github:nixos/nixpkgs/nixos-unstable"; - }; - + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-compat.url = "github:nix-community/flake-compat"; };