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
|
2024-01-19 17:09:01 +01:00
|
|
|
inputs.stylix.url = "github:jalil-salame/stylix/fallback-fonts-v2";
|
2024-01-14 17:33:16 +01:00
|
|
|
inputs.stylix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.stylix.inputs.home-manager.follows = "home-manager";
|
2024-01-15 12:42:01 +01:00
|
|
|
|
2024-02-16 20:10:20 +01:00
|
|
|
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
2024-01-15 12:42:01 +01:00
|
|
|
|
2024-01-21 20:56:00 +01:00
|
|
|
inputs.jpassmenu.url = "github:jalil-salame/jpassmenu";
|
|
|
|
inputs.jpassmenu.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
|
|
|
inputs.audiomenu.url = "github:jalil-salame/audiomenu";
|
|
|
|
inputs.audiomenu.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2024-02-16 20:10:20 +01:00
|
|
|
inputs.nixneovim.url = "github:NixNeovim/NixNeovim";
|
|
|
|
inputs.nixneovim.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nixneovim.inputs.home-manager.follows = "home-manager";
|
2024-01-15 12:57:44 +01:00
|
|
|
|
2024-01-22 10:45:29 +01:00
|
|
|
# WARN: Flakehub is outdated (39 days out of date)
|
|
|
|
# inputs.home-manager.url = "https://flakehub.com/f/nix-community/home-manager/0.1.*.tar.gz";
|
|
|
|
inputs.home-manager.url = "github:nix-community/home-manager";
|
2024-01-14 17:33:16 +01:00
|
|
|
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
2024-01-15 12:42:01 +01:00
|
|
|
|
2024-02-16 20:10:20 +01:00
|
|
|
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware";
|
2024-01-14 17:33:16 +01:00
|
|
|
|
2024-02-16 20:10:20 +01:00
|
|
|
inputs.neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
|
|
|
|
inputs.neovim-nightly.inputs.nixpkgs.follows = "nixpkgs";
|
2024-01-15 12:57:59 +01:00
|
|
|
|
2024-01-15 23:59:15 +01:00
|
|
|
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
|
|
|
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2024-01-14 17:33:16 +01:00
|
|
|
# Flake outputs that other flakes can use
|
2024-01-15 23:59:15 +01:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, nixpkgs
|
|
|
|
, stylix
|
|
|
|
, home-manager
|
|
|
|
, nixos-hardware
|
|
|
|
, pre-commit-hooks
|
2024-01-21 20:56:00 +01:00
|
|
|
, jpassmenu
|
|
|
|
, audiomenu
|
2024-02-16 20:10:20 +01:00
|
|
|
, nixneovim
|
|
|
|
, neovim-nightly
|
2024-01-15 23:59:15 +01:00
|
|
|
}:
|
2024-01-14 17:33:16 +01:00
|
|
|
let
|
2024-01-14 18:58:08 +01:00
|
|
|
inherit (nixpkgs) lib;
|
2024-01-14 17:33:16 +01:00
|
|
|
# Helpers for producing system-specific outputs
|
|
|
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
2024-01-15 14:43:46 +01:00
|
|
|
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
|
|
|
inherit system;
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
});
|
2024-01-14 18:58:08 +01:00
|
|
|
# Module documentation
|
2024-01-21 20:56:00 +01:00
|
|
|
doc = forEachSupportedSystem ({ pkgs, system }: import ./docs { inherit pkgs lib; });
|
2024-01-14 17:33:16 +01:00
|
|
|
in
|
|
|
|
{
|
2024-01-15 23:59:15 +01:00
|
|
|
checks = forEachSupportedSystem ({ pkgs, system }: {
|
|
|
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = builtins.path { path = ./.; name = "configuration.nix"; };
|
2024-02-01 22:02:32 +01:00
|
|
|
hooks.typos.enable = true;
|
2024-01-15 23:59:15 +01:00
|
|
|
hooks.nixpkgs-fmt.enable = true;
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2024-01-14 18:58:08 +01:00
|
|
|
packages = doc;
|
|
|
|
|
2024-01-21 20:56:00 +01:00
|
|
|
# Provide necessary overlays
|
|
|
|
overlays = {
|
2024-02-16 20:10:20 +01:00
|
|
|
nixneovim = nixneovim.overlays.default;
|
|
|
|
neovim-nightly = neovim-nightly.overlays.default;
|
2024-01-21 20:56:00 +01:00
|
|
|
jpassmenu = jpassmenu.overlays.default;
|
|
|
|
audiomenu = audiomenu.overlays.default;
|
|
|
|
};
|
|
|
|
|
2024-01-14 17:33:16 +01:00
|
|
|
# Nix files formatter (run `nix fmt`)
|
2024-01-15 14:43:46 +01:00
|
|
|
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
|
2024-01-17 00:21:52 +01:00
|
|
|
|
2024-01-15 23:26:00 +01:00
|
|
|
# Example vm configuration
|
|
|
|
nixosConfigurations.vm =
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
2024-01-21 20:56:00 +01:00
|
|
|
overlays = builtins.attrValues self.overlays;
|
2024-01-19 19:55:03 +01:00
|
|
|
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
|
|
|
"steam-original"
|
|
|
|
];
|
|
|
|
# config.allowUnfree = true;
|
|
|
|
pkgs = import nixpkgs { inherit system overlays config; };
|
2024-01-15 23:26:00 +01:00
|
|
|
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";
|
|
|
|
|
|
|
|
jhome.enable = true;
|
|
|
|
jhome.gui.enable = true;
|
|
|
|
jhome.dev.rust.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
|
|
|
|
|
|
jconfig.enable = true;
|
|
|
|
jconfig.gui.enable = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-01-15 12:57:44 +01:00
|
|
|
nixosModules =
|
|
|
|
let
|
2024-02-16 20:10:20 +01:00
|
|
|
nvim-config.imports = [
|
|
|
|
nixneovim.nixosModules.homeManager
|
|
|
|
./nvim
|
|
|
|
];
|
2024-01-21 20:56:00 +01:00
|
|
|
overlays = builtins.attrValues self.overlays;
|
|
|
|
homeManagerModuleSandalone = import ./home { inherit overlays nvim-config stylix; };
|
|
|
|
homeManagerModuleNixOS = import ./home { inherit overlays nvim-config; };
|
2024-01-15 12:57:44 +01:00
|
|
|
nixosModule = {
|
|
|
|
imports = [
|
2024-02-18 15:43:37 +01:00
|
|
|
(import ./system { inherit stylix; })
|
2024-01-15 12:57:44 +01:00
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
];
|
|
|
|
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
2024-01-21 20:56:00 +01:00
|
|
|
home-manager.sharedModules = [ homeManagerModuleNixOS ];
|
2024-01-15 12:57:44 +01:00
|
|
|
|
|
|
|
# Pin nixpkgs
|
|
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
|
|
};
|
2024-01-15 12:57:59 +01:00
|
|
|
|
2024-01-16 00:18:35 +01:00
|
|
|
machines = [ "capricorn" "gemini" "libra" "vm" ];
|
2024-01-15 12:57:59 +01:00
|
|
|
mkMachine = hostname: {
|
2024-01-15 23:26:00 +01:00
|
|
|
imports = [
|
|
|
|
nixosModule
|
2024-01-16 23:04:22 +01:00
|
|
|
(import (./machines + "/${hostname}") { inherit nixos-hardware; })
|
2024-01-15 23:26:00 +01:00
|
|
|
];
|
2024-01-15 12:57:59 +01:00
|
|
|
home-manager.sharedModules = [{ jhome.hostName = hostname; }];
|
|
|
|
};
|
|
|
|
machineModules = lib.genAttrs machines mkMachine;
|
2024-01-15 12:57:44 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
default = nixosModule;
|
2024-01-21 20:56:00 +01:00
|
|
|
inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone;
|
2024-01-15 12:57:59 +01:00
|
|
|
} // machineModules;
|
2024-01-15 23:59:15 +01:00
|
|
|
|
2024-02-05 23:30:23 +01:00
|
|
|
devShells = forEachSupportedSystem ({ pkgs, system }: {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
|
|
};
|
|
|
|
});
|
2024-01-14 17:33:16 +01:00
|
|
|
};
|
|
|
|
}
|