Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
79 lines (75 loc) · 2.26 KB
/
Copy pathflake.nix
File metadata and controls
79 lines (75 loc) · 2.26 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
description = "Home Manager configuration for each environment";
inputs = {
nixpkgs = {
url = "github:appsforartists/nixpkgs";
};
home-manager = {
url = "github:appsforartists/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
xremap = {
url = "github:xremap/nix-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
# Each device has a ./secrets.nix that contains metadata I don't want to
# share on GitHub. Since I keep all my git repos in ~/Projects, the
# absolute path to that file can be computed and imported as `secrets` when
# `home-manager switch` is run with `--impure` (aliased to `hms` in
# @terminal.nix).
secrets = import ((builtins.getEnv "HOME") + "/Projects/device-config/secrets.nix");
pkgs = nixpkgs.legacyPackages.${builtins.currentSystem};
extendedLib = pkgs.lib.extend (self: super: (import ./lib {
lib = self;
inherit pkgs;
}));
in {
homeConfigurations = {
"steamos" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
lib = extendedLib;
extraSpecialArgs = {inherit inputs secrets;};
modules = [
secrets.userInfo
./environments/steamos.nix
];
};
"corp" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
lib = extendedLib;
extraSpecialArgs = {inherit inputs secrets;};
modules = [
secrets.userInfo
./environments/corp.nix
];
};
};
devShells = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-darwin" "x86_64-darwin"] (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShellNoCC {
packages = [pkgs.alejandra];
shellHook = ''
git_root=$(git rev-parse --show-toplevel)
if [ -d "$git_root/.git/hooks" ]; then
ln -sf "$git_root/hooks/pre-commit" "$git_root/.git/hooks/pre-commit"
fi
'';
};
}
);
};
}