Skip to content

Commit

Permalink
Extend lib to include custom util functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Dal-Pra committed Mar 30, 2024
1 parent 9269bc9 commit f2e4b66
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@
}:
let
inherit (nixpkgs) lib;
myLib = import ./lib/utils.nix { inherit lib; };
overlays = import ./lib/overlays.nix { inherit nixpkgs nixpkgs-unstable nurpkgs; };
system = "x86_64-linux";
revision = nixpkgs.lib.mkIf (self ? rev) self.rev;
mkISO = import ./lib/mk-iso.nix;
mkNixOS = import ./lib/mk-nixos.nix {
inherit lib myLib overlays home-manager agenix disko impermanence system revision;
inherit lib overlays home-manager agenix disko impermanence system revision;
};
mkHM = import ./lib/mk-hm.nix { inherit myLib overlays agenix home-manager system; };
mkHM = import ./lib/mk-hm.nix { inherit overlays agenix home-manager system; };
forAllSystems = flake-utils.lib.eachDefaultSystem
(system:
let
Expand Down
3 changes: 1 addition & 2 deletions home/modules/cli/starship.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ pkgs, lib, myLib, ... }:
{ pkgs, lib, ... }:

with builtins;
with lib;
with myLib;

let
isRust = path: hasSuffix ".rs" path && path != "mod.rs";
Expand Down
3 changes: 1 addition & 2 deletions home/modules/wm/xmonad.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ pkgs, config, lib, myLib, ... }:
{ pkgs, config, lib, ... }:

with lib;
with myLib;

let
libPath = ./xmonad-config/lib;
Expand Down
12 changes: 5 additions & 7 deletions lib/mk-hm.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ myLib
, overlays
{ overlays
, home-manager
, agenix
, system
Expand All @@ -8,13 +7,12 @@
let
pkgs = overlays system;
isDarwin = pkgs.lib.strings.hasSuffix system "-darwin";
specialArgs = { inherit isDarwin myLib; };
homeDirectory = if isDarwin then "/Users/${username}" else "/home/${username}";
extraSpecialArgs = { inherit isDarwin; };
homeDirectory =
if isDarwin then "/Users/${username}" else "/home/${username}";
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;

extraSpecialArgs = specialArgs;
inherit pkgs extraSpecialArgs;

modules = [
{ home = { inherit username homeDirectory; }; }
Expand Down
6 changes: 2 additions & 4 deletions lib/mk-nixos.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ lib
, myLib
, overlays
, home-manager
, agenix
Expand All @@ -11,9 +10,7 @@

let
pkgs = overlays system;
specialArgs = {
inherit myLib agenix impermanence;
};
specialArgs = { inherit agenix impermanence; };
baseConfig = _: {
# FIXME : agenix/impermanence mixup
age.identityPaths = [ "/persistent-system/key" ];
Expand All @@ -25,6 +22,7 @@ let
diskoConfig = machineRoot + /disks.nix;
in
lib.nixosSystem {

inherit system specialArgs pkgs;

modules = [
Expand Down
4 changes: 4 additions & 0 deletions lib/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ let
unstableOverlay = _: _: {
unstable = import nixpkgs-unstable { inherit config system; };
};
customLib = _: prev: {
lib = prev.lib // import ./utils.nix { inherit (prev) lib; };
};
in
import nixpkgs {
inherit config system;

overlays = [
nurOverlay
unstableOverlay
customLib
];
}

0 comments on commit f2e4b66

Please sign in to comment.