diff options
| author | Kleidi Bujari <mail@4kb.net> | 2025-09-12 20:57:59 -0700 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2025-09-12 21:00:27 -0700 |
| commit | fe96211bb8dc81fde57bf6900b840e69f2b218fc (patch) | |
| tree | ff1c63e7962c6373199b94b8fd236b15e3441244 /flake.nix | |
| parent | ab58c69b6db2902688841a4008221f72bbbb8692 (diff) | |
| download | depot-fe96211bb8dc81fde57bf6900b840e69f2b218fc.tar.gz depot-fe96211bb8dc81fde57bf6900b840e69f2b218fc.tar.bz2 depot-fe96211bb8dc81fde57bf6900b840e69f2b218fc.zip | |
move packages to overlay and expose certain packages
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 60 |
1 files changed, 44 insertions, 16 deletions
@@ -9,35 +9,48 @@ nixos-hardware.url = "github:nixos/nixos-hardware/master"; }; - outputs = { self, nixpkgs, ... } @ inputs: + outputs = + { self, nixpkgs, ... }@inputs: let - inherit (builtins) mapAttrs; - inherit (nixpkgs) lib; - systems = [ "x86_64-linux" "aarch64-linux" ]; + systems = lib.intersectLists lib.systems.flakeExposed lib.platforms.linux; + + forAllSystems = lib.genAttrs systems; + nixpkgsFor = forAllSystems ( + system: + import inputs.nixpkgs { + inherit system; + overlays = [ overlays.default ]; + } + ); inherit (import ./lib/depot-tools.nix { inherit inputs systems lib; }) importDir - eachSystem systemArgs ; - packages = eachSystem ( - { newScope, ... }: - mapAttrs (pname: { path, ... }: newScope { inherit pname; } path { }) - (importDir ./packages lib.id) - ); + overlays.default = + final: _: + let + depot = lib.filesystem.packagesFromDirectoryRecursive { + callPackage = lib.callPackageWith (final // { inherit depot; }); + directory = ./packages; + }; + in + { + inherit depot; + }; - nixosModules = importDir ./modules - (mapAttrs (_: { path, ... }: path)); + nixosModules = importDir ./modules (builtins.mapAttrs (_: { path, ... }: path)); nixosConfigurations = importDir ./machines ( entries: let flake = self; - defaultModule = { config, ... }: + defaultModule = + { config, ... }: let perSystemArg = system: { _module.args.perSystem = systemArgs.${system}.perSystem; @@ -47,7 +60,8 @@ imports = [ (perSystemArg config.nixpkgs.hostPlatform.system) ]; }; - buildNixOS = hostName: entry: + buildNixOS = + hostName: entry: lib.nixosSystem { modules = [ defaultModule @@ -57,8 +71,22 @@ specialArgs = { inherit inputs flake hostName; }; }; in - mapAttrs buildNixOS entries + builtins.mapAttrs buildNixOS entries ); in - { inherit packages nixosModules nixosConfigurations; }; + { + inherit nixosModules nixosConfigurations; + + formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style); + packages = forAllSystems ( + system: + let + inherit (nixpkgsFor.${system}) depot; + in + { + inherit (depot.misc) cv; + inherit (depot.web) site; + } + ); + }; } |
