Skip to content

Commit

Permalink
Merge pull request #150 from roberth/tidy
Browse files Browse the repository at this point in the history
chore: Remove unused bindings
  • Loading branch information
gytis-ivaskevicius authored Jul 30, 2024
2 parents e5f2a9f + ac06c59 commit 6b10f51
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
1 change: 0 additions & 1 deletion devShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ let
devshell = import devshellSrc { inherit system; };

withCategory = category: attrset: attrset // { inherit category; };
util = withCategory "utils";

rootDir = "$PRJ_ROOT";

Expand Down
2 changes: 1 addition & 1 deletion lib/exportPackages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ let
# fold list into one attribute set
exportPackages = foldl' (lhs: rhs: lhs // rhs) { } exportPackagesList;

system = (head (attrValues channels)).system;
inherit ((head (attrValues channels))) system;

in
# flatten nested sets with "/" delimiter then drop disallowed packages
Expand Down
4 changes: 2 additions & 2 deletions lib/internal-functions.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
with builtins;
rec {
filterAttrs = pred: set:
listToAttrs (concatMap (name: let value = set.${name}; in if pred name value then [ ({ inherit name value; }) ] else [ ]) (attrNames set));
listToAttrs (concatMap (name: let value = set.${name}; in if pred name value then [{ inherit name value; }] else [ ]) (attrNames set));

/* Generate an attribute set by mapping a function over a list of
attribute names.
Expand Down Expand Up @@ -40,7 +40,7 @@ rec {
=> [ "nix" "json" "yaml" ]
*/
partitionString = sep: s:
filter (v: isString v) (split "${sep}" s);
filter isString (split "${sep}" s);

# Returns the type of a path: regular (for file), symlink, or directory
pathType = p: getAttr (baseNameOf p) (readDir (dirOf p));
Expand Down
13 changes: 3 additions & 10 deletions lib/mkFlake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,15 @@ let
reverseList
;
inherit (builtins)
pathExists
attrNames
attrValues
concatMap
concatStringsSep
elemAt
filter
foldl'
genList
head
isString
length
listToAttrs
mapAttrs
removeAttrs
split
tail
;

Expand Down Expand Up @@ -103,7 +96,7 @@ let

/* nixos specific arguments */
# Use lib from patched nixpkgs
lib = selectedNixpkgs.lib;
inherit (selectedNixpkgs) lib;
# Use nixos modules from patched nixpkgs
baseModules = import (patchedChannel + "/nixos/modules/module-list.nix");
nixosSpecialArgs =
Expand Down Expand Up @@ -156,7 +149,7 @@ let
import patchedChannel
{
inherit (host) system;
overlays = selectedNixpkgs.overlays;
inherit (selectedNixpkgs) overlays;
config = selectedNixpkgs.config // hostConfig.nixpkgs.config;
} // { inherit (selectedNixpkgs) name input; };
nixpkgs.config = lib.mkForce { };
Expand Down Expand Up @@ -201,7 +194,7 @@ mergeAny otherArguments (
(system:
let
filterAttrs = pred: set:
listToAttrs (concatMap (name: let value = set.${name}; in if pred name value then [ ({ inherit name value; }) ] else [ ]) (attrNames set));
listToAttrs (concatMap (name: let value = set.${name}; in if pred name value then [{ inherit name value; }] else [ ]) (attrNames set));

# Little hack, we make sure that `legacyPackages` contains `nix` to make sure that we are dealing with nixpkgs.
# For some odd reason `devshell` contains `legacyPackages` out put as well
Expand Down
10 changes: 5 additions & 5 deletions lib/options.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, config, inputs, ... }:

let
inherit (lib) mkIf filterAttrs mapAttrsToList mapAttrs' mkOption types;
inherit (lib) mkIf filterAttrs mapAttrs' mkOption types;
mkFalseOption = description: mkOption {
inherit description;
default = false;
Expand All @@ -18,10 +18,10 @@ let
cfg = config.nix;
in
{
options = {
nix.generateNixPathFromInputs = mkFalseOption "Generate NIX_PATH from available inputs.";
nix.generateRegistryFromInputs = mkFalseOption "Generate Nix registry from available inputs.";
nix.linkInputs = mkFalseOption "Symlink inputs to /etc/nix/inputs.";
options.nix = {
generateNixPathFromInputs = mkFalseOption "Generate NIX_PATH from available inputs.";
generateRegistryFromInputs = mkFalseOption "Generate Nix registry from available inputs.";
linkInputs = mkFalseOption "Symlink inputs to /etc/nix/inputs.";
};

config = {
Expand Down

0 comments on commit 6b10f51

Please sign in to comment.