1
1
mirror of https://github.com/divnix/digga.git synced 2024-11-20 11:30:46 +03:00
digga/flake.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

158 lines
4.8 KiB
Nix
Raw Permalink Normal View History

{
description = "DevOS environment configuriguration library.";
nixConfig.extra-experimental-features = "nix-command flakes";
nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org";
nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
2022-11-08 17:06:32 +03:00
inputs = {
# Track channels with commits tested and built by hydra
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2022-04-21 07:13:28 +03:00
2022-11-08 17:06:32 +03:00
nixlib.url = "github:nix-community/nixpkgs.lib";
2022-11-08 17:06:32 +03:00
deploy.url = "github:serokell/deploy-rs";
deploy.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-22.11";
2022-11-08 17:06:32 +03:00
home-manager.inputs.nixpkgs.follows = "nixlib";
home-manager.inputs.utils.follows = "flake-utils";
2021-07-13 01:31:05 +03:00
2022-11-08 17:06:32 +03:00
darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";
2022-01-23 01:47:08 +03:00
2022-11-08 17:06:32 +03:00
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
2022-11-08 17:06:32 +03:00
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus/?ref=refs/pull/120/head";
flake-utils-plus.inputs.flake-utils.follows = "flake-utils";
2022-11-08 17:06:32 +03:00
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = {
self,
nixlib,
nixpkgs,
deploy,
devshell,
flake-utils-plus,
darwin,
home-manager,
...
} @ inputs: let
tests = import ./src/tests.nix {inherit (nixlib) lib;};
internal-modules = import ./src/modules.nix {
inherit (nixlib) lib;
};
2022-11-08 17:06:32 +03:00
importers = import ./src/importers.nix {
inherit (nixlib) lib;
};
2022-11-08 17:06:32 +03:00
collectors = import ./src/collectors.nix {
inherit (nixlib) lib;
};
2021-07-21 02:24:39 +03:00
2022-11-08 17:06:32 +03:00
generators = import ./src/generators.nix {
inherit (nixlib) lib;
inherit deploy;
};
2022-11-08 17:06:32 +03:00
mkFlake = let
mkFlake' = import ./src/mkFlake {
inherit (nixlib) lib;
2022-11-08 17:06:32 +03:00
inherit
collectors
darwin
deploy
devshell
home-manager
flake-utils-plus
internal-modules
tests
2022-04-21 03:16:34 +03:00
;
2021-07-21 02:24:39 +03:00
};
2022-11-08 17:06:32 +03:00
in {
__functor = _: args: (mkFlake' args).flake;
options = args: (mkFlake' args).options;
};
2022-11-08 17:06:32 +03:00
# Unofficial Flakes Roadmap - Polyfills
# This project is committed to the Unofficial Flakes Roadmap!
# .. see: https://demo.hedgedoc.org/s/_W6Ve03GK#
# Super Stupid Flakes (ssf) / System As an Input - Style:
supportedSystems = flake-utils-plus.lib.defaultSystems;
2022-11-08 17:06:32 +03:00
# Pass this flake(self) as "digga"
polyfillInputs = self.inputs // {digga = self;};
polyfillOutput = loc:
nixlib.lib.genAttrs supportedSystems (
system:
import loc {
inherit system;
inputs = polyfillInputs;
}
);
# .. we hope you like this style.
# .. it's adopted by a growing number of projects.
# Please consider adopting it if you want to help to improve flakes.
# DEPRECATED - will be removed timely
deprecated = import ./deprecated.nix {
inherit (nixlib) lib;
inherit importers;
};
in {
# what you came for ...
lib = {
inherit (flake-utils-plus.inputs.flake-utils.lib) defaultSystems eachSystem eachDefaultSystem filterPackages;
inherit (flake-utils-plus.lib) exportModules exportOverlays exportPackages mergeAny;
inherit mkFlake;
inherit (tests) mkTest allProfilesTest;
inherit (importers) flattenTree rakeLeaves importOverlays importExportableModules importHosts;
inherit (generators) mkDeployNodes mkHomeConfigurations;
inherit
(collectors)
collectHosts
collectHostsOnSystem
;
2022-11-12 00:38:52 +03:00
# editorconfig-checker-disable
2022-11-08 17:06:32 +03:00
# DEPRECATED - will be removed soon
inherit
(deprecated)
# Place any deprecated lib functions here
;
2022-11-12 00:38:52 +03:00
# editorconfig-checker-enable
};
2022-11-08 17:06:32 +03:00
# a little extra service ...
overlays = import ./overlays {inherit inputs;};
nixosModules = import ./modules/nixos-modules.nix;
darwinModules = import ./modules/darwin-modules.nix;
defaultTemplate = self.templates.devos;
templates.devos.path = ./examples/devos;
templates.devos.description = ''
an awesome template for NixOS users, with consideration for common tools like home-manager, devshell, and more.
'';
# digga-local use
## This doesn't appear to be used?
formatter = nixlib.lib.genAttrs supportedSystems (s: nixpkgs.legacyPackages.${s}.treefmt);
# system-space and pass sytem and input to each file
jobs = polyfillOutput ./jobs;
checks = polyfillOutput ./checks;
2022-11-12 00:38:52 +03:00
devShell = polyfillOutput ./shell;
2022-11-08 17:06:32 +03:00
};
}