configuration.nix/flake.nix

80 lines
2.9 KiB
Nix
Raw Normal View History

2024-01-14 17:33:16 +01:00
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.9)
{
# A helpful description of your flake
description = "My NixOS configuration";
# Flake inputs
inputs.stylix.url = "https://flakehub.com/f/danth/stylix/0.1.282.tar.gz";
inputs.stylix.inputs.nixpkgs.follows = "nixpkgs";
inputs.stylix.inputs.home-manager.follows = "home-manager";
2024-01-14 17:33:16 +01:00
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
inputs.home-config.url = "github:jalil-salame/home.nix";
inputs.home-config.inputs.stylix.follows = "stylix";
inputs.home-config.inputs.nixpkgs.follows = "nixpkgs";
inputs.home-config.inputs.home-manager.follows = "home-manager";
inputs.home-config.inputs.flake-schemas.follows = "flake-schemas";
2024-01-14 17:33:16 +01:00
inputs.home-manager.url = "https://flakehub.com/f/nix-community/home-manager/0.1.*.tar.gz";
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
2024-01-14 17:33:16 +01:00
inputs.flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
2024-01-15 12:57:59 +01:00
inputs.nixos-hardware.url = "https://flakehub.com/f/NixOS/nixos-hardware/0.1.*.tar.gz";
2024-01-14 17:33:16 +01:00
# Flake outputs that other flakes can use
2024-01-15 12:57:59 +01:00
outputs = { flake-schemas, nixpkgs, stylix, home-manager, home-config, nixos-hardware, ... }:
2024-01-14 17:33:16 +01:00
let
inherit (nixpkgs) lib;
2024-01-14 17:33:16 +01:00
# Helpers for producing system-specific outputs
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
inherit system;
pkgs = import nixpkgs { inherit system; };
});
# Module documentation
doc = forEachSupportedSystem ({ pkgs, system }: import ./docs {
inherit (home-config.packages.${system}) markdown;
inherit pkgs lib;
});
2024-01-14 17:33:16 +01:00
in
{
# Schemas tell Nix about the structure of your flake's outputs
schemas = flake-schemas.schemas;
packages = doc;
2024-01-14 17:33:16 +01:00
# Nix files formatter (run `nix fmt`)
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
2024-01-14 17:33:16 +01:00
nixosModules =
let
nixosModule = {
imports = [
(import ./nixos { inherit stylix; })
home-manager.nixosModules.home-manager
];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [ home-config.nixosModules.nixosModule ];
# Pin nixpkgs
nix.registry.nixpkgs.flake = nixpkgs;
};
2024-01-15 12:57:59 +01:00
machines = [ "capricorn" "gemini" "vm" ];
mkMachine = hostname: {
imports = [ nixosModule (import ./machine + "${hostname}" nixos-hardware) ];
home-manager.sharedModules = [{ jhome.hostName = hostname; }];
};
machineModules = lib.genAttrs machines mkMachine;
in
{
default = nixosModule;
inherit nixosModule;
2024-01-15 12:57:59 +01:00
} // machineModules;
2024-01-14 17:33:16 +01:00
};
}