From bb86ea12cabe0d54e7be0d56b0e8dcc223586f22 Mon Sep 17 00:00:00 2001 From: pengo Date: Mon, 8 Jun 2026 17:13:07 -0600 Subject: [PATCH] nix: drop flake parts --- flake.lock | 34 -------------------- flake.nix | 94 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 52 insertions(+), 76 deletions(-) diff --git a/flake.lock b/flake.lock index 03d3a7bc..b44f4838 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1749398372, - "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1778274207, @@ -34,24 +16,8 @@ "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1748740939, - "narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "656a64127e9d791a334452c6b6606d17539476e2", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "root": { "inputs": { - "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "scenefx": "scenefx" } diff --git a/flake.nix b/flake.nix index 33b97c9b..b1e8d6c3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,6 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-parts.url = "github:hercules-ci/flake-parts"; scenefx = { url = "github:wlrfx/scenefx"; inputs.nixpkgs.follows = "nixpkgs"; @@ -10,54 +9,65 @@ outputs = { self, - flake-parts, - ... - } @ inputs: - flake-parts.lib.mkFlake {inherit inputs;} { - imports = [ - inputs.flake-parts.flakeModules.easyOverlay - ]; + nixpkgs, + scenefx, + }: let + inherit (nixpkgs.lib) genAttrs; - flake = { - hmModules.mango = import ./nix/hm-modules.nix self; - nixosModules.mango = import ./nix/nixos-modules.nix self; - }; + # Systems mangowm supports. Options that call `forEachSystem` will generate an attribute for each of these options. + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; - perSystem = { - config, + # Helper function that generates an attribute set by calling the provided `perSystem` function for each system in `systems` defined above. + forEachSystem = perSystem: + genAttrs systems ( + system: + perSystem { + inherit system; + pkgs = nixpkgs.legacyPackages.${system}; + } + ); + in { + overlays.default = final: prev: { + inherit (self.packages.${final.stdenv.hostPlatform.system}) mango; + }; + + packages = forEachSystem ( + { pkgs, - ... + system, }: let - inherit (pkgs) callPackage ; + inherit (pkgs) callPackage; mango = callPackage ./nix { - inherit (inputs.scenefx.packages.${pkgs.stdenv.hostPlatform.system}) scenefx; - }; - shellOverride = old: { - nativeBuildInputs = old.nativeBuildInputs ++ []; - buildInputs = old.buildInputs ++ []; + inherit (scenefx.packages.${system}) scenefx; }; in { - packages.default = mango; - overlayAttrs = { - inherit (config.packages) mango; + inherit mango; + default = mango; + hm-options-json = callPackage (import ./nix/generate-options.nix self) { + module = ./nix/hm-modules.nix; + optionPrefix = "wayland.windowManager.mango."; }; - packages = { - inherit mango; - hm-options-json = pkgs.callPackage (import ./nix/generate-options.nix self) { - module = ./nix/hm-modules.nix; - optionPrefix = "wayland.windowManager.mango."; - }; - nixos-options-json = pkgs.callPackage (import ./nix/generate-options.nix self) { - module = ./nix/nixos-modules.nix; - optionPrefix = "programs.mango."; - }; + nixos-options-json = callPackage (import ./nix/generate-options.nix self) { + module = ./nix/nixos-modules.nix; + optionPrefix = "programs.mango."; }; - devShells.default = mango.overrideAttrs shellOverride; - formatter = pkgs.alejandra; - }; - systems = [ - "x86_64-linux" - "aarch64-linux" - ]; - }; + } + ); + + nixosModules.mango = import ./nix/nixos-modules.nix self; + hmModules.mango = import ./nix/hm-modules.nix self; + + devShells = forEachSystem ( + {system, ...}: { + default = self.packages.${system}.mango; + } + ); + + formatter = forEachSystem ( + {pkgs, ...}: pkgs.alejandra + ); + }; }