Skip to content

dirty conversion to a flake #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions flake.lock

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

23 changes: 23 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
description = "Krops: Lightweight NixOS deployment toolkit";

inputs.flake-utils.url = "github:numtide/flake-utils";

outputs = { self, nixpkgs, flake-utils }: {
lib = import ./lib {
nixpkgsLib = nixpkgs.lib;
};
} // (flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
populate = pkgs.callPackage ./pkgs/populate {
inherit (self) lib;
};
in {
packages = (pkgs.callPackage ./pkgs/krops {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inherit (self) lib;
inherit populate;
});
}
));
}
3 changes: 2 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ nixpkgsLib }:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks existing usage in the overlay.
If you have better suggestion on how to solve this let me know.
I actually I would just get rid of the overlay because it is over-engineering and
makes direct import harder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overlay doesn't really use lib, so this addition should not matter too much. Could we have nixpkgsLib ? import <nixpkgs/lib> for non-flakes users?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just get rid of the overlay because it is over-engineering

We can probably get rid of it. I did a quick search and couldn't find any place where it gets used as overlay anyway.

let {

body = lib;
Expand Down Expand Up @@ -79,6 +80,6 @@ let {
types = nixpkgs.lib.types // import ./types { lib = body; };
};

nixpkgs.lib = import <nixpkgs/lib>;
nixpkgs.lib = nixpkgsLib;

}
6 changes: 1 addition & 5 deletions pkgs/krops/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
let
lib = import ../../lib;
in

{ nix, openssh, populate, writers }: rec {
{ nix, openssh, populate, writers, lib }: rec {

build = target:
runShell target (lib.concatStringsSep " " [
Expand Down
4 changes: 0 additions & 4 deletions pkgs/overlay.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
let
lib = import ../lib;
in

self: super: {
krops = self.callPackage ./krops {};
populate = self.callPackage ./populate {};
Expand Down
6 changes: 3 additions & 3 deletions pkgs/populate/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
with import ../../lib;
with shell;
{ coreutils, dash, findutils, git, jq, openssh, pass, rsync, writers, lib }:

{ coreutils, dash, findutils, git, jq, openssh, pass, rsync, writers }:
with lib;
with shell;

let
check = { force, target }: let
Expand Down