150 lines
4.9 KiB
Nix
150 lines
4.9 KiB
Nix
# 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";
|
|
|
|
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";
|
|
|
|
inputs.home-manager.url = "https://flakehub.com/f/nix-community/home-manager/0.1.*.tar.gz";
|
|
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
|
|
|
|
inputs.nixos-hardware.url = "https://flakehub.com/f/NixOS/nixos-hardware/0.1.*.tar.gz";
|
|
|
|
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
|
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
# Flake outputs that other flakes can use
|
|
outputs =
|
|
{ self
|
|
, flake-schemas
|
|
, nixpkgs
|
|
, stylix
|
|
, home-manager
|
|
, home-config
|
|
, nixos-hardware
|
|
, pre-commit-hooks
|
|
, ...
|
|
}:
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
# 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;
|
|
});
|
|
in
|
|
{
|
|
# Schemas tell Nix about the structure of your flake's outputs
|
|
inherit (flake-schemas) schemas;
|
|
|
|
checks = forEachSupportedSystem ({ pkgs, system }: {
|
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
src = builtins.path { path = ./.; name = "configuration.nix"; };
|
|
hooks.nixpkgs-fmt.enable = true;
|
|
};
|
|
});
|
|
|
|
packages = doc;
|
|
|
|
# Nix files formatter (run `nix fmt`)
|
|
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
|
|
|
|
inherit (home-config) overlays;
|
|
|
|
# Example vm configuration
|
|
nixosConfigurations.vm =
|
|
let
|
|
system = "x86_64-linux";
|
|
overlays = [
|
|
home-config.overlays.jpassmenu
|
|
home-config.overlays.audiomenu
|
|
home-config.overlays.nixneovim
|
|
home-config.overlays.neovim-nightly
|
|
];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
in
|
|
lib.nixosSystem
|
|
{
|
|
inherit system pkgs;
|
|
modules = [
|
|
self.nixosModules.vm # import vm module
|
|
{
|
|
time.timeZone = "Europe/Berlin";
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
users.users.jdoe.password = "example";
|
|
users.users.jdoe.isNormalUser = true;
|
|
users.users.jdoe.extraGroups = [ "wheel" "video" "networkmanager" ];
|
|
|
|
home-manager.users.jdoe = {
|
|
home.username = "jdoe";
|
|
home.homeDirectory = "/home/jdoe";
|
|
home.stateVersion = "23.11";
|
|
|
|
jhome.enable = true;
|
|
jhome.gui.enable = true;
|
|
jhome.dev.rust.enable = true;
|
|
};
|
|
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
|
|
jconfig.enable = true;
|
|
jconfig.gui.enable = true;
|
|
}
|
|
];
|
|
};
|
|
|
|
|
|
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;
|
|
};
|
|
|
|
machines = [ "capricorn" "gemini" "libra" "vm" ];
|
|
mkMachine = hostname: {
|
|
imports = [
|
|
nixosModule
|
|
(import (./machines + "/${hostname}") { inherit nixos-hardware; })
|
|
];
|
|
home-manager.sharedModules = [{ jhome.hostName = hostname; }];
|
|
};
|
|
machineModules = lib.genAttrs machines mkMachine;
|
|
in
|
|
{
|
|
default = nixosModule;
|
|
inherit nixosModule;
|
|
} // machineModules;
|
|
|
|
devShells = forEachSupportedSystem ({ pkgs, system }: { default = pkgs.mkShell { inherit (self.checks.${system}.pre-commit-check) shellHook; }; });
|
|
};
|
|
}
|