2022-12-25 09:55:30 +00:00
|
|
|
{
|
2023-01-15 09:54:40 +00:00
|
|
|
nixConfig = {
|
2023-01-19 15:28:54 +00:00
|
|
|
accept-flake-config = true;
|
|
|
|
experimental-features = "nix-command flakes";
|
|
|
|
# for darwin's browser
|
|
|
|
allowUnsupportedSystem = true;
|
2023-03-23 00:08:04 +00:00
|
|
|
max-jobs = 4;
|
2023-01-15 09:54:40 +00:00
|
|
|
};
|
2022-12-25 09:55:30 +00:00
|
|
|
description = "My personal configuration in Nix (and some native configurations)";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
2023-01-19 15:28:54 +00:00
|
|
|
# continously merged & rebased lightweight .lib. Basically a huge extension to c_.
|
|
|
|
nixlib.url = "github:nix-community/nixpkgs.lib";
|
2022-12-25 09:55:30 +00:00
|
|
|
agenix = {
|
|
|
|
url = "github:ryantm/agenix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
home-manager = {
|
|
|
|
url = "github:nix-community/home-manager";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-01-03 20:10:04 +00:00
|
|
|
nixgl.url = "path:out-of-tree/nixGL";
|
2022-12-25 09:55:30 +00:00
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
|
|
|
flake-compat = {
|
2023-01-14 13:50:50 +00:00
|
|
|
url = "path:out-of-tree/flake-compat";
|
2022-12-25 09:55:30 +00:00
|
|
|
flake = false;
|
|
|
|
};
|
2022-12-30 14:10:55 +00:00
|
|
|
kpcli-py = {
|
|
|
|
url = "github:rebkwok/kpcli";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-01-14 12:42:40 +00:00
|
|
|
neovim-nightly-overlay = {
|
|
|
|
url = "github:nix-community/neovim-nightly-overlay";
|
|
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
|
|
|
|
};
|
|
|
|
nix-index-database = {
|
|
|
|
url = "github:mic92/nix-index-database";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-02-14 17:06:39 +00:00
|
|
|
nickel.url = "github:tweag/nickel";
|
2022-12-25 09:55:30 +00:00
|
|
|
};
|
|
|
|
|
2023-01-12 18:42:20 +00:00
|
|
|
outputs =
|
|
|
|
{ nixpkgs
|
|
|
|
, agenix
|
|
|
|
, home-manager
|
|
|
|
, flake-utils
|
|
|
|
, nixgl
|
|
|
|
, rust-overlay
|
|
|
|
, flake-compat
|
|
|
|
, neovim-nightly-overlay
|
2023-01-14 12:42:40 +00:00
|
|
|
, nix-index-database
|
2023-01-19 15:28:54 +00:00
|
|
|
, nixlib
|
2023-02-14 17:06:39 +00:00
|
|
|
, nickel
|
2023-01-12 18:42:20 +00:00
|
|
|
, ...
|
|
|
|
}@_inputs:
|
2023-01-19 15:28:54 +00:00
|
|
|
let
|
|
|
|
# config_fn:: system -> config
|
|
|
|
# this function should take simple exports of homeConfigurations.${profile},
|
|
|
|
# nixosConfigurations.${profile}, devShells.${profile}, packages.${profile}
|
|
|
|
# and correctly produce
|
2023-02-21 16:40:14 +00:00
|
|
|
supported_systems = flake-utils.lib.defaultSystems;
|
2023-02-22 20:18:44 +00:00
|
|
|
forEachSystem = nixpkgs.lib.genAttrs supported_systems;
|
|
|
|
in
|
2023-01-12 18:42:20 +00:00
|
|
|
let
|
|
|
|
proj_root =
|
|
|
|
let
|
|
|
|
path = builtins.toString ./.;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit path;
|
|
|
|
configs.path = "${path}/native_configs";
|
|
|
|
scripts.path = "${path}/scripts";
|
|
|
|
secrets.path = "${path}/secrets";
|
|
|
|
testdata.path = "${path}/tests";
|
|
|
|
modules.path = "${path}/modules";
|
|
|
|
hosts.path = "${path}/hosts";
|
|
|
|
users.path = "${path}/users";
|
|
|
|
};
|
2023-02-22 20:18:44 +00:00
|
|
|
overlays = forEachSystem (system: import ./overlays.nix (_inputs // { inherit system; }));
|
|
|
|
pkgs = forEachSystem (system: (import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = overlays.${system};
|
2023-01-12 18:42:20 +00:00
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
};
|
2023-02-22 20:18:44 +00:00
|
|
|
}));
|
2023-01-12 18:42:20 +00:00
|
|
|
lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [
|
|
|
|
nixpkgs.lib
|
2023-02-22 20:18:44 +00:00
|
|
|
nixlib.lib
|
2023-01-12 18:42:20 +00:00
|
|
|
]);
|
2023-02-22 20:18:44 +00:00
|
|
|
inputs_w_lib = forEachSystem (
|
|
|
|
system: lib.recursiveUpdate _inputs {
|
|
|
|
inherit system lib;
|
|
|
|
pkgs = pkgs.${system};
|
|
|
|
}
|
|
|
|
);
|
2022-12-25 09:55:30 +00:00
|
|
|
|
2023-01-12 18:42:20 +00:00
|
|
|
modules = (import ./modules inputs_w_lib);
|
|
|
|
hosts = (import ./hosts inputs_w_lib);
|
|
|
|
users = (import ./users inputs_w_lib);
|
2022-12-27 05:58:24 +00:00
|
|
|
|
2023-01-12 18:42:20 +00:00
|
|
|
# {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
|
|
|
# ,pkgs, lib (extended), proj_root}
|
|
|
|
final_inputs = inputs_w_lib;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit (hosts) nixosConfigurations;
|
|
|
|
inherit (users) homeConfigurations;
|
|
|
|
inherit lib proj_root;
|
2023-02-22 20:18:44 +00:00
|
|
|
devShells = forEachSystem (system:
|
|
|
|
{default = (import ./dev-shell.nix final_inputs.${system});}
|
|
|
|
);
|
|
|
|
templates = forEachSystem (system: import ./templates final_inputs.${system});
|
2023-01-12 18:42:20 +00:00
|
|
|
secrets = {
|
|
|
|
pubKeys = {
|
|
|
|
hosts = hosts.pubKeys;
|
|
|
|
users = users.pubKeys;
|
2022-12-27 05:58:24 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-01-12 18:42:20 +00:00
|
|
|
debug = {
|
2023-02-22 20:18:44 +00:00
|
|
|
inherit final_inputs hosts users modules lib inputs_w_lib pkgs nixpkgs nixlib;
|
2023-01-12 17:50:46 +00:00
|
|
|
};
|
2023-02-21 16:40:14 +00:00
|
|
|
# formatter."${system}" = pkgs.nixpkgs-fmt;
|
2023-02-22 20:18:44 +00:00
|
|
|
};
|
2022-12-25 09:55:30 +00:00
|
|
|
}
|