-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib.nix
28 lines (25 loc) · 807 Bytes
/
lib.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
{ pkgs }:
rec {
version = with pkgs; lib.versions.majorMinor lib.version;
# XXX: this must be an impure reference.
# if `pkgs.fetchFromGitHub` was used here, specifying a commit hash would be required.
# this makes it essentially un-testable automatically in a NixOS VM...
home-manager = fetchTarball {
name = "home-manager-${version}";
url = "https://github.com/nix-community/home-manager/tarball/release-${version}";
};
evaluate = configuration:
import "${home-manager}/modules" {
inherit pkgs configuration;
};
environment = configuration:
let
switch = pkgs.writeShellApplication {
name = "switch";
text = "${(evaluate configuration).activationPackage}/activate";
};
in
pkgs.mkShell {
packages = [ switch ];
};
}