This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
66 lines (58 loc) · 2.26 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
{
description = "Configuration for my NixOS systems";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux"; # {aarch64,x86_64}-linux
nix-rpi5.url = "gitlab:vriska/nix-rpi5";
nix-rpi5.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, systems, nixpkgs, unstable, ... } @ inputs:
let
mapSystems = f: builtins.mapAttrs (system: _: f system) (nixpkgs.lib.genAttrs (import systems) (_: null));
pkgs = mapSystems (system:
let
unstablePkgs = import unstable { inherit system; config.allowUnfree = true; };
in
import nixpkgs {
inherit system;
config.allowUnfree = true;
# config.permittedInsecurePackages = [ "electron-25.9.0" ]; # for obsidian
overlays = [
(final: prev: {
inherit (unstablePkgs) zig;
binary-ninja = prev.callPackage ./packages/binary-ninja { };
} // (if system == "aarch64-linux" then {
makeModulesClosure = x: prev.makeModulesClosure (x // { allowMissing = true; });
inherit (inputs.nix-rpi5.legacyPackages.aarch64-linux) linuxPackages_rpi5;
} else { }))
];
}
);
lib = import ./lib.nix { inherit (nixpkgs) lib; };
in
{
nixosConfigurations = builtins.mapAttrs
(name: _:
let
config = import (./hosts + "/${name}/configuration.nix");
system = (config (builtins.functionArgs config)).nixpkgs.hostPlatform;
in
nixpkgs.lib.nixosSystem
{
inherit system;
pkgs = pkgs.${system};
specialArgs = {
inherit inputs;
profiles = lib.rakeLeaves ./profiles;
};
modules = [
(./hosts + "/${name}/configuration.nix")
(./hosts + "/${name}/hardware-configuration.nix")
({ ... }: { networking.hostName = name; })
] ++ (nixpkgs.lib.collect builtins.isPath (lib.rakeLeaves ./modules));
})
(builtins.readDir ./hosts);
formatter = mapSystems (system: pkgs.${system}.nixpkgs-fmt);
};
}