From 40ee120dcc2c170d1180aa59bafbf046bb950706 Mon Sep 17 00:00:00 2001 From: figsoda Date: Mon, 29 May 2023 13:52:03 -0400 Subject: [PATCH] remove unused code --- all-modules.nix | 1 - dev/flake-module.nix | 4 ++-- dev/flake.nix | 2 +- extras/easyOverlay.nix | 4 ++-- extras/flakeModules.nix | 4 +--- flake.nix | 2 +- lib.nix | 23 +---------------------- modules/apps.nix | 7 +------ modules/checks.nix | 2 +- modules/debug.nix | 3 --- modules/devShells.nix | 2 +- modules/flake.nix | 5 +---- modules/formatter.nix | 4 ++-- modules/legacyPackages.nix | 2 +- modules/moduleWithSystem.nix | 2 +- modules/nixosConfigurations.nix | 2 +- modules/nixosModules.nix | 4 +--- modules/overlays.nix | 4 ++-- modules/packages.nix | 2 +- modules/transposition.nix | 6 +----- modules/withSystem.nix | 6 ++---- 21 files changed, 24 insertions(+), 67 deletions(-) diff --git a/all-modules.nix b/all-modules.nix index 83d2bd0..0a9f38e 100644 --- a/all-modules.nix +++ b/all-modules.nix @@ -1,4 +1,3 @@ -{ lib, ... }: { imports = [ ./modules/apps.nix diff --git a/dev/flake-module.nix b/dev/flake-module.nix index fa77f15..5ac60b9 100644 --- a/dev/flake-module.nix +++ b/dev/flake-module.nix @@ -13,7 +13,7 @@ when.dayOfMonth = 1; }; - perSystem = { config, self', inputs', pkgs, ... }: { + perSystem = { config, pkgs, ... }: { devShells.default = pkgs.mkShell { nativeBuildInputs = [ @@ -42,7 +42,7 @@ # for repl exploration / debug config.config = config; options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; }; - config.effects = withSystem "x86_64-linux" ({ config, pkgs, hci-effects, ... }: { + config.effects = withSystem "x86_64-linux" ({ pkgs, hci-effects, ... }: { tests = { template = pkgs.callPackage ./tests/template.nix { inherit hci-effects; }; }; diff --git a/dev/flake.nix b/dev/flake.nix index b0af470..e6fc8e5 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -12,7 +12,7 @@ hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects"; }; - outputs = { self, ... }: + outputs = { ... }: { # The dev tooling is in ./flake-module.nix # See comment at `inputs` above. diff --git a/extras/easyOverlay.nix b/extras/easyOverlay.nix index a29c890..679afd1 100644 --- a/extras/easyOverlay.nix +++ b/extras/easyOverlay.nix @@ -1,4 +1,4 @@ -toplevel@{ config, lib, flake-parts-lib, getSystemIgnoreWarning, ... }: +toplevel@{ lib, flake-parts-lib, getSystemIgnoreWarning, ... }: let inherit (flake-parts-lib) mkPerSystemOption; @@ -37,7 +37,7 @@ in }; }; config = { - _module.args.final = lib.mkDefault (pkgs.extend (toplevel.config.flake.overlays.default)); + _module.args.final = lib.mkDefault (pkgs.extend toplevel.config.flake.overlays.default); }; }); }; diff --git a/extras/flakeModules.nix b/extras/flakeModules.nix index 6468dcb..4da738e 100644 --- a/extras/flakeModules.nix +++ b/extras/flakeModules.nix @@ -1,10 +1,8 @@ -{ config, self, lib, flake-parts-lib, ... }: +{ self, lib, flake-parts-lib, ... }: let inherit (lib) - filterAttrs mapAttrs mkOption - optionalAttrs types ; inherit (flake-parts-lib) diff --git a/flake.nix b/flake.nix index 5d1447b..190d8f2 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ nixpkgs-lib.url = "github:NixOS/nixpkgs/nixos-unstable?dir=lib"; }; - outputs = { self, nixpkgs-lib, ... }: { + outputs = { nixpkgs-lib, ... }: { lib = import ./lib.nix { inherit (nixpkgs-lib) lib; }; templates = { default = { diff --git a/lib.nix b/lib.nix index ae588c8..f99f0cc 100644 --- a/lib.nix +++ b/lib.nix @@ -28,27 +28,6 @@ let then maybeFlake._type == "flake" else maybeFlake ? inputs && maybeFlake ? outputs && maybeFlake ? sourceInfo; - # Polyfill functionTo to make sure it has type merging. - # Remove 2022-12 - functionTo = - let sample = types.functionTo lib.types.str; - in - if sample.functor.wrapped._type or null == "option-type" - then types.functionTo - else - elemType: lib.mkOptionType { - name = "functionTo"; - description = "function that evaluates to a(n) ${elemType.description}"; - check = lib.isFunction; - merge = loc: defs: - fnArgs: (lib.mergeDefinitions (loc ++ [ "[function body]" ]) elemType (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs)).mergedValue; - getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "[function body]" ]); - getSubModules = elemType.getSubModules; - substSubModules = m: functionTo (elemType.substSubModules m); - functor = (lib.defaultFunctor "functionTo") // { type = functionTo; wrapped = elemType; }; - nestedTypes.elemType = elemType; - }; - # Polyfill https://github.com/NixOS/nixpkgs/pull/163617 deferredModuleWith = lib.deferredModuleWith or ( attrs@{ staticModules ? [ ] }: mkOptionType { @@ -216,7 +195,7 @@ let } // optionalAttrs (toType != null) { type = toType; }); - config = (mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt); + config = mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt; }; # Helper function for importing while preserving module location. To be added diff --git a/modules/apps.nix b/modules/apps.nix index dcd5b09..0fd5d7c 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption @@ -17,11 +17,6 @@ let getExe = x: "${lib.getBin x}/bin/${x.meta.mainProgram or (throw ''Package ${x.name or ""} does not have meta.mainProgram set, so I don't know how to find the main executable. You can set meta.mainProgram, or pass the full path to executable, e.g. program = "''${pkg}/bin/foo"'')}"; - getBin = x: - if !x?outputSpecified || !x.outputSpecified - then x.bin or x.out or x - else x; - appType = lib.types.submodule { options = { type = mkOption { diff --git a/modules/checks.nix b/modules/checks.nix index d849c65..9e7ceae 100644 --- a/modules/checks.nix +++ b/modules/checks.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption diff --git a/modules/debug.nix b/modules/debug.nix index 6436010..995f13b 100644 --- a/modules/debug.nix +++ b/modules/debug.nix @@ -10,9 +10,6 @@ let inherit (flake-parts-lib) mkPerSystemOption ; - inherit (builtins) - removeAttrs - ; mkDebugConfig = { config, options, extendModules }: config // { inherit config; diff --git a/modules/devShells.nix b/modules/devShells.nix index 6521fa8..d14e59e 100644 --- a/modules/devShells.nix +++ b/modules/devShells.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption diff --git a/modules/flake.nix b/modules/flake.nix index 884b2de..012a6c9 100644 --- a/modules/flake.nix +++ b/modules/flake.nix @@ -1,10 +1,7 @@ -{ config, lib, ... }: +{ lib, ... }: let inherit (lib) - filterAttrs - mapAttrs mkOption - optionalAttrs types ; in diff --git a/modules/formatter.nix b/modules/formatter.nix index 975e664..838b7cf 100644 --- a/modules/formatter.nix +++ b/modules/formatter.nix @@ -24,7 +24,7 @@ in }; }; - perSystem = mkPerSystemOption ({ config, ... }: { + perSystem = mkPerSystemOption { _file = ./formatter.nix; options = { formatter = mkOption { @@ -35,7 +35,7 @@ in ''; }; }; - }); + }; }; config = { flake.formatter = diff --git a/modules/legacyPackages.nix b/modules/legacyPackages.nix index 36df4dd..fb17e14 100644 --- a/modules/legacyPackages.nix +++ b/modules/legacyPackages.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption diff --git a/modules/moduleWithSystem.nix b/modules/moduleWithSystem.nix index 057399e..e5c7008 100644 --- a/modules/moduleWithSystem.nix +++ b/modules/moduleWithSystem.nix @@ -1,4 +1,4 @@ -{ config, lib, withSystem, ... }: +{ withSystem, ... }: { config = { _module.args = { diff --git a/modules/nixosConfigurations.nix b/modules/nixosConfigurations.nix index c2ae8d6..7dc973b 100644 --- a/modules/nixosConfigurations.nix +++ b/modules/nixosConfigurations.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption diff --git a/modules/nixosModules.nix b/modules/nixosModules.nix index 1d21f9e..34e205a 100644 --- a/modules/nixosModules.nix +++ b/modules/nixosModules.nix @@ -1,10 +1,8 @@ -{ config, self, lib, flake-parts-lib, ... }: +{ self, lib, flake-parts-lib, ... }: let inherit (lib) - filterAttrs mapAttrs mkOption - optionalAttrs types ; inherit (flake-parts-lib) diff --git a/modules/overlays.nix b/modules/overlays.nix index 86fc457..a09e8f6 100644 --- a/modules/overlays.nix +++ b/modules/overlays.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption @@ -16,7 +16,7 @@ in # also update description when done type = types.lazyAttrsOf (types.uniq (types.functionTo (types.functionTo (types.lazyAttrsOf types.unspecified)))); # This eta expansion exists for the sole purpose of making nix flake check happy. - apply = lib.mapAttrs (k: f: final: prev: f final prev); + apply = lib.mapAttrs (_k: f: final: prev: f final prev); default = { }; example = lib.literalExpression or lib.literalExample '' { diff --git a/modules/packages.nix b/modules/packages.nix index dcb29eb..20f0071 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-parts-lib, ... }: +{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption diff --git a/modules/transposition.nix b/modules/transposition.nix index 5ddfcd0..01ceb93 100644 --- a/modules/transposition.nix +++ b/modules/transposition.nix @@ -7,10 +7,6 @@ let mkOption types ; - inherit (flake-parts-lib) - mkSubmoduleOptions - mkPerSystemOption - ; transpositionModule = { options = { @@ -70,7 +66,7 @@ in config.transposition ); - perSystem = { ... }: { + perSystem = { options = mapAttrs (k: v: lib.mkOption { }) diff --git a/modules/withSystem.nix b/modules/withSystem.nix index c6b0a16..161eece 100644 --- a/modules/withSystem.nix +++ b/modules/withSystem.nix @@ -1,8 +1,6 @@ -{ config, lib, flake-parts-lib, self, getSystem, ... }: +{ lib, flake-parts-lib, getSystem, ... }: let inherit (lib) - genAttrs - mapAttrs mkOption types ; @@ -12,7 +10,7 @@ let in { options = { - perSystem = mkPerSystemOption ({ config, options, system, specialArgs, ... }: { + perSystem = mkPerSystemOption ({ config, options, specialArgs, ... }: { _file = ./perSystem.nix; options = { allModuleArgs = mkOption {