-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
89 lines (84 loc) · 2.89 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
{
description = "Setup entire environment.";
inputs = {
# NixOS
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
# Nix darwin
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-darwin";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
};
outputs = { self, flake-parts, nixpkgs, nixpkgs-unstable, nix-darwin, home-manager, ... }@inputs:
let
perSystemConfig = flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, lib, ... }@args:
{
_module.args.pkgs = import nixpkgs-unstable {
inherit system;
config = { allowUnfree = true; };
};
devShells = import ./nix/dev-shells args;
formatter = pkgs.nixpkgs-fmt;
};
};
overlays = [ ];
opts = {
inherit nixpkgs overlays inputs;
};
in
{
nixosConfigurations = {
# sudo nixos-rebuild switch --flake ".#home"
home = (import ./nix/hosts/home opts);
usbdrive = (import ./nix/hosts/usbdrive opts);
# Build installer ISO
# nix build .#nixosConfigurations.iso-installer.config.system.build.isoImage
iso-installer = (import ./nix/hosts/iso.nix opts);
# Build vm
# nix build .#nixosConfigurations.dev-vm.config.system.build.vm
# Run vm
# ./result/bin/run-dev-vm
dev-vm = (import ./nix/hosts/nixos-vm opts);
};
darwinConfigurations = {
# First install:
# nix run nix-darwin -- switch --flake ".#work-mac"
# Rebuild:
# darwin-rebuild switch --flake ".#work-mac"
work-mac = (import ./nix/hosts/work-darwin {
inherit nix-darwin overlays inputs;
});
};
homeConfigurations = {
# Work desktop config
# First install:
# nix run home-manager/release-23.11 -- switch --flake ".#work"
# Rebuild:
# home-manger switch --flake ".#work"
work = (import ./nix/hosts/work-arch opts);
# Config for VM for development non-nixos
dev-vm = (import ./nix/hosts/dev-vm opts);
};
devShells = perSystemConfig.devShells;
packages = perSystemConfig.packages;
formatter = perSystemConfig.formatter;
templates = {
rust = {
path = ./nix/templates/rust;
description = "Basic setup for Rust setup";
};
};
};
}