Skip to content

Commit

Permalink
Packaged 'bd' shell utility.
Browse files Browse the repository at this point in the history
  • Loading branch information
iivvaannxx committed Sep 12, 2023
1 parent 29e69b1 commit 41b5289
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
description = "My personal NixOS system configuration.";
outputs = { flake-parts, nixpkgs, unstablepkgs, home-manager, ... } @ inputs: let
outputs = { self, flake-parts, nixpkgs, unstablepkgs, home-manager, ... } @ inputs: let

# Extend the default library with our own set of functions.
lib = (inputs.nixpkgs.lib.extend (import ./overlays/lib.nix));
Expand All @@ -9,7 +9,7 @@
createHost = system: hostPath: users: (lib.custom.mkHost {

inherit hostPath system users inputs lib
nixpkgs unstablepkgs home-manager;
nixpkgs unstablepkgs home-manager self;

# Add here the modules received in the flake inputs (except HM, which is handled automatically).
extraNixosModules = [
Expand All @@ -31,7 +31,7 @@
_module.args.upkgs = lib.custom.mkUnfreePkgs unstablepkgs { inherit system; };

# Import all the custom packages.
# packages = import ./packages args;
packages = import ./packages (args // { inherit lib; });
};

flake = {
Expand Down
6 changes: 5 additions & 1 deletion lib/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
in {

# Creates a host from the given arguments.
mkHost = { hostPath, system, users, inputs, lib, nixpkgs, unstablepkgs, home-manager, extraNixosModules ? [ ] }: let
mkHost = { hostPath, system, self, users, inputs, lib, nixpkgs, unstablepkgs, home-manager, extraNixosModules ? [ ] }: let

inherit (lib) nixosSystem;
inherit (lib.custom) fromJSON';
Expand All @@ -80,6 +80,8 @@ in {
nixosSpecialArgs = {

inherit inputs configsPath pkgs upkgs;

customPkgs = self.packages.${system};
presetsPath = "${rootPath}/presets/nixos";
};

Expand All @@ -89,6 +91,8 @@ in {
homeManagerSpecialArgs = {

inherit inputs configsPath pkgs upkgs;

customPkgs = self.packages.${system};
presetsPath = "${rootPath}/presets/home-manager";
};

Expand Down
12 changes: 7 additions & 5 deletions packages/default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{ lib, pkgs, ... } @ args: let

inherit (builtins) baseNameOf;
inherit (builtins) baseNameOf listToAttrs;

inherit (lib) removeSuffix;
inherit (lib.custom) mapModulesRecursive;

# Contains all the paths to each package.
currentPath = ./.;
importPackage = path: let

packageName = baseNameOf path;
package = pkgs.callPackage "${currentPath}/${path}" { };
packageName = removeSuffix ".nix" (baseNameOf path);
package = import "${currentPath}/${path}" args;

in { "${packageName}" = package; };
in { name = packageName; value = package; };

# All the custom defined packages.
allPackages = mapModulesRecursive currentPath importPackage;

in allPackages
in listToAttrs allPackages
13 changes: 13 additions & 0 deletions packages/scripts/bd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ lib, pkgs, ... }: let

# See: https://github.com/vigneshwaranr/bd
source = pkgs.fetchFromGitHub {

owner = "vigneshwaranr";
repo = "bd";

rev = "4277ad8483357ccfa95264f4084fff9cf7887097";
sha256 = "Trdp9z4eDVK4ZiB3iRgXNj2csaJgMmyOndZGsvsMDXQ=";
};

in pkgs.writeShellScriptBin "bd" (builtins.readFile "${source}/bd")

0 comments on commit 41b5289

Please sign in to comment.