-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
155 lines (145 loc) · 5.49 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{
description = "A system configuration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-24.11";
unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
nixos-hardware.url = "github:nixos/nixos-hardware";
flake-parts.url = "github:hercules-ci/flake-parts";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager-unstable.url = "github:nix-community/home-manager";
home-manager-unstable.inputs.nixpkgs.follows = "unstable";
impermanence.url = "github:nix-community/impermanence";
nix-on-droid.url = "github:nix-community/nix-on-droid/release-24.05";
srvos.url = "github:nix-community/srvos";
srvos.inputs.nixpkgs.follows = "nixpkgs";
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
nix-on-droid.inputs.home-manager.follows = "home-manager";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.inputs.home-manager.follows = "home-manager";
niri.url = "github:sodiboo/niri-flake";
niri.inputs.nixpkgs.follows = "unstable";
niri.inputs.nixpkgs-stable.follows = "nixpkgs";
podcasts.url = "github:pvsr/podcasts";
podcasts.inputs.nixpkgs.follows = "nixpkgs";
podcasts.inputs.pre-commit-hooks.follows = "pre-commit-hooks";
weather.url = "github:pvsr/weather";
weather.inputs.nixpkgs.follows = "nixpkgs";
weather.inputs.pre-commit-hooks.follows = "pre-commit-hooks";
qbpm.url = "github:pvsr/qbpm";
qbpm.inputs.nixpkgs.follows = "nixpkgs";
jj.url = "github:martinvonz/jj";
jj.inputs.nixpkgs.follows = "nixpkgs";
helix.url = "github:helix-editor/helix";
# sources
srcery-tmux.url = "github:srcery-colors/srcery-tmux";
srcery-tmux.flake = false;
fish-prompt-pvsr.url = "github:pvsr/fish-prompt-pvsr";
fish-prompt-pvsr.flake = false;
};
outputs =
inputs:
let
overlays = [ (import ./overlay.nix inputs) inputs.niri.overlays.niri ];
specialArgs.inputs = inputs;
specialArgs.appFont = "Fantasque Sans Mono";
extraSpecialArgs = specialArgs;
in
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.pre-commit-hooks.flakeModule ];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
flake.nixosConfigurations = builtins.mapAttrs (
hostName: hostModule:
inputs.nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
hostModule
inputs.home-manager.nixosModules.home-manager
inputs.agenix.nixosModules.age
{
nixpkgs = {
inherit overlays;
hostPlatform = "x86_64-linux";
};
home-manager = {
inherit extraSpecialArgs;
useGlobalPkgs = true;
useUserPackages = true;
users.peter = ./home-manager/${hostName}.nix;
};
}
./modules/nix.nix
./modules/nixos.nix
./users/peter.nix
];
}
) (import ./hosts);
flake.nixOnDroidConfigurations.default = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
inherit extraSpecialArgs;
pkgs = import inputs.nixpkgs {
system = "aarch64-linux";
overlays = [ inputs.nix-on-droid.overlays.default ] ++ overlays;
};
home-manager-path = inputs.home-manager.outPath;
modules = [
./hosts/arseille
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = extraSpecialArgs;
home-manager.config = ./home-manager/arseille.nix;
}
];
};
perSystem =
{
config,
pkgs,
unstablePkgs,
system,
self',
inputs',
...
}:
{
_module.args.pkgs = import inputs.nixpkgs { inherit system overlays; };
_module.args.unstablePkgs = import inputs.unstable { inherit system overlays; };
legacyPackages.homeConfigurations.valleria = inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules = [ ./home-manager/valleria.nix ];
};
legacyPackages.homeConfigurations.jurai = inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules = [ ./home-manager/macbook.nix ];
};
packages.deploy = pkgs.writeScriptBin "deploy" ''
#!${pkgs.fish}/bin/fish
argparse -n deploy -X 1 'c/command=' -- $argv; or return
set command (printf $_flag_command; or printf switch)
set host (printf $argv; or hostname)
nixos-rebuild --fast --flake "/etc/nixos#$host" --target-host $host --use-remote-sudo $command
'';
formatter = pkgs.nixfmt-rfc-style;
pre-commit = {
settings.hooks.nixfmt-rfc-style = {
enable = true;
stages = [ "pre-push" ];
};
};
devShells.default = pkgs.mkShell {
inputsFrom = [ config.pre-commit.devShell ];
buildInputs = [
self'.packages.deploy
inputs'.agenix.packages.agenix
];
};
};
};
}