mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
remove unused code
This commit is contained in:
parent
006c75898c
commit
40ee120dcc
21 changed files with 24 additions and 67 deletions
|
@ -1,4 +1,3 @@
|
||||||
{ lib, ... }:
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./modules/apps.nix
|
./modules/apps.nix
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
when.dayOfMonth = 1;
|
when.dayOfMonth = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = { config, self', inputs', pkgs, ... }: {
|
perSystem = { config, pkgs, ... }: {
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
# for repl exploration / debug
|
# for repl exploration / debug
|
||||||
config.config = config;
|
config.config = config;
|
||||||
options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; };
|
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 = {
|
tests = {
|
||||||
template = pkgs.callPackage ./tests/template.nix { inherit hci-effects; };
|
template = pkgs.callPackage ./tests/template.nix { inherit hci-effects; };
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
|
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, ... }:
|
outputs = { ... }:
|
||||||
{
|
{
|
||||||
# The dev tooling is in ./flake-module.nix
|
# The dev tooling is in ./flake-module.nix
|
||||||
# See comment at `inputs` above.
|
# See comment at `inputs` above.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
toplevel@{ config, lib, flake-parts-lib, getSystemIgnoreWarning, ... }:
|
toplevel@{ lib, flake-parts-lib, getSystemIgnoreWarning, ... }:
|
||||||
let
|
let
|
||||||
inherit (flake-parts-lib)
|
inherit (flake-parts-lib)
|
||||||
mkPerSystemOption;
|
mkPerSystemOption;
|
||||||
|
@ -37,7 +37,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
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);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
{ config, self, lib, flake-parts-lib, ... }:
|
{ self, lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
filterAttrs
|
|
||||||
mapAttrs
|
mapAttrs
|
||||||
mkOption
|
mkOption
|
||||||
optionalAttrs
|
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
inherit (flake-parts-lib)
|
inherit (flake-parts-lib)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
nixpkgs-lib.url = "github:NixOS/nixpkgs/nixos-unstable?dir=lib";
|
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; };
|
lib = import ./lib.nix { inherit (nixpkgs-lib) lib; };
|
||||||
templates = {
|
templates = {
|
||||||
default = {
|
default = {
|
||||||
|
|
23
lib.nix
23
lib.nix
|
@ -28,27 +28,6 @@ let
|
||||||
then maybeFlake._type == "flake"
|
then maybeFlake._type == "flake"
|
||||||
else maybeFlake ? inputs && maybeFlake ? outputs && maybeFlake ? sourceInfo;
|
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
|
# Polyfill https://github.com/NixOS/nixpkgs/pull/163617
|
||||||
deferredModuleWith = lib.deferredModuleWith or (
|
deferredModuleWith = lib.deferredModuleWith or (
|
||||||
attrs@{ staticModules ? [ ] }: mkOptionType {
|
attrs@{ staticModules ? [ ] }: mkOptionType {
|
||||||
|
@ -216,7 +195,7 @@ let
|
||||||
} // optionalAttrs (toType != null) {
|
} // optionalAttrs (toType != null) {
|
||||||
type = toType;
|
type = toType;
|
||||||
});
|
});
|
||||||
config = (mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt);
|
config = mkAliasAndWrapDefsWithPriority (setAttrByPath to) fromOpt;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Helper function for importing while preserving module location. To be added
|
# Helper function for importing while preserving module location. To be added
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
@ -17,11 +17,6 @@ let
|
||||||
getExe = x:
|
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"'')}";
|
"${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 {
|
appType = lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
|
|
@ -10,9 +10,6 @@ let
|
||||||
inherit (flake-parts-lib)
|
inherit (flake-parts-lib)
|
||||||
mkPerSystemOption
|
mkPerSystemOption
|
||||||
;
|
;
|
||||||
inherit (builtins)
|
|
||||||
removeAttrs
|
|
||||||
;
|
|
||||||
|
|
||||||
mkDebugConfig = { config, options, extendModules }: config // {
|
mkDebugConfig = { config, options, extendModules }: config // {
|
||||||
inherit config;
|
inherit config;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
{ config, lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
filterAttrs
|
|
||||||
mapAttrs
|
|
||||||
mkOption
|
mkOption
|
||||||
optionalAttrs
|
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
|
|
|
@ -24,7 +24,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = mkPerSystemOption ({ config, ... }: {
|
perSystem = mkPerSystemOption {
|
||||||
_file = ./formatter.nix;
|
_file = ./formatter.nix;
|
||||||
options = {
|
options = {
|
||||||
formatter = mkOption {
|
formatter = mkOption {
|
||||||
|
@ -35,7 +35,7 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
flake.formatter =
|
flake.formatter =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, withSystem, ... }:
|
{ withSystem, ... }:
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
_module.args = {
|
_module.args = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
{ config, self, lib, flake-parts-lib, ... }:
|
{ self, lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
filterAttrs
|
|
||||||
mapAttrs
|
mapAttrs
|
||||||
mkOption
|
mkOption
|
||||||
optionalAttrs
|
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
inherit (flake-parts-lib)
|
inherit (flake-parts-lib)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
@ -16,7 +16,7 @@ in
|
||||||
# also update description when done
|
# also update description when done
|
||||||
type = types.lazyAttrsOf (types.uniq (types.functionTo (types.functionTo (types.lazyAttrsOf types.unspecified))));
|
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.
|
# 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 = { };
|
default = { };
|
||||||
example = lib.literalExpression or lib.literalExample ''
|
example = lib.literalExpression or lib.literalExample ''
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, flake-parts-lib, ... }:
|
{ lib, flake-parts-lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
|
|
@ -7,10 +7,6 @@ let
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
inherit (flake-parts-lib)
|
|
||||||
mkSubmoduleOptions
|
|
||||||
mkPerSystemOption
|
|
||||||
;
|
|
||||||
|
|
||||||
transpositionModule = {
|
transpositionModule = {
|
||||||
options = {
|
options = {
|
||||||
|
@ -70,7 +66,7 @@ in
|
||||||
config.transposition
|
config.transposition
|
||||||
);
|
);
|
||||||
|
|
||||||
perSystem = { ... }: {
|
perSystem = {
|
||||||
options =
|
options =
|
||||||
mapAttrs
|
mapAttrs
|
||||||
(k: v: lib.mkOption { })
|
(k: v: lib.mkOption { })
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{ config, lib, flake-parts-lib, self, getSystem, ... }:
|
{ lib, flake-parts-lib, getSystem, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
genAttrs
|
|
||||||
mapAttrs
|
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
@ -12,7 +10,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
perSystem = mkPerSystemOption ({ config, options, system, specialArgs, ... }: {
|
perSystem = mkPerSystemOption ({ config, options, specialArgs, ... }: {
|
||||||
_file = ./perSystem.nix;
|
_file = ./perSystem.nix;
|
||||||
options = {
|
options = {
|
||||||
allModuleArgs = mkOption {
|
allModuleArgs = mkOption {
|
||||||
|
|
Loading…
Reference in a new issue