-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
135 lines (131 loc) · 4.23 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
description = "Axel's Home Manager/NixOS Configurations";
inputs = {
nixpkgs.url = "github:NixOS/Nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils = {
url = "github:numtide/flake-utils";
};
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{
self,
nixpkgs,
home-manager,
flake-utils,
nixos-hardware,
nix-darwin,
}:
# home-manager and nixOS configuration
{
darwinConfigurations = {
"axel-mbp14" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit inputs;
};
modules = [
./darwin/configuration.nix
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.axel = import ./darwin/axel_mbp14.nix;
}
];
};
"axel-mbp14-ja" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit inputs;
};
modules = [
./darwin/configuration.nix
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.axel = import ./darwin/axel_mbp14_ja.nix;
}
(
# darwin module for axel_mbp14_ja: extra binary caches
{ pkgs, ... }:
{
nix = {
settings.substituters = [
"https://jojnts.cachix.org"
"https://nixpkgs-python.cachix.org"
"https://leif-gpt.cachix.org"
];
settings.trusted-public-keys = [
"jojnts.cachix.org-1:+HXC6tk/lRE4nMyG3KJ92KfJ0gd/NyoTwAKb1xrzMQw="
"nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU="
"leif-gpt.cachix.org-1:h5qgyt1oEi4szJ3HU2IhIi8Ptfq3YeT6U4Yk97t43Gg="
];
};
}
)
];
};
};
homeConfigurations = {
"andrimner" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ ./andrimner/home.nix ];
};
};
nixosConfigurations = {
nixpi = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./nixpi/configuration.nix
nixos-hardware.nixosModules.raspberry-pi-4
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = false;
home-manager.useUserPackages = true;
home-manager.users.axel = import ./nixpi/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
];
};
};
}
# devShells
// flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
update = pkgs.writeScriptBin "update" "nix flake update --commit-lock-file";
build = pkgs.writeShellApplication {
name = "build";
text = ''
# first run: no current generation exists so use ./result (diff against oneself)
# current=$( (home-manager generations 2> /dev/null || echo result) | head -n 1 | awk '{ print $7 }')
# home-manager build --flake ".#$(hostname -s | awk '{ print tolower($1) }')" && nvd diff "$current" result
darwin-rebuild build --flake .
'';
};
switch = pkgs.writeScriptBin "switch" ''
darwin-rebuild switch --flake .
'';
in
{
devShell = pkgs.mkShell {
buildInputs = [
update
build
switch
];
};
formatter = pkgs.nixfmt-rfc-style;
}
);
}