From 600d890b7fe5627dfec730d7767de62c81b72fec Mon Sep 17 00:00:00 2001 From: kat Date: Sun, 10 Jul 2022 15:18:00 -0700 Subject: [PATCH] refactor: remove unused library functions, start removing with lib --- devShell.nix | 10 +-- hardware/default.nix | 2 +- hardware/networkmanager.nix | 10 +-- hardware/oracle/common.nix | 62 +++++++++--------- hardware/oracle/default.nix | 2 +- hardware/ryzen.nix | 6 +- hardware/wifi.nix | 7 ++- hardware/x270.nix | 10 +-- home/firefox/default.nix | 4 +- home/mpv.nix | 11 ++-- home/shell/zsh.nix | 2 +- home/syncplay.nix | 6 +- overlays/lib/color-helpers.nix | 25 -------- overlays/lib/domain-merge.nix | 13 ---- overlays/lib/folder-list.nix | 7 --- overlays/lib/intersect-merge.nix | 5 -- overlays/lib/module-list.nix | 29 --------- overlays/lib/overlay.nix | 7 --- overlays/lib/virtual-host-gen.nix | 11 ---- overlays/local/exa-noman/default.nix | 63 ------------------- .../local/exa-noman/update-cargo-lock.diff | 13 ---- overlays/local/xbackbone.nix | 8 +-- tree.nix | 26 +++++--- 23 files changed, 91 insertions(+), 248 deletions(-) delete mode 100644 overlays/lib/color-helpers.nix delete mode 100644 overlays/lib/domain-merge.nix delete mode 100644 overlays/lib/folder-list.nix delete mode 100644 overlays/lib/intersect-merge.nix delete mode 100644 overlays/lib/module-list.nix delete mode 100644 overlays/lib/virtual-host-gen.nix delete mode 100644 overlays/local/exa-noman/default.nix delete mode 100644 overlays/local/exa-noman/update-cargo-lock.diff diff --git a/devShell.nix b/devShell.nix index c0086fce..f79583d0 100644 --- a/devShell.nix +++ b/devShell.nix @@ -4,6 +4,8 @@ let config = meta; inherit (meta) pkgs; inherit (pkgs) lib; + inherit (lib.options) optional; + inherit (lib.attrsets) attrValues; nf-actions = pkgs.writeShellScriptBin "nf-actions" '' export START_DIR="$PWD" cd "${toString ./.}" @@ -37,7 +39,7 @@ let darwin-rebuild switch --flake ${toString ./.}#sumireko ''; in -with lib; pkgs.mkShell { +pkgs.mkShell { nativeBuildInputs = with pkgs; [ inetutils nf-actions @@ -45,17 +47,17 @@ with lib; pkgs.mkShell { nf-update sumireko-apply ] ++ config.runners.lazy.nativeBuildInputs - # ++ optional (builtins.getEnv "TRUSTED" != "") (pkgs.writeShellScriptBin "bitw" ''${pkgs.rbw-bitw}/bin/bitw -p gpg://${config.network.nodes.nixos.koishi.kw.secrets.repo.bitw.source} "$@"'') + ++ lib.optional (builtins.getEnv "TRUSTED" != "") (pkgs.writeShellScriptBin "bitw" ''${pkgs.rbw-bitw}/bin/bitw -p gpg://${config.network.nodes.nixos.koishi.kw.secrets.repo.bitw.source} "$@"'') ++ (map (node: writeShellScriptBin "${node.networking.hostName}-sd-img" '' nix build -f . network.nodes.${node.networking.hostName}.system.build.sdImage --show-trace '') - (filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes.nixos))) + (builtins.filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes.nixos))) ++ (map (node: writeShellScriptBin "${node.networking.hostName}-iso-img" '' nix build -f . network.nodes.${node.networking.hostName}.system.build.isoImage --show-trace '') - (filter (node: node.system.build ? isoImage) (attrValues meta.network.nodes.nixos))); + (builtins.filter (node: node.system.build ? isoImage) (attrValues meta.network.nodes.nixos))); shellHook = '' export HOME_HOSTNAME=$(hostname -s) export NIX_BIN_DIR=${pkgs.nix}/bin diff --git a/hardware/default.nix b/hardware/default.nix index 8ac8144f..096aa007 100644 --- a/hardware/default.nix +++ b/hardware/default.nix @@ -1,4 +1,4 @@ -{ lib, tree, ... }: with lib; let +{ lib, tree, ... }: let profiles = tree.prev; appendedProfiles = with profiles; { ms-7b86 = { diff --git a/hardware/networkmanager.nix b/hardware/networkmanager.nix index 3dfd8ce5..4a7c2a5b 100644 --- a/hardware/networkmanager.nix +++ b/hardware/networkmanager.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: with lib; { +{ config, lib, pkgs, ... }: { options = { home-manager.users = let applets = { config, nixos, ... }: { @@ -8,9 +8,9 @@ blueman-applet.enable = true; }; }; - in mkOption { - type = types.attrsOf (types.submoduleWith { - modules = singleton applets; + in lib.mkOption { + type = lib.types.attrsOf (lib.types.submoduleWith { + modules = lib.singleton applets; }); }; }; @@ -51,7 +51,7 @@ networkmanager = { enable = true; connectionConfig = { - "ipv6.ip6-privacy" = mkForce 0; + "ipv6.ip6-privacy" = lib.mkForce 0; }; }; }; diff --git a/hardware/oracle/common.nix b/hardware/oracle/common.nix index 090b3c3b..122c23c2 100644 --- a/hardware/oracle/common.nix +++ b/hardware/oracle/common.nix @@ -1,54 +1,54 @@ -{ config, tf, meta, kw, pkgs, lib, inputs, ... }: with lib; let +{ config, tf, meta, kw, pkgs, lib, inputs, ... }: let oci-root = meta.deploy.targets.oci-root.tf; cfg = config.kw.oci; in { options.kw.oci = { - base = mkOption { + base = lib.mkOption { description = '' Canonical Ubuntu provides an EXT4 root filesystem. Oracle Linux provides an XFS root filesystem. ''; - type = with types; enum [ + type = lib.enum [ "Canonical Ubuntu" "Oracle Linux" ]; default = "Canonical Ubuntu"; }; specs = { - shape = mkOption { - type = with types; nullOr str; + shape = lib.mkOption { + type = lib.types.nullOr lib.types.str; default = null; }; - cores = mkOption { - type = with types; nullOr int; + cores = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; }; - ram = mkOption { - type = with types; nullOr int; + ram = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; }; - space = mkOption { - type = with types; nullOr int; + space = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; }; }; network = { - privateV4 = mkOption { - type = with types; nullOr int; + privateV4 = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; }; - publicV6 = mkOption { - type = with types; nullOr int; + publicV6 = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; }; }; - ad = mkOption { + ad = lib.mkOption { description = '' Availability Domain. Important because, for example: EPYC instances can only be provisioned on AD2 in London. ''; - type = with types; nullOr int; + type = lib.types.nullOr lib.types.int; default = null; }; }; @@ -57,7 +57,7 @@ in ]; config = let - interface = attrByPath [ cfg.specs.shape ] (throw "Unsupported shape") { + interface = lib.attrByPath [ cfg.specs.shape ] (throw "Unsupported shape") { "VM.Standard.A1.Flex" = "enp0s3"; "VM.Standard.E2.1.Micro" = "ens3"; }; @@ -68,7 +68,7 @@ in ${interface} = { useDHCP = true; ipv6 = { - addresses = mkIf (config.network.addresses.public.nixos.ipv6.enable) [{ + addresses = lib.mkIf (config.network.addresses.public.nixos.ipv6.enable) [{ address = config.network.addresses.public.nixos.ipv6.address; prefixLength = 64; }]; @@ -86,18 +86,18 @@ in let addr_ipv6_nix = let - prefix = head (splitString "/" (oci-root.resources.oci_kw_subnet.importAttr "ipv6cidr_block")); + prefix = lib.head (lib.splitString "/" (oci-root.resources.oci_kw_subnet.importAttr "ipv6cidr_block")); in - assert hasSuffix "::" prefix; prefix + toString config.kw.oci.network.publicV6; + assert lib.hasSuffix "::" prefix; prefix + toString config.kw.oci.network.publicV6; in { enable = true; - nixos.ipv6.address = mkIf tf.state.enable addr_ipv6_nix; - nixos.ipv6.selfaddress = mkIf tf.state.enable addr_ipv6_nix; + nixos.ipv6.address = lib.mkIf tf.state.enable addr_ipv6_nix; + nixos.ipv6.selfaddress = lib.mkIf tf.state.enable addr_ipv6_nix; tf.ipv6.address = tf.resources."${config.networking.hostName}_ipv6".refAttr "ip_address"; }; }; - firewall.public.interfaces = singleton interface; + firewall.public.interfaces = lib.singleton interface; tf = { enable = true; ipv4_attr = "public_ip"; @@ -116,7 +116,7 @@ in connection = tf.resources."${config.networking.hostName}".connection.set; }; connection = { - port = head config.services.openssh.ports; + port = lib.head config.services.openssh.ports; }; }; providers.oci = { @@ -128,13 +128,13 @@ in private_key_path = oci-root.resources.oci_kw_key_file.importAttr "filename"; }; }; - resources = mkMerge [{ + resources = lib.mkMerge [{ cloudinit = { provider = "cloudinit"; type = "config"; dataSource = true; inputs = { - part = singleton { + part = lib.singleton { content_type = "text/cloud-config"; content = "#cloud-config\n" + builtins.toJSON { disable_root = false; @@ -188,7 +188,7 @@ in inherit compartment_id; extended_metadata = { }; metadata = { - ssh_authorized_keys = concatStringsSep "\n" config.users.users.root.openssh.authorizedKeys.keys; + ssh_authorized_keys = lib.concatStringsSep "\n" config.users.users.root.openssh.authorizedKeys.keys; user_data = tf.resources.cloudinit.refAttr "rendered"; }; shape = cfg.specs.shape; @@ -254,7 +254,7 @@ in direction = "INGRESS"; ${if protocol == protoValues.TCP then "tcp_options" else "udp_options"} = { destination_port_range = - if isAttrs port then { + if lib.isAttrs port then { min = port.from; max = port.to; } else { @@ -264,7 +264,7 @@ in }; }; }; - sourceProtos = cartesianProductOfSets { + sourceProtos = lib.cartesianProductOfSets { source = [ ipv4 ipv6 ]; protocol = [ protoValues.TCP protoValues.UDP ]; }; @@ -280,7 +280,7 @@ in rules = concatMap mapAllForInterface ([ firewall ] ++ map (interface: firewall.interfaces.${interface}) config.network.firewall.public.interfaces);*/ # TODO: use `count` and index into a fancy json or something? in - listToAttrs (imap0 (i: rule: nameValuePair "firewall${toString i}" rule) rules) + lib.listToAttrs (lib.imap0 (i: rule: lib.nameValuePair "firewall${toString i}" rule) rules) )]; }; }; diff --git a/hardware/oracle/default.nix b/hardware/oracle/default.nix index 515ae0a6..6955f364 100644 --- a/hardware/oracle/default.nix +++ b/hardware/oracle/default.nix @@ -1,4 +1,4 @@ -{ lib, inputs, tree, ... }: with lib; let +{ inputs, tree, ... }: let profiles = tree.prev; appendedProfiles = with profiles; { ubuntu = { config, ... }: { diff --git a/hardware/ryzen.nix b/hardware/ryzen.nix index 2ed11f72..d708da15 100644 --- a/hardware/ryzen.nix +++ b/hardware/ryzen.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: with lib; { +{ config, pkgs, lib, ... }: { /* This hardware profile corresponds to any machine which has an AMD Ryzen processor. */ @@ -7,7 +7,7 @@ waybarExtend = { config, ... }: { options = { programs.waybar.settings = mkOption { - type = with types; listOf (submodule waybarExtend2); + type = lib.listOf (lib.submodule waybarExtend2); }; }; }; @@ -28,7 +28,7 @@ }; };*/ in mkOption { - type = types.attrsOf (types.submoduleWith { + type = lib.types.attrsOf (lib.types.submoduleWith { modules = [ waybarExtend polybarExtend ]; }); }; diff --git a/hardware/wifi.nix b/hardware/wifi.nix index 83ff9b2d..c623c4fa 100644 --- a/hardware/wifi.nix +++ b/hardware/wifi.nix @@ -1,6 +1,9 @@ -{ config, tf, lib, ... }: with lib; +{ config, tf, lib, ... }: -{ +let + inherit (lib.attrsets) mapListToAttrs nameValuePair; + inherit (lib.modules) mkIf; +in { kw.secrets.variables = mapListToAttrs (field: nameValuePair "wireless-${field}" { diff --git a/hardware/x270.nix b/hardware/x270.nix index 4cad46c8..2916804a 100644 --- a/hardware/x270.nix +++ b/hardware/x270.nix @@ -1,10 +1,12 @@ -{ config, lib, ... }: with lib; +{ config, lib, ... }: /* This hardware profile corresponds to the Lenovo Thinkpad x270. */ -{ +let + inherit (lib.options) mkOption; +in { options.home-manager.users = let userTouchpadExtend = { config, nixos, ... }: { wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { @@ -18,7 +20,7 @@ waybarExtend = { config, ... }: { options = { programs.waybar.settings = mkOption { - type = with types; either (listOf (submodule waybarExtend2)) (attrsOf (submodule waybarExtend2)); + type = lib.types.either (lib.types.listOf (lib.types.submodule waybarExtend2)) (lib.types.attrsOf (lib.types.submodule waybarExtend2)); }; }; }; @@ -28,7 +30,7 @@ }; }; in mkOption { - type = types.attrsOf (types.submoduleWith { + type = lib.types.attrsOf (lib.types.submoduleWith { modules = [ userTouchpadExtend waybarExtend ]; }); }; diff --git a/home/firefox/default.nix b/home/firefox/default.nix index 0552e70c..f39f16fc 100644 --- a/home/firefox/default.nix +++ b/home/firefox/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, nixos, kw, ... }: with lib; +{ config, lib, pkgs, nixos, kw, ... }: let commonSettings = { @@ -127,7 +127,7 @@ in }; extraNativeMessagingHosts = with pkgs; [ tridactyl-native - ] ++ optional config.programs.buku.enable bukubrow; + ] ++ lib.optional config.programs.buku.enable bukubrow; }; extensions = with pkgs.nur.repos.rycee.firefox-addons; [ sponsorblock diff --git a/home/mpv.nix b/home/mpv.nix index 28133e4c..f4b423c1 100644 --- a/home/mpv.nix +++ b/home/mpv.nix @@ -1,6 +1,9 @@ -{ config, lib, pkgs, ... }: with lib; +{ config, lib, pkgs, ... }: -{ +let + inherit (lib.modules) mkMerge mkIf; + inherit (lib.attrsets) mapAttrsToList; +in { programs.mpv = { enable = true; scripts = [ pkgs.mpvScripts.sponsorblock pkgs.mpvScripts.paused ]; @@ -98,8 +101,8 @@ osd-bar-h = 2.5; # 3.125 default osd-border-size = 2; # font border pixels, default 3 term-osd-bar = true; - script-opts = lib.concatStringsSep "," - (lib.mapAttrsToList (k: v: "${k}=${toString v}") { + script-opts = builtins.concatStringsSep "," + (mapAttrsToList (k: v: "${k}=${toString v}") { ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp"; osc-layout = "slimbox"; osc-vidscale = "no"; diff --git a/home/shell/zsh.nix b/home/shell/zsh.nix index a3a21007..b102cbf3 100644 --- a/home/shell/zsh.nix +++ b/home/shell/zsh.nix @@ -36,7 +36,7 @@ "listrowsfirst" ]; in '' - ${if lib.hasSuffix "darwin" pkgs.stdenv.system then '' + ${if lib.hasSuffix "linux" pkgs.stdenv.system then '' eval $(dircolors) '' else '' ''} diff --git a/home/syncplay.nix b/home/syncplay.nix index 758d0a3a..203d0c51 100644 --- a/home/syncplay.nix +++ b/home/syncplay.nix @@ -1,8 +1,8 @@ { config, lib, tf, ... }: -with lib; - -{ +let + inherit (lib.modules) mkForce; +in { kw.secrets.variables = { syncplay-pass = { path = "services/media/syncplay"; diff --git a/overlays/lib/color-helpers.nix b/overlays/lib/color-helpers.nix deleted file mode 100644 index 76ee77a7..00000000 --- a/overlays/lib/color-helpers.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ lib }: rec { - hexChars = - [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f" ]; - hexCharToInt = char: - let - pairs = lib.imap0 (lib.flip lib.nameValuePair) hexChars; - idx = builtins.listToAttrs pairs; - in - idx.${lib.toLower char}; - hexToInt = str: - lib.foldl (value: chr: value * 16 + hexCharToInt chr) 0 - (lib.stringToCharacters str); - hextorgba = hex: alpha: - ( - let - r_hex = lib.substring 1 2 hex; - g_hex = lib.substring 3 2 hex; - b_hex = lib.substring 5 2 hex; - r_dec = hexToInt r_hex; - g_dec = hexToInt g_hex; - b_dec = hexToInt b_hex; - in - "rgba(${toString r_dec}, ${toString g_dec}, ${toString b_dec}, ${toString alpha})" - ); -} diff --git a/overlays/lib/domain-merge.nix b/overlays/lib/domain-merge.nix deleted file mode 100644 index 21bb1dfa..00000000 --- a/overlays/lib/domain-merge.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib }: { folder, defaultFile ? "default.nix", folderPaths ? [ ] }: with lib; let - defaultFileFinal = - if (defaultFile == "default.nix" && folder == "hosts") then - "nixos.nix" - else defaultFile; - folderModLists = map - (folderPath: modList { - modulesDir = folderPath; - defaultFile = defaultFileFinal; - }) - (filter builtins.pathExists folderPaths); -in -foldl modListMerge { } folderModLists diff --git a/overlays/lib/folder-list.nix b/overlays/lib/folder-list.nix deleted file mode 100644 index 110ffd52..00000000 --- a/overlays/lib/folder-list.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ lib }: path: excludes: -let - filterAttrNamesToList = filter: set: - lib.foldl' (a: b: a ++ b) [ ] - (map (e: if (filter e set.${e}) then [ e ] else [ ]) (lib.attrNames set)); -in -(filterAttrNamesToList (name: type: ! (builtins.elem name excludes) && type == "directory") (builtins.readDir path)) diff --git a/overlays/lib/intersect-merge.nix b/overlays/lib/intersect-merge.nix deleted file mode 100644 index ed198e08..00000000 --- a/overlays/lib/intersect-merge.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ lib }: pathsA: pathsB: with lib; let - pathIntersection = intersectLists (attrNames pathsA) (attrNames pathsB); - pathMerger = pathA: pathB: { imports = [ pathA pathB ]; }; -in -pathsA // pathsB // genAttrs pathIntersection (key: (pathMerger pathsA.${key} pathsB.${key})) diff --git a/overlays/lib/module-list.nix b/overlays/lib/module-list.nix deleted file mode 100644 index 5bf1d029..00000000 --- a/overlays/lib/module-list.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ lib }: { modulesDir, defaultFile ? "default.nix", importAll ? false }: - -with builtins; - -let - isModule = m: lib.isFunction m && (m.isModule or true); - filterAttrNamesToList = filter: set: - foldl' (a: b: a ++ b) [ ] - (map (e: if (filter e set.${e}) then [ e ] else [ ]) (attrNames set)); - nameValuePair = name: value: { inherit name value; }; - listToAttrs = foldl' (acc: val: acc // { ${val.name} = val.value; }) { }; - directories = - filterAttrNamesToList (_: type: type == "directory") (readDir modulesDir); - files = map (dir: nameValuePair dir (modulesDir + "/${dir}/${defaultFile}")) - (filter (f: builtins.pathExists (modulesDir + "/${f}/${defaultFile}")) directories); - modules = map - ({ name, value }: - # if the file contains a function, assume it to be a module and pass the path - # (for dedup and such). if it contains anything else, pass that. - let m = import value; - in - { - inherit name; - value = if lib.isFunction m && ! isModule m then m { inherit lib; } else if isModule m && !importAll then value else m; - }) - files; - modList = (listToAttrs modules); -in -modList diff --git a/overlays/lib/overlay.nix b/overlays/lib/overlay.nix index 0158ad4d..030b7b7d 100644 --- a/overlays/lib/overlay.nix +++ b/overlays/lib/overlay.nix @@ -7,17 +7,10 @@ , isOverlayLib ? false }@args: let - colorHelpers = import ./color-helpers.nix { inherit lib; }; lib = before // katlib // self; katlib = with before; with katlib; with self; { - inherit (colorHelpers) hextorgba; nodeImport = import ./node-import.nix { inherit lib; }; - virtualHostGen = import ./virtual-host-gen.nix { inherit lib; }; - domainMerge = import ./domain-merge.nix { inherit lib; }; - modListMerge = import ./intersect-merge.nix { inherit lib; }; - modList = import ./module-list.nix { inherit lib; }; - folderList = import ./folder-list.nix { inherit lib; }; }; in katlib diff --git a/overlays/lib/virtual-host-gen.nix b/overlays/lib/virtual-host-gen.nix deleted file mode 100644 index 7ce3e6f1..00000000 --- a/overlays/lib/virtual-host-gen.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib }: { config, networkFilter ? [ ], addresses ? [ ], block }: with lib; - -let - networks = config.network.addresses; - filteredNetworks = filterAttrs (n: v: elem n networkFilter) networks; - networkValues = attrValues filteredNetworks; - addressList' = concatMap (n: n.out.identifierList) networkValues; - addressList = map (n: builtins.unsafeDiscardStringContext n) addressList'; - hostBlocks = map (host: nameValuePair host block) addressList; -in -listToAttrs hostBlocks diff --git a/overlays/local/exa-noman/default.nix b/overlays/local/exa-noman/default.nix deleted file mode 100644 index f1c4fc3e..00000000 --- a/overlays/local/exa-noman/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, rustPlatform -, cmake -, pkg-config -, zlib -, installShellFiles -, Security -, libiconv -}: - -rustPlatform.buildRustPackage rec { - pname = "exa"; - version = "0.10.1"; - - src = fetchFromGitHub { - owner = "ogham"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-vChsy/FrJEzTO5O+XFycPMP3jqOeea/hfsC0jJbqUVI="; - }; - - # Cargo.lock is outdated - cargoPatches = [ ./update-cargo-lock.diff ]; - - cargoSha256 = "sha256-ah8IjShmivS6IWL3ku/4/j+WNr/LdUnh1YJnPdaFdcM="; - - nativeBuildInputs = [ - cmake - pkg-config - installShellFiles - ]; - - buildInputs = [ zlib ] ++ lib.optionals stdenv.isDarwin [ libiconv Security ]; - outputs = [ "out" ]; - - postInstall = '' - installShellCompletion \ - --name exa completions/completions.bash \ - --name exa.fish completions/completions.fish \ - --name _exa completions/completions.zsh - ''; - - # Some tests fail, but Travis ensures a proper build - doCheck = false; - - meta = with lib; { - description = "Replacement for 'ls' written in Rust"; - longDescription = '' - exa is a modern replacement for ls. It uses colours for information by - default, helping you distinguish between many types of files, such as - whether you are the owner, or in the owning group. It also has extra - features not present in the original ls, such as viewing the Git status - for a directory, or recursing into directories with a tree view. exa is - written in Rust, so it’s small, fast, and portable. - ''; - changelog = "https://github.com/ogham/exa/releases/tag/v${version}"; - homepage = "https://the.exa.website"; - license = licenses.mit; - maintainers = with maintainers; [ ehegnes lilyball globin fortuneteller2k ]; - }; -} diff --git a/overlays/local/exa-noman/update-cargo-lock.diff b/overlays/local/exa-noman/update-cargo-lock.diff deleted file mode 100644 index a4c821e4..00000000 --- a/overlays/local/exa-noman/update-cargo-lock.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index df94188..ed3a068 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -57,7 +57,7 @@ dependencies = [ - - [[package]] - name = "exa" --version = "0.11.0-pre" -+version = "0.10.1" - dependencies = [ - "ansi_term", - "datetime", diff --git a/overlays/local/xbackbone.nix b/overlays/local/xbackbone.nix index 115c5e2d..6f3f69dc 100644 --- a/overlays/local/xbackbone.nix +++ b/overlays/local/xbackbone.nix @@ -25,11 +25,11 @@ stdenv.mkDerivation rec { mv * $out ''; - meta = with lib; { + meta = { description = "A lightweight file manager with full ShareX, Screencloud support and more"; homepage = "https://xbackbone.app/"; - license = with licenses; agpl3; - maintainers = with maintainers; [ kittywitch ]; - platforms = with platforms; unix; + license = lib.licenses.agpl3; + maintainers = [ lib.maintainers.kittywitch ]; + platforms = lib.platforms.unix; }; } diff --git a/tree.nix b/tree.nix index 80725ef3..027fc138 100644 --- a/tree.nix +++ b/tree.nix @@ -1,4 +1,10 @@ -{ lib }: { config, folder, inputs, ... }@args: with lib; let +{ lib }: { config, folder, inputs, ... }@args: let + inherit (lib.attrsets) filterAttrs mapAttrs' mapAttrs isAttrs nameValuePair attrValues; + inherit (lib.strings) hasPrefix removeSuffix; + inherit (lib.lists) imap1 singleton optionals optional sublist; + inherit (lib.trivial) pipe; + inherit (lib.options) mkOption; + inherit (lib.modules) evalModules; pureTreeGrab = { base, path }: let realPath = toString path; dirContents = builtins.readDir path; @@ -24,36 +30,36 @@ in contents; configTreeStruct = { config, ... }: { options.treeConfig = mkOption { - type = with types; attrsOf (submodule ({ name, options, config, ... }: { + type = lib.types.attrsOf (lib.types.submodule ({ name, options, config, ... }: { options = { evaluateDefault = mkOption { - type = types.bool; + type = lib.types.bool; description = "Replace the contents of this branch or leaf with those provided by the evaluation of default.nix."; default = false; }; aliasDefault = mkOption { - type = types.bool; + type = lib.types.bool; description = "Replace the contents of this branch or leaf with the default.nix."; default = false; }; excludes = mkOption { - type = types.listOf types.str; + type = lib.types.listOf lib.types.str; description = "Exclude files or folders from the recurser."; default = []; }; functor = { enable = mkOption { - type = types.bool; + type = lib.types.bool; description = "Provide a functor for the path provided"; default = false; }; external = mkOption { - type = types.listOf types.unspecified; + type = lib.types.listOf lib.types.unspecified; description = "Add external imports into the functor."; default = []; }; excludes = mkOption { - type = types.listOf types.str; + type = lib.types.listOf lib.types.str; description = "Exclude files or folders from the functor."; default = []; }; @@ -80,9 +86,9 @@ else f (path ++ [name]) value; in mapAttrs g set; in f [] (recurse [] set); - getPathString = path: concatStringsSep "/" path; + getPathString = path: builtins.concatStringsSep "/" path; getConfig = path: default: configTreeModule.${getPathString path} or default; - revtail = path: sublist 0 (length path - 1) path; + revtail = path: sublist 0 (builtins.length path - 1) path; getConfigRecursive = path: let parentPath = revtail path; in getConfig (path ++ singleton "*") (getConfigRecursive parentPath);