-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
69 lines (62 loc) · 1.93 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
{
description = "NixOS on Lima Module";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ {
self,
nixpkgs,
...
}: let
guestSystem = "aarch64-linux";
hostSystem = "aarch64-darwin";
pkgs = nixpkgs.legacyPackages."${hostSystem}";
packages = pkgs.callPackages ./nixos-lima.nix {};
in {
packages.aarch64-darwin = packages;
nixosModules = {
# the lima configuration module
lima = import ./modules/lima.nix;
# additional convenience modules
disk-default = {
imports = [inputs.disko.nixosModules.disko ./modules/disk-config.nix];
disko.devices.disk.disk1.device = "/dev/vda";
};
lima-container = import ./modules/lima_container.nix;
impure-config = import ./modules/impure-config.nix;
};
templates.default = {
path = ./example;
description = "NixOS on MacOS via Lima-vm";
};
# an example for testing purposes (use template instead)
nixosConfigurations.mynixos = nixpkgs.lib.nixosSystem {
system = guestSystem;
specialArgs = {inherit inputs;};
modules = [
self.nixosModules.lima
self.nixosModules.disk-default
self.nixosModules.impure-config
self.nixosModules.lima-container
./example/lima-settings.nix
./example/configuration.nix
];
};
# application for uninstalled execution of mynixos
apps.${hostSystem}.default = {
type = "app";
program = let
app = pkgs.writeShellApplication {
name = "mynixos";
runtimeInputs = [self.packages.${hostSystem}.nixos-lima];
text = ''nixos-lima ${self}#mynixos "''${@}"'';
};
in "${app}/bin/mynixos";
};
devShells.${hostSystem}.default = pkgs.mkShellNoCC {
buildInputs = builtins.attrValues packages;
};
};
}