new stuff
This commit is contained in:
parent
6014ad7d7a
commit
01c8bfce80
18 changed files with 721 additions and 285 deletions
55
flake.nix
55
flake.nix
|
|
@ -1,48 +1,65 @@
|
|||
{
|
||||
{
|
||||
description = "thegeneralist's config flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nix-darwin = {
|
||||
url = "github:nix-darwin/nix-darwin/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
agenix = {
|
||||
url = "github:ryantm/agenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.home-manager.follows = "home-manager";
|
||||
inputs.darwin.follows = "nix-darwin";
|
||||
};
|
||||
|
||||
ghostty = {
|
||||
url = "github:ghostty-org/ghostty";
|
||||
};
|
||||
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
#nix.url = "github:DeterminateSystems/nix-src";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, nix-darwin, nix, ... }: let
|
||||
inherit (builtins) readDir;
|
||||
inherit (nixpkgs.lib) attrsToList const groupBy listToAttrs mapAttrs;
|
||||
#nix.enable = false;
|
||||
outputs = inputs@{ self, nixpkgs, nix-darwin, ... }:
|
||||
let
|
||||
# Extend nixpkgs lib with darwin and custom functions
|
||||
lib = nixpkgs.lib.extend (
|
||||
_: _: nix-darwin.lib // (import ./lib inputs)
|
||||
);
|
||||
|
||||
lib' = nixpkgs.lib.extend (_: _: nix-darwin.lib);
|
||||
lib = lib'.extend <| import ./lib inputs;
|
||||
|
||||
targetHost = readDir ./hosts
|
||||
|> mapAttrs (name: const <| import ./hosts/${name} lib inputs self)
|
||||
|> attrsToList
|
||||
|> groupBy (host:
|
||||
if host.name == "thegeneralist" || host.name == "thegeneralist-central" then
|
||||
"nixosConfigurations"
|
||||
else
|
||||
"darwinConfigurations")
|
||||
|> mapAttrs (const listToAttrs);
|
||||
in targetHost;
|
||||
# Import host configurations
|
||||
hostConfigs = import ./hosts { inherit lib inputs self; };
|
||||
in
|
||||
{
|
||||
# NixOS configurations for Linux hosts
|
||||
nixosConfigurations = hostConfigs.nixos or {};
|
||||
|
||||
# Darwin configurations for macOS hosts
|
||||
darwinConfigurations = hostConfigs.darwin or {};
|
||||
|
||||
# Development shells
|
||||
devShells = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
nil
|
||||
nixpkgs-fmt
|
||||
inputs.agenix.packages.${system}.default
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue