forked from wimpysworld/nix-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
135 lines (121 loc) · 6.81 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 = "Wimpy's NixOS and Home Manager Configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
# You can access packages and modules from different nixpkgs revs at the same time.
# See 'unstable-packages' overlay in 'overlays/default.nix'.
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack";
nix-formatter-pack.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixos-needtoreboot.url = github:thefossguy/nixos-needsreboot;
nixos-needtoreboot.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
# FlakeHub
antsy-alien-attack-pico.url = "https://flakehub.com/f/wimpysworld/antsy-alien-attack-pico/*.tar.gz";
antsy-alien-attack-pico.inputs.nixpkgs.follows = "nixpkgs";
crafts-flake.url = "https://flakehub.com/f/jnsgruk/crafts-flake/0.6.*.tar.gz";
crafts-flake.inputs.nixpkgs.follows = "nixpkgs";
nix-snapd.url = "https://flakehub.com/f/io12/nix-snapd/0.1.*.tar.gz";
nix-snapd.inputs.nixpkgs.follows = "nixpkgs";
fh.url = "https://flakehub.com/f/DeterminateSystems/fh/*.tar.gz";
fh.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self
, nix-formatter-pack
, nixpkgs
, ...
}@inputs:
let
inherit (self) outputs;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
stateVersion = "23.11";
libx = import ./lib { inherit inputs outputs stateVersion; };
in
{
# home-manager switch -b backup --flake $HOME/Zero/nix-config
# nix run nixpkgs#home-manager -- switch -b backup --flake "${HOME}/Zero/nix-config"
homeConfigurations = {
# .iso images
"nixos@iso-console" = libx.mkHome { hostname = "iso-console"; username = "nixos"; };
"nixos@iso-gnome" = libx.mkHome { hostname = "iso-gnome"; username = "nixos"; desktop = "gnome"; };
"nixos@iso-mate" = libx.mkHome { hostname = "iso-mate"; username = "nixos"; desktop = "mate"; };
"nixos@iso-pantheon" = libx.mkHome { hostname = "iso-pantheon"; username = "nixos"; desktop = "pantheon"; };
# Workstations
"martin@phasma" = libx.mkHome { hostname = "phasma"; username = "martin"; desktop = "pantheon"; };
"martin@vader" = libx.mkHome { hostname = "vader"; username = "martin"; desktop = "pantheon"; };
"martin@tanis" = libx.mkHome { hostname = "tanis"; username = "martin"; desktop = "gnome"; };
# dooku/tyranus are dual boot hosts, macOS and NixOS respectively.
"martin@dooku" = libx.mkHome { hostname = "dooku"; username = "martin"; platform = "aarch64-darwin"; desktop = "aqua";};
"martin@tyranus" = libx.mkHome { hostname = "tyranus"; username = "martin"; platform = "aarch64-linux"; desktop = "gnome"; };
# palpatine/sidious are dual boot hosts, WSL2/Ubuntu and NixOS respectively.
"martin@palpatine" = libx.mkHome { hostname = "palpatine"; username = "martin"; };
"martin@sidious" = libx.mkHome { hostname = "sidious"; username = "martin"; desktop = "gnome"; };
# Servers
"martin@brix" = libx.mkHome { hostname = "brix"; username = "martin"; };
"martin@skull" = libx.mkHome { hostname = "skull"; username = "martin"; };
# Steam Deck
"deck@steamdeck" = libx.mkHome { hostname = "steamdeck"; username = "deck"; };
# VMs
"martin@minimech" = libx.mkHome { hostname = "minimech"; username = "martin"; };
"martin@scrubber" = libx.mkHome { hostname = "scrubber"; username = "martin"; desktop = "pantheon"; };
"martin@lima-builder" = libx.mkHome { hostname = "lima-builder"; username = "martin"; };
"martin@lima-default" = libx.mkHome { hostname = "lima-default"; username = "martin"; };
};
nixosConfigurations = {
# .iso images
# - nix build .#nixosConfigurations.{iso-console|iso-desktop}.config.system.build.isoImage
iso-console = libx.mkHost { hostname = "iso-console"; username = "nixos"; };
iso-gnome = libx.mkHost { hostname = "iso-gnome"; username = "nixos"; desktop = "gnome"; };
iso-mate = libx.mkHost { hostname = "iso-mate"; username = "nixos"; desktop = "mate"; };
iso-pantheon = libx.mkHost { hostname = "iso-pantheon"; username = "nixos"; desktop = "pantheon"; };
# Workstations
# - sudo nixos-rebuild boot --flake $HOME/Zero/nix-config
# - sudo nixos-rebuild switch --flake $HOME/Zero/nix-config
# - nix build .#nixosConfigurations.{hostname}.config.system.build.toplevel
phasma = libx.mkHost { hostname = "phasma"; username = "martin"; desktop = "pantheon"; };
vader = libx.mkHost { hostname = "vader"; username = "martin"; desktop = "pantheon"; };
tanis = libx.mkHost { hostname = "tanis"; username = "martin"; desktop = "gnome"; };
tyranus = libx.mkHost { hostname = "tyranus"; username = "martin"; desktop = "gnome"; platform = "aarch64-linux"; };
sidious = libx.mkHost { hostname = "sidious"; username = "martin"; desktop = "gnome"; };
# Servers
brix = libx.mkHost { hostname = "brix"; username = "martin"; };
skull = libx.mkHost { hostname = "skull"; username = "martin"; };
# VMs
minimech = libx.mkHost { hostname = "minimech"; username = "martin"; };
scrubber = libx.mkHost { hostname = "scrubber"; username = "martin"; desktop = "pantheon"; };
};
# Devshell for bootstrapping; acessible via 'nix develop' or 'nix-shell' (legacy)
devShells = libx.forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./shell.nix { inherit pkgs; }
);
# nix fmt
formatter = libx.forAllSystems (system:
nix-formatter-pack.lib.mkFormatter {
pkgs = nixpkgs.legacyPackages.${system};
config.tools = {
alejandra.enable = false;
deadnix.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
}
);
# Custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; };
# Custom packages; acessible via 'nix build', 'nix shell', etc
packages = libx.forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./pkgs { inherit pkgs; }
);
};
}