diff options
| author | seth <[email protected]> | 2023-08-17 18:28:42 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-08-17 18:29:17 -0400 |
| commit | 820623a5d4781da517f06a54b5ada63609ff97f1 (patch) | |
| tree | cf596d591eefb74fdab69e7a2268b5c28f25af1f | |
| parent | e47de8355dca82953a77618af636524feef361dd (diff) | |
remove lib
i'll probably redo these again one day to make them a lot cleaner
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | lib/ci.nix | 84 | ||||
| -rw-r--r-- | lib/configs.nix | 39 | ||||
| -rw-r--r-- | lib/default.nix | 4 |
4 files changed, 0 insertions, 129 deletions
@@ -69,8 +69,6 @@ p // {default = p.treefetch;} ); - lib = import ./lib lib; - overlays.default = final: _: import ./pkgs final; templates = let diff --git a/lib/ci.nix b/lib/ci.nix deleted file mode 100644 index a58dd7f..0000000 --- a/lib/ci.nix +++ /dev/null @@ -1,84 +0,0 @@ -lib: supportedSystems: let - inherit (builtins) attrNames baseNameOf elem getContext head mapAttrs seq stringLength substring; - inherit (lib) filterAttrs; - check = string: elem string supportedSystems; -in rec { - # filters systems in basic flake output - # ex: - # - # packages = { - # x86_64-linux = {}; - # aarch64-linux = {}; - # x86_64-darwin = {}; - # aarch64-darwin = {}; - # }; - # mkCompatible packages -> { x86_64-linux = {}; aarch64-linux = {}; } - mkCompatible = filterAttrs (system: _: check system); - - # mkCompatible but for apps, since their attribute - # also needs to be editied in order to be picked up - # by some ci systems - mkCompatibleApps = apps: - mkCompatible - (mapAttrs ( - _: - mapAttrs (_: v: { - program = let - ctx = getContext v.program; - drvPath = head (attrNames ctx); - basename = baseNameOf drvPath; - hashLength = 33; - l = stringLength basename; - in { - name = substring hashLength (l - hashLength - 4) basename; - type = "derivation"; - inherit drvPath; - }; - }) - ) - apps); - - # mkCompatible but for formatters - mkCompatibleFormatters = filterAttrs (system: fmt: check system && elem system (fmt.meta.platforms or [])); - - # mkComaptible, but maps nixosConfigurations - # to their toplevel build attribute so they can - # be picked up by ci - mkCompatibleCfg = configs: - filterAttrs (_: config: check config.system) - (mapAttrs (_: v: v.config.system.build.toplevel) configs); - - # mkCompatibleCfg, but the toplevel build attribute - # is only evaluated - mkCompatibleCfg' = configs: - filterAttrs (_: config: check config.system) - (mapAttrs (_: v: - seq - v.config.system.build.toplevel - v._module.args.pkgs.emptyFile) - configs); - - # mkCompatible, but maps homeConfigurations - # to their activationPackage so they can be - # picked up by ci - mkCompatibleHM = configs: - mkCompatible - (mapAttrs (_: - mapAttrs (_: deriv: - deriv.activationPackage or {})) - configs); - - # mkCompatible, but for packages - # meta.platforms is also checked to ensure compatibility - mkCompatiblePkgs = pkgs: - mkCompatible - (mapAttrs ( - system: - filterAttrs ( - _: deriv: - elem system (deriv.meta.platforms or []) - && !(deriv.meta.broken or false) - ) - ) - pkgs); -} diff --git a/lib/configs.nix b/lib/configs.nix deleted file mode 100644 index 1f6975c..0000000 --- a/lib/configs.nix +++ /dev/null @@ -1,39 +0,0 @@ -inputs: let - mkSystem = name: { - profile, - modules ? profile.modules, - system ? profile.system, - specialArgs ? profile.specialArgs, - }: - profile.builder { - inherit specialArgs system; - modules = - ["${inputs.self}/hosts/${name}"] - ++ ( - if modules == profile.modules - then modules - else modules ++ profile.modules - ); - }; - - mkHMUser = name: { - modules ? [], - pkgs ? import inputs.nixpkgs {system = "x86_64-linux";}, - extraSpecialArgs ? inputs, - }: - inputs.home-manager.lib.homeManagerConfiguration { - inherit pkgs extraSpecialArgs; - modules = - [ - { - programs.home-manager.enable = true; - } - ] - ++ ["${inputs.self}/users/${name}/home.nix"] - ++ modules; - }; -in { - inherit mkHMUser mkSystem; - mkHMUsers = builtins.mapAttrs mkHMUser; - mkSystems = builtins.mapAttrs mkSystem; -} diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 10ac688..0000000 --- a/lib/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -lib: { - ci = import ./ci.nix lib; - configs = import ./configs.nix; -} |
