Skip to content

Commit

Permalink
refactor: use pkgs-by-name-for-flake-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 22, 2024
1 parent 6f8dfb8 commit 9e52c17
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 93 deletions.
12 changes: 2 additions & 10 deletions imports/formatter.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
{ inputs, ... }:
{ ... }:

{
perSystem =
{
config,
self',
inputs',
pkgs,
system,
lib,
...
}:
{ pkgs, ... }:
{
formatter = pkgs.nixfmt-rfc-style;
};
Expand Down
24 changes: 4 additions & 20 deletions templates/client/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,9 @@
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;

imports = [ ./imports/overlay.nix ];

perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
devShells.default = pkgs.mkShellNoCC {
name = "default";
packages = [
pkgs.example1
pkgs.example2
];
};
};
imports = [
./imports/devShells.nix
./imports/overlay.nix
];
};
}
9 changes: 1 addition & 8 deletions templates/client/imports/devShells.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
{

perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{ pkgs, ... }:
{
devShells.default = pkgs.mkShell {
name = "default";
Expand Down
9 changes: 1 addition & 8 deletions templates/client/imports/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

{
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{ system, ... }:
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
Expand Down
3 changes: 2 additions & 1 deletion templates/my-own-nixpkgs/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
pkgs-by-name-for-flake-parts.url = "github:drupol/pkgs-by-name-for-flake-parts";
};

outputs =
Expand All @@ -14,9 +15,9 @@

imports = [
inputs.flake-parts.flakeModules.easyOverlay
inputs.pkgs-by-name-for-flake-parts.flakeModule
./imports/overlay.nix
./imports/formatter.nix
./imports/pkgs-by-name.nix
./imports/pkgs-all.nix
];
};
Expand Down
12 changes: 2 additions & 10 deletions templates/my-own-nixpkgs/imports/formatter.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
{ inputs, ... }:
{ ... }:

{
perSystem =
{
config,
self',
inputs',
pkgs,
system,
lib,
...
}:
{ pkgs, ... }:
{
formatter = pkgs.nixfmt-rfc-style;
};
Expand Down
9 changes: 1 addition & 8 deletions templates/my-own-nixpkgs/imports/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

{
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{ config, system, ... }:
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
Expand Down
11 changes: 2 additions & 9 deletions templates/my-own-nixpkgs/imports/pkgs-all.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
{ inputs, lib, ... }:
{ ... }:
{

perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{ pkgs, ... }:
{
packages = {
example2 = pkgs.callPackage ../pkgs/example2 { };
Expand Down
22 changes: 3 additions & 19 deletions templates/my-own-nixpkgs/imports/pkgs-by-name.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
{ inputs, lib, ... }:
{ ... }:
{

perSystem =
{ ... }:
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
packages =
let
scope = lib.makeScope pkgs.newScope (self: {
inherit inputs;
});
in
lib.filesystem.packagesFromDirectoryRecursive {
inherit (scope) callPackage;
directory = ../pkgs/by-name;
};
pkgsDirectory = ../pkgs/by-name;
};
}

0 comments on commit 9e52c17

Please sign in to comment.