-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
59 lines (55 loc) · 1.73 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
description = "Build clojure projects with nix by creating a lockfile for maven and git dependencies";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }: {
lib = rec {
customLocker =
{ pkgs
, # The directory of this lockfile's project. If specified, a clean
# version of this repository (including uncommitted changes but
# without untracked files) will be available for lockfile generation
src ? null
, # The path to the lockfile, e.g. `"./deps.lock.json"`
lockfile
, # Specify the maven repositories to use, overriding the defaults
mavenRepos ? [
"https://repo1.maven.org/maven2/"
"https://repo.clojars.org/"
]
, # the command to produce the dependencies
command
}:
let locked = ((import ./default.nix { inherit pkgs; }).lockfile { inherit src lockfile mavenRepos; });
in
{
locker = locked.commandLocker command;
homeDirectory = locked.homeDirectory;
shellEnv = locked.shellEnv;
};
};
overlays.default = final: prev: {
standaloneLocker = (import ./default.nix { pkgs = final; }).standaloneLocker;
};
templates.default = {
path = ./example;
description = "A template for using clojure-nix-locker.";
};
}
//
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
packages = rec {
inherit (pkgs) standaloneLocker;
default = standaloneLocker;
};
}
);
}