-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
59 lines (57 loc) · 1.6 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 = "Create workspaces to manage multiple packages with Nix.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-lib.url = "github:NixOS/nixpkgs/nixpkgs-unstable?dir=lib";
systems.url = "github:nix-systems/default";
};
outputs = inputs@{ self, nixpkgs, nixpkgs-lib, systems, ... }:
let
lib = import nixpkgs-lib;
defaultSystems = import systems;
eachSystem = lib.genAttrs defaultSystems;
in {
lib = import ./lib {
inherit self;
inherit lib;
inherit defaultSystems;
revInfo =
if lib?rev
then " (nixpkgs-lib.rev: ${lib.rev})"
else "";
};
templates = let
tmpls = {
basic = {
path = ./templates/basic;
description = "Barebones template with minimal dependencies.";
};
flake-parts = {
path = ./templates/flake-parts;
description = "Template for workspace flakes using flake-parts.";
};
};
in tmpls // { default = tmpls.basic; };
} // {
packages = eachSystem (system: let
pkgs = import nixpkgs { inherit system; };
nixspace = pkgs.callPackage ./. { };
in {
inherit nixspace;
default = nixspace;
});
devShells = eachSystem (system: let
pkgs = import nixpkgs { inherit system; };
in {
default = pkgs.mkShell {
packages = with pkgs; [
cargo
rustc
cargo-watch
cargo-insta
clippy
];
};
});
};
}