refactor: remove unused library functions, start removing with lib

This commit is contained in:
Kat Inskip 2022-07-10 15:18:00 -07:00
parent abbb3f8899
commit 600d890b7f
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
23 changed files with 91 additions and 248 deletions

View file

@ -4,6 +4,8 @@ let
config = meta; config = meta;
inherit (meta) pkgs; inherit (meta) pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (lib.options) optional;
inherit (lib.attrsets) attrValues;
nf-actions = pkgs.writeShellScriptBin "nf-actions" '' nf-actions = pkgs.writeShellScriptBin "nf-actions" ''
export START_DIR="$PWD" export START_DIR="$PWD"
cd "${toString ./.}" cd "${toString ./.}"
@ -37,7 +39,7 @@ let
darwin-rebuild switch --flake ${toString ./.}#sumireko darwin-rebuild switch --flake ${toString ./.}#sumireko
''; '';
in in
with lib; pkgs.mkShell { pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
inetutils inetutils
nf-actions nf-actions
@ -45,17 +47,17 @@ with lib; pkgs.mkShell {
nf-update nf-update
sumireko-apply sumireko-apply
] ++ config.runners.lazy.nativeBuildInputs ] ++ 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 ++ (map
(node: writeShellScriptBin "${node.networking.hostName}-sd-img" '' (node: writeShellScriptBin "${node.networking.hostName}-sd-img" ''
nix build -f . network.nodes.${node.networking.hostName}.system.build.sdImage --show-trace 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 ++ (map
(node: writeShellScriptBin "${node.networking.hostName}-iso-img" '' (node: writeShellScriptBin "${node.networking.hostName}-iso-img" ''
nix build -f . network.nodes.${node.networking.hostName}.system.build.isoImage --show-trace 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 = '' shellHook = ''
export HOME_HOSTNAME=$(hostname -s) export HOME_HOSTNAME=$(hostname -s)
export NIX_BIN_DIR=${pkgs.nix}/bin export NIX_BIN_DIR=${pkgs.nix}/bin

View file

@ -1,4 +1,4 @@
{ lib, tree, ... }: with lib; let { lib, tree, ... }: let
profiles = tree.prev; profiles = tree.prev;
appendedProfiles = with profiles; { appendedProfiles = with profiles; {
ms-7b86 = { ms-7b86 = {

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: with lib; { { config, lib, pkgs, ... }: {
options = { options = {
home-manager.users = let home-manager.users = let
applets = { config, nixos, ... }: { applets = { config, nixos, ... }: {
@ -8,9 +8,9 @@
blueman-applet.enable = true; blueman-applet.enable = true;
}; };
}; };
in mkOption { in lib.mkOption {
type = types.attrsOf (types.submoduleWith { type = lib.types.attrsOf (lib.types.submoduleWith {
modules = singleton applets; modules = lib.singleton applets;
}); });
}; };
}; };
@ -51,7 +51,7 @@
networkmanager = { networkmanager = {
enable = true; enable = true;
connectionConfig = { connectionConfig = {
"ipv6.ip6-privacy" = mkForce 0; "ipv6.ip6-privacy" = lib.mkForce 0;
}; };
}; };
}; };

View file

@ -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; oci-root = meta.deploy.targets.oci-root.tf;
cfg = config.kw.oci; cfg = config.kw.oci;
in in
{ {
options.kw.oci = { options.kw.oci = {
base = mkOption { base = lib.mkOption {
description = '' description = ''
Canonical Ubuntu provides an EXT4 root filesystem. Canonical Ubuntu provides an EXT4 root filesystem.
Oracle Linux provides an XFS root filesystem. Oracle Linux provides an XFS root filesystem.
''; '';
type = with types; enum [ type = lib.enum [
"Canonical Ubuntu" "Canonical Ubuntu"
"Oracle Linux" "Oracle Linux"
]; ];
default = "Canonical Ubuntu"; default = "Canonical Ubuntu";
}; };
specs = { specs = {
shape = mkOption { shape = lib.mkOption {
type = with types; nullOr str; type = lib.types.nullOr lib.types.str;
default = null; default = null;
}; };
cores = mkOption { cores = lib.mkOption {
type = with types; nullOr int; type = lib.types.nullOr lib.types.int;
default = null; default = null;
}; };
ram = mkOption { ram = lib.mkOption {
type = with types; nullOr int; type = lib.types.nullOr lib.types.int;
default = null; default = null;
}; };
space = mkOption { space = lib.mkOption {
type = with types; nullOr int; type = lib.types.nullOr lib.types.int;
default = null; default = null;
}; };
}; };
network = { network = {
privateV4 = mkOption { privateV4 = lib.mkOption {
type = with types; nullOr int; type = lib.types.nullOr lib.types.int;
default = null; default = null;
}; };
publicV6 = mkOption { publicV6 = lib.mkOption {
type = with types; nullOr int; type = lib.types.nullOr lib.types.int;
default = null; default = null;
}; };
}; };
ad = mkOption { ad = lib.mkOption {
description = '' description = ''
Availability Domain. Availability Domain.
Important because, for example: EPYC instances can only be provisioned on AD2 in London. 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; default = null;
}; };
}; };
@ -57,7 +57,7 @@ in
]; ];
config = config =
let 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.A1.Flex" = "enp0s3";
"VM.Standard.E2.1.Micro" = "ens3"; "VM.Standard.E2.1.Micro" = "ens3";
}; };
@ -68,7 +68,7 @@ in
${interface} = { ${interface} = {
useDHCP = true; useDHCP = true;
ipv6 = { 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; address = config.network.addresses.public.nixos.ipv6.address;
prefixLength = 64; prefixLength = 64;
}]; }];
@ -86,18 +86,18 @@ in
let let
addr_ipv6_nix = addr_ipv6_nix =
let 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 in
assert hasSuffix "::" prefix; prefix + toString config.kw.oci.network.publicV6; assert lib.hasSuffix "::" prefix; prefix + toString config.kw.oci.network.publicV6;
in in
{ {
enable = true; enable = true;
nixos.ipv6.address = mkIf tf.state.enable addr_ipv6_nix; nixos.ipv6.address = lib.mkIf tf.state.enable addr_ipv6_nix;
nixos.ipv6.selfaddress = 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"; tf.ipv6.address = tf.resources."${config.networking.hostName}_ipv6".refAttr "ip_address";
}; };
}; };
firewall.public.interfaces = singleton interface; firewall.public.interfaces = lib.singleton interface;
tf = { tf = {
enable = true; enable = true;
ipv4_attr = "public_ip"; ipv4_attr = "public_ip";
@ -116,7 +116,7 @@ in
connection = tf.resources."${config.networking.hostName}".connection.set; connection = tf.resources."${config.networking.hostName}".connection.set;
}; };
connection = { connection = {
port = head config.services.openssh.ports; port = lib.head config.services.openssh.ports;
}; };
}; };
providers.oci = { providers.oci = {
@ -128,13 +128,13 @@ in
private_key_path = oci-root.resources.oci_kw_key_file.importAttr "filename"; private_key_path = oci-root.resources.oci_kw_key_file.importAttr "filename";
}; };
}; };
resources = mkMerge [{ resources = lib.mkMerge [{
cloudinit = { cloudinit = {
provider = "cloudinit"; provider = "cloudinit";
type = "config"; type = "config";
dataSource = true; dataSource = true;
inputs = { inputs = {
part = singleton { part = lib.singleton {
content_type = "text/cloud-config"; content_type = "text/cloud-config";
content = "#cloud-config\n" + builtins.toJSON { content = "#cloud-config\n" + builtins.toJSON {
disable_root = false; disable_root = false;
@ -188,7 +188,7 @@ in
inherit compartment_id; inherit compartment_id;
extended_metadata = { }; extended_metadata = { };
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"; user_data = tf.resources.cloudinit.refAttr "rendered";
}; };
shape = cfg.specs.shape; shape = cfg.specs.shape;
@ -254,7 +254,7 @@ in
direction = "INGRESS"; direction = "INGRESS";
${if protocol == protoValues.TCP then "tcp_options" else "udp_options"} = { ${if protocol == protoValues.TCP then "tcp_options" else "udp_options"} = {
destination_port_range = destination_port_range =
if isAttrs port then { if lib.isAttrs port then {
min = port.from; min = port.from;
max = port.to; max = port.to;
} else { } else {
@ -264,7 +264,7 @@ in
}; };
}; };
}; };
sourceProtos = cartesianProductOfSets { sourceProtos = lib.cartesianProductOfSets {
source = [ ipv4 ipv6 ]; source = [ ipv4 ipv6 ];
protocol = [ protoValues.TCP protoValues.UDP ]; protocol = [ protoValues.TCP protoValues.UDP ];
}; };
@ -280,7 +280,7 @@ in
rules = concatMap mapAllForInterface ([ firewall ] ++ map (interface: firewall.interfaces.${interface}) config.network.firewall.public.interfaces);*/ 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? # TODO: use `count` and index into a fancy json or something?
in in
listToAttrs (imap0 (i: rule: nameValuePair "firewall${toString i}" rule) rules) lib.listToAttrs (lib.imap0 (i: rule: lib.nameValuePair "firewall${toString i}" rule) rules)
)]; )];
}; };
}; };

View file

@ -1,4 +1,4 @@
{ lib, inputs, tree, ... }: with lib; let { inputs, tree, ... }: let
profiles = tree.prev; profiles = tree.prev;
appendedProfiles = with profiles; { appendedProfiles = with profiles; {
ubuntu = { config, ... }: { ubuntu = { config, ... }: {

View file

@ -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. This hardware profile corresponds to any machine which has an AMD Ryzen processor.
*/ */
@ -7,7 +7,7 @@
waybarExtend = { config, ... }: { waybarExtend = { config, ... }: {
options = { options = {
programs.waybar.settings = mkOption { programs.waybar.settings = mkOption {
type = with types; listOf (submodule waybarExtend2); type = lib.listOf (lib.submodule waybarExtend2);
}; };
}; };
}; };
@ -28,7 +28,7 @@
}; };
};*/ };*/
in mkOption { in mkOption {
type = types.attrsOf (types.submoduleWith { type = lib.types.attrsOf (lib.types.submoduleWith {
modules = [ waybarExtend polybarExtend ]; modules = [ waybarExtend polybarExtend ];
}); });
}; };

View file

@ -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 kw.secrets.variables = mapListToAttrs
(field: (field:
nameValuePair "wireless-${field}" { nameValuePair "wireless-${field}" {

View file

@ -1,10 +1,12 @@
{ config, lib, ... }: with lib; { config, lib, ... }:
/* /*
This hardware profile corresponds to the Lenovo Thinkpad x270. This hardware profile corresponds to the Lenovo Thinkpad x270.
*/ */
{ let
inherit (lib.options) mkOption;
in {
options.home-manager.users = let options.home-manager.users = let
userTouchpadExtend = { config, nixos, ... }: { userTouchpadExtend = { config, nixos, ... }: {
wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = {
@ -18,7 +20,7 @@
waybarExtend = { config, ... }: { waybarExtend = { config, ... }: {
options = { options = {
programs.waybar.settings = mkOption { 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 { in mkOption {
type = types.attrsOf (types.submoduleWith { type = lib.types.attrsOf (lib.types.submoduleWith {
modules = [ userTouchpadExtend waybarExtend ]; modules = [ userTouchpadExtend waybarExtend ];
}); });
}; };

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, nixos, kw, ... }: with lib; { config, lib, pkgs, nixos, kw, ... }:
let let
commonSettings = { commonSettings = {
@ -127,7 +127,7 @@ in
}; };
extraNativeMessagingHosts = with pkgs; [ extraNativeMessagingHosts = with pkgs; [
tridactyl-native tridactyl-native
] ++ optional config.programs.buku.enable bukubrow; ] ++ lib.optional config.programs.buku.enable bukubrow;
}; };
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ extensions = with pkgs.nur.repos.rycee.firefox-addons; [
sponsorblock sponsorblock

View file

@ -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 = { programs.mpv = {
enable = true; enable = true;
scripts = [ pkgs.mpvScripts.sponsorblock pkgs.mpvScripts.paused ]; scripts = [ pkgs.mpvScripts.sponsorblock pkgs.mpvScripts.paused ];
@ -98,8 +101,8 @@
osd-bar-h = 2.5; # 3.125 default osd-bar-h = 2.5; # 3.125 default
osd-border-size = 2; # font border pixels, default 3 osd-border-size = 2; # font border pixels, default 3
term-osd-bar = true; term-osd-bar = true;
script-opts = lib.concatStringsSep "," script-opts = builtins.concatStringsSep ","
(lib.mapAttrsToList (k: v: "${k}=${toString v}") { (mapAttrsToList (k: v: "${k}=${toString v}") {
ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp"; ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp";
osc-layout = "slimbox"; osc-layout = "slimbox";
osc-vidscale = "no"; osc-vidscale = "no";

View file

@ -36,7 +36,7 @@
"listrowsfirst" "listrowsfirst"
]; in ]; in
'' ''
${if lib.hasSuffix "darwin" pkgs.stdenv.system then '' ${if lib.hasSuffix "linux" pkgs.stdenv.system then ''
eval $(dircolors) eval $(dircolors)
'' else '' '' else ''
''} ''}

View file

@ -1,8 +1,8 @@
{ config, lib, tf, ... }: { config, lib, tf, ... }:
with lib; let
inherit (lib.modules) mkForce;
{ in {
kw.secrets.variables = { kw.secrets.variables = {
syncplay-pass = { syncplay-pass = {
path = "services/media/syncplay"; path = "services/media/syncplay";

View file

@ -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})"
);
}

View file

@ -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

View file

@ -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))

View file

@ -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}))

View file

@ -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

View file

@ -7,17 +7,10 @@
, isOverlayLib ? false , isOverlayLib ? false
}@args: }@args:
let let
colorHelpers = import ./color-helpers.nix { inherit lib; };
lib = before // katlib // self; lib = before // katlib // self;
katlib = with before; with katlib; with self; katlib = with before; with katlib; with self;
{ {
inherit (colorHelpers) hextorgba;
nodeImport = import ./node-import.nix { inherit lib; }; 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 in
katlib katlib

View file

@ -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

View file

@ -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 its 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 ];
};
}

View file

@ -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",

View file

@ -25,11 +25,11 @@ stdenv.mkDerivation rec {
mv * $out mv * $out
''; '';
meta = with lib; { meta = {
description = "A lightweight file manager with full ShareX, Screencloud support and more"; description = "A lightweight file manager with full ShareX, Screencloud support and more";
homepage = "https://xbackbone.app/"; homepage = "https://xbackbone.app/";
license = with licenses; agpl3; license = lib.licenses.agpl3;
maintainers = with maintainers; [ kittywitch ]; maintainers = [ lib.maintainers.kittywitch ];
platforms = with platforms; unix; platforms = lib.platforms.unix;
}; };
} }

View file

@ -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 pureTreeGrab = { base, path }: let
realPath = toString path; realPath = toString path;
dirContents = builtins.readDir path; dirContents = builtins.readDir path;
@ -24,36 +30,36 @@
in contents; in contents;
configTreeStruct = { config, ... }: { configTreeStruct = { config, ... }: {
options.treeConfig = mkOption { options.treeConfig = mkOption {
type = with types; attrsOf (submodule ({ name, options, config, ... }: { type = lib.types.attrsOf (lib.types.submodule ({ name, options, config, ... }: {
options = { options = {
evaluateDefault = mkOption { 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."; description = "Replace the contents of this branch or leaf with those provided by the evaluation of default.nix.";
default = false; default = false;
}; };
aliasDefault = mkOption { aliasDefault = mkOption {
type = types.bool; type = lib.types.bool;
description = "Replace the contents of this branch or leaf with the default.nix."; description = "Replace the contents of this branch or leaf with the default.nix.";
default = false; default = false;
}; };
excludes = mkOption { excludes = mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
description = "Exclude files or folders from the recurser."; description = "Exclude files or folders from the recurser.";
default = []; default = [];
}; };
functor = { functor = {
enable = mkOption { enable = mkOption {
type = types.bool; type = lib.types.bool;
description = "Provide a functor for the path provided"; description = "Provide a functor for the path provided";
default = false; default = false;
}; };
external = mkOption { external = mkOption {
type = types.listOf types.unspecified; type = lib.types.listOf lib.types.unspecified;
description = "Add external imports into the functor."; description = "Add external imports into the functor.";
default = []; default = [];
}; };
excludes = mkOption { excludes = mkOption {
type = types.listOf types.str; type = lib.types.listOf lib.types.str;
description = "Exclude files or folders from the functor."; description = "Exclude files or folders from the functor.";
default = []; default = [];
}; };
@ -80,9 +86,9 @@
else f (path ++ [name]) value; else f (path ++ [name]) value;
in mapAttrs g set; in mapAttrs g set;
in f [] (recurse [] set); in f [] (recurse [] set);
getPathString = path: concatStringsSep "/" path; getPathString = path: builtins.concatStringsSep "/" path;
getConfig = path: default: configTreeModule.${getPathString path} or default; 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 getConfigRecursive = path: let
parentPath = revtail path; parentPath = revtail path;
in getConfig (path ++ singleton "*") (getConfigRecursive parentPath); in getConfig (path ++ singleton "*") (getConfigRecursive parentPath);