-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
135 lines (109 loc) · 4.28 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
# Inspirations:
# - https://github.com/wimpysworld/nix-config/ for general structure
{
description = "booxter Nix* flake configs";
inputs = rec {
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
# We can control the base package set with this input alias
nixpkgs = nixpkgs-unstable;
# arcanist was removed:
# https://github.com/NixOS/nixpkgs/commit/5ed483f0d79461c2c2d63b46ee62f77a37075bae
nixpkgs-arcanist.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
# https://github.com/NixOS/nixpkgs/pull/252383
nixpkgs-mailsend-go.url = "github:jsoo1/nixpkgs/mailsend-go";
# TODO: post PR to nixpkgs
nixpkgs-cb_thunderlink-native.url = "github:booxter/nixpkgs/cb_thunderlink-native";
nix-darwin.url = "github:LnL7/nix-darwin";
home-manager.url = "github:nix-community/home-manager/master";
nixvim.url = "github:nix-community/nixvim";
nur.url = "github:nix-community/NUR";
flox.url = "github:flox/flox/v1.3.11";
};
outputs = inputs@{ self, ... }:
let
inherit (self) outputs;
stateVersion = "25.05";
helper = import ./lib { inherit inputs outputs stateVersion; };
in
{
# home-manager build --flake . -L
# home-manager switch -b backup --flake .
# nix run nixpkgs#home-manager -- switch -b backup --flake .
homeConfigurations = {
"ihrachys" = helper.mkHome {
hostname = "ihrachys-macpro";
platform = "aarch64-darwin";
};
"ec2-user" = helper.mkHome {
hostname = "ec2";
username = "ec2-user";
platform = "x86_64-linux";
};
};
#nix run nix-darwin -- switch --flake .
#nix build .#darwinConfigurations.{hostname}.config.system.build.toplevel
darwinConfigurations = {
ihrachys-macpro = helper.mkDarwin {
hostname = "ihrachys-macpro";
platform = "aarch64-darwin";
};
};
# Custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; };
# Custom packages; acessible via 'nix build', 'nix shell', etc
packages = helper.forAllSystems (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system});
# Formatter for .nix files, available via 'nix fmt'
formatter = helper.forAllSystems (system: inputs.nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
# TODO: migrate to new scheme
## adopted from https://www.tweag.io/blog/2023-02-09-nixos-vm-on-macos/
#nixosModules.base = { pkgs, ... }: {
# system.stateVersion = "25.05";
# services.getty.autologinUser = "${username}";
# users.mutableUsers = false;
# users.users.${username} = {
# extraGroups = ["wheel"];
# group = "${username}";
# isNormalUser = true;
# openssh.authorizedKeys.keys = [
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA0W1oVd2GMoSwXHVQMb6v4e3rIMVe9/pr/PcsHg+Uz3 ihrachys@ihrachys-macpro"
# ];
# };
# users.groups.${username} = {};
# security.sudo.wheelNeedsPassword = false;
# environment.systemPackages = with pkgs; [
# dig
# ];
# services.openssh.enable = true;
#};
#nixosModules.vm = { ... }: {
# virtualisation.vmVariant.virtualisation = {
# host.pkgs = inputs.nixpkgs.legacyPackages.aarch64-darwin;
# # Make VM output to the terminal instead of a separate window
# graphics = false;
# # qemu.networkingOptions = inputs.nixpkgs.lib.mkForce [
# # "-netdev vmnet-bridged,id=vmnet,ifname=en0"
# # "-device virtio-net-pci,netdev=vmnet"
# # ];
# };
# # a workaround until slirp dns is fixed on macos:
# # https://github.com/utmapp/UTM/issues/2353
# # Note: the same workaround is applied to linux-builder in nixpkgs.
# networking.nameservers = [ "8.8.8.8" ];
#};
#nixosConfigurations = {
# linuxVM = inputs.nixpkgs.lib.nixosSystem rec {
# system = "aarch64-linux";
# pkgs = mkPkgs system;
# specialArgs = {
# inherit username;
# };
# modules = [
# self.nixosModules.base
# self.nixosModules.vm
# ] ++ (globalModulesLinux { inherit system username; });
# };
#};
#packages.aarch64-darwin.linuxVM = self.nixosConfigurations.linuxVM.config.system.build.vm;
};
}