aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix160
1 files changed, 102 insertions, 58 deletions
diff --git a/flake.nix b/flake.nix
index 23e773f..9e306ef 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,92 +1,136 @@
{
- description = "NixOS server config";
+ description = "A NixOS Configuration";
inputs = {};
- outputs = {self, ...} @ attrs: let
- sources = import ./unflake.nix;
-
- inherit (sources) nixpkgs;
- inherit (sources) nixpkgs-unstable;
- inherit (sources) library;
- inherit (sources) treefmt-nix;
- inherit (sources) deploy-rs;
- # modules
- inherit (sources) agenix;
- inherit (sources) turtle;
- inherit (sources) disko;
- inherit (sources) impermanence;
- inherit (sources) simple-nixos-mailserver;
- inherit (sources) rocie;
+ outputs = {self, ...}: let
+ raw_sources = import ./unflake.nix;
system = "x86_64-linux";
- nixos-lib = import (nixpkgs + "/nixos/lib") {};
- pkgs = nixpkgs.legacyPackages.${system};
- pkgsUnstable = nixpkgs-unstable.legacyPackages.${system};
+ # Filter out the nixpkgs's from the sources, so we always use the `packageSets`.
+ sources = builtins.removeAttrs raw_sources ["nixpkgs-stable" "nixpkgs-unstable" "library"];
+
+ packageSets = rec {
+ stable = raw_sources.nixpkgs-stable.legacyPackages.${system};
+ unstable = raw_sources.nixpkgs-unstable.legacyPackages.${system};
- specialArgs =
- attrs
- // {
- inherit
- pkgsUnstable
- vhackPackages
- nixpkgs-unstable
- nixos-lib
- extraModules
- nixLib
- turtle
- ;
+ in_tree = import ./pkgs {
+ unstable_pkgs = unstable;
+ stable_pkgs = stable;
+ inherit extra_lib;
};
+ };
+ lib = packageSets.unstable.lib;
+ extra_lib = raw_sources.library.nixLib;
- extraModules = [
- agenix.nixosModules.default
- turtle.nixosModules.nixos
- disko.nixosModules.default
- impermanence.nixosModules.impermanence
- simple-nixos-mailserver.nixosModule
- rocie.nixosModules.default
+ extra_modules = [
+ sources.agenix.nixosModules.default
+ sources.turtle.nixosModules.nixos
+ sources.disko.nixosModules.default
+ sources.impermanence.nixosModules.impermanence
+ sources.simple-nixos-mailserver.nixosModule
+ sources.rocie.nixosModules.default
];
+ module_args = {
+ inherit
+ sources
+ # extra package sources
+ openPRsNixpkgs
+ packageSets
+ # extra information
+ system
+ ;
+ };
+ special_args = {
+ inherit
+ self
+ # Needs to be a special argument, because it is used for determining the `imports`
+ # value (via `mkByName`).
+ extra_lib
+ ;
+ };
- deployChecks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
- tests = pkgs.lib.attrsets.filterAttrs (_: v: !(v ? meta && v.meta.broken)) (import ./tests {inherit pkgs specialArgs nixLib;});
- vhackPackages = import ./pkgs {inherit pkgs nixLib pkgsUnstable;};
+ openPRsNixpkgs = {};
- hosts = import ./hosts {inherit self deploy-rs pkgs nixLib nixpkgs specialArgs extraModules;};
+ treefmtEval = import ./treefmt.nix {
+ inherit (sources) treefmt-nix;
+ pkgs = packageSets.unstable;
+ };
- inherit (library) nixLib;
- treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+ hosts = import ./hosts {
+ inherit
+ self
+ extra_lib
+ module_args
+ special_args
+ extra_modules
+ system
+ ;
+ inherit
+ (raw_sources)
+ nixpkgs-unstable
+ nixpkgs-stable
+ deploy-rs
+ ;
+ };
+
+ deployChecks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) sources.deploy-rs.lib;
+ tests = lib.attrsets.filterAttrs (_: v: !(v ? meta && v.meta.broken)) (import ./tests
+ {
+ inherit sources packageSets extra_modules module_args special_args extra_lib;
+ });
+ # myPkgsFlat =
+ # builtins.listToAttrs
+ # # Filter out the `override` and `overrideDerivation` functions
+ # (builtins.filter
+ # ({ name, value, }: lib.attrsets.isDerivation value)
+ # (lib.lists.flatten
+ # (lib.attrsets.mapAttrsToList
+ # (name: value:
+ # if lib.attrsets.isDerivation value then
+ # [ { inherit name value; } ]
+ # else
+ # lib.attrsets.mapAttrsToList
+ # (name: value: { inherit name value; })
+ # value
+ # )
+ # packageSets.in_tree
+ # )
+ # )
+ # );
in {
checks."${system}" =
- nixLib.warnMerge deployChecks."${system}" (nixLib.warnMerge tests {
- formatting = treefmtEval.config.build.check self;
- } "the flake checks and formatting")
+ extra_lib.warnMerge
+ deployChecks."${system}"
+ (extra_lib.warnMerge
+ tests
+ {formatting = treefmtEval.config.build.check self;}
+ "the flake checks and formatting")
"the flake checks and deploy rs checks";
- packages."${system}" = vhackPackages;
+ legacyPackages."${system}" = packageSets.unstable;
+
+ packages."${system}" = packageSets.in_tree;
+
formatter."${system}" = treefmtEval.config.build.wrapper;
devShells."${system}" = {
- default = pkgs.mkShell {
+ default = packageSets.unstable.mkShell {
packages = [
- pkgs.git-bug
-
- pkgs.deploy-rs
+ packageSets.unstable.deploy-rs
# Used to update the stalwart-mail spamfilter
- pkgs.nix-update
-
- pkgs.cocogitto
+ packageSets.unstable.nix-update
- (agenix.packages."${system}".default.override {
- nix = pkgs.lixPackageSets.latest.lix;
+ (sources.agenix.packages."${system}".default.override {
+ nix = packageSets.unstable.lixPackageSets.latest.lix;
})
];
};
};
deploy.nodes = hosts.nodes;
-
inherit (hosts) nixosConfigurations;
};
}