summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2025-09-12 20:57:59 -0700
committerKleidi Bujari <mail@4kb.net>2025-09-12 21:00:27 -0700
commitfe96211bb8dc81fde57bf6900b840e69f2b218fc (patch)
treeff1c63e7962c6373199b94b8fd236b15e3441244 /flake.nix
parentab58c69b6db2902688841a4008221f72bbbb8692 (diff)
downloaddepot-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.nix60
1 files changed, 44 insertions, 16 deletions
diff --git a/flake.nix b/flake.nix
index a87c3f6..7f53a57 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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;
+ }
+ );
+ };
}