Skip to content

Commit f0f1b4c

Browse files
committed
add flake
Signed-off-by: Jess Frazelle <github@jessfraz.com>
1 parent eb2e260 commit f0f1b4c

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

flake.nix

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
description = "Home Manager module for jessfraz's dotfiles";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs";
6+
unstable.url = "nixpkgs/nixos-unstable";
7+
8+
home-manager = {
9+
url = "github:nix-community/home-manager";
10+
inputs.nixpkgs.follows = "unstable";
11+
};
12+
};
13+
14+
outputs = {
15+
self,
16+
nixpkgs,
17+
unstable,
18+
home-manager,
19+
...
20+
}: let
21+
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
22+
23+
forAllSystems = f:
24+
builtins.listToAttrs (map (system: {
25+
name = system;
26+
value = f system;
27+
})
28+
supportedSystems);
29+
in {
30+
homeManagerModules.default = {pkgs, ...}: let
31+
mkIfExists = path:
32+
if builtins.pathExists path
33+
then path
34+
else pkgs.emptyFile;
35+
in {
36+
home.packages = with pkgs; [
37+
];
38+
39+
home.file = {
40+
".aliases".source = ./.aliases;
41+
".bash_prompt".source = ./.bash_prompt;
42+
".dockerfunc".source = ./.dockerfunc;
43+
".exports".source = ./.exports;
44+
".functions".source = ./.functions;
45+
".inputrc".source = ./.inputrc;
46+
".irssi".source = mkIfExists ./.irssi;
47+
".nixbash".source = ./.nixbash;
48+
".path".source = ./.path;
49+
};
50+
};
51+
52+
# Optional: Provide buildable homeConfigurations for testing
53+
homeConfigurations = forAllSystems (
54+
system:
55+
home-manager.lib.homeManagerConfiguration {
56+
pkgs = import nixpkgs {inherit system;};
57+
modules = [self.homeManagerModules.default];
58+
}
59+
);
60+
};
61+
}

0 commit comments

Comments
 (0)