configuration.nix/flake.nix

262 lines
7.1 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
2024-05-10 23:21:26 +02:00
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
unstable.url = "nixpkgs/nixos-unstable";
2024-05-10 23:21:26 +02:00
# Software
jpassmenu = {
url = "github:jalil-salame/jpassmenu";
inputs.nixpkgs.follows = "nixpkgs";
};
audiomenu = {
url = "github:jalil-salame/audiomenu";
inputs.nixpkgs.follows = "nixpkgs";
};
# Lix
lix = {
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
flake = false;
};
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
inputs = {
lix.follows = "lix";
nixpkgs.follows = "nixpkgs";
2024-05-17 18:20:21 +02:00
flake-utils.follows = "flake-utils";
2024-05-10 23:21:26 +02:00
};
};
# Modules
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
2024-05-10 23:21:26 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
# FIXME: pin to 24.05 when avalialble
2024-05-10 23:21:26 +02:00
stylix = {
url = "github:danth/stylix/release-24.05";
2024-05-10 23:21:26 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nixvim = {
url = "github:nix-community/nixvim";
inputs = {
nixpkgs.follows = "unstable";
2024-05-17 18:20:21 +02:00
devshell.follows = "devshell";
nix-darwin.follows = ""; # disable MacOS stuff
2024-05-10 23:21:26 +02:00
home-manager.follows = "home-manager";
2024-05-17 18:20:21 +02:00
flake-compat.follows = "stylix/flake-compat";
};
};
# For deduplication
systems.url = "github:nix-systems/default";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
devshell = {
url = "github:numtide/devshell";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
2024-05-10 23:21:26 +02:00
};
2024-05-10 21:47:38 +02:00
2024-01-14 17:33:16 +01:00
# Flake outputs that other flakes can use
2024-05-04 20:57:33 +02:00
outputs = {
self,
nixpkgs,
unstable,
2024-05-04 20:57:33 +02:00
stylix,
home-manager,
nixos-hardware,
jpassmenu,
audiomenu,
nixvim,
2024-05-10 21:47:38 +02:00
lix-module,
2024-05-17 18:20:21 +02:00
...
2024-05-04 20:57:33 +02:00
}: 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;
2024-05-04 20:57:33 +02:00
pkgs = import nixpkgs {inherit system;};
}
);
2024-05-04 20:57:33 +02:00
overlays = builtins.attrValues self.overlays;
in {
checks = forEachSupportedSystem (
{
pkgs,
system,
}: let
src = builtins.path {
path = ./.;
name = "configuration.nix";
};
in {
2024-05-04 20:57:33 +02:00
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
pkgs = import nixpkgs {inherit system overlays;};
module = ./nvim/nixvim.nix;
};
2024-06-08 22:28:27 +02:00
fmt = pkgs.callPackage ./fmt.nix {inherit src;};
lint = pkgs.callPackage ./lint.nix {inherit src;};
typos = pkgs.callPackage ./lint.nix {inherit src;};
2024-05-04 20:57:33 +02:00
}
);
packages = forEachSupportedSystem (
{
pkgs,
system,
}: {
inherit
(import ./docs {inherit pkgs lib;})
docs
nixos-markdown
nvim-markdown
home-markdown
;
# Nvim standalone module
nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
pkgs = import nixpkgs {inherit system overlays;};
module = ./nvim/nixvim.nix;
};
2024-05-04 20:57:33 +02:00
}
);
# Provide necessary overlays
overlays = {
nixvim = nixvim.overlays.default;
jpassmenu = jpassmenu.overlays.default;
audiomenu = audiomenu.overlays.default;
unstable = final: prev: {
inherit
(unstable.legacyPackages.${prev.system})
gitoxide
jujutsu
wezterm
;
unstable = unstable.legacyPackages.${prev.system};
};
2024-05-04 20:57:33 +02:00
};
2024-05-04 20:57:33 +02:00
# Nix files formatter (run `nix fmt`)
formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.alejandra);
# Example vm configuration
nixosConfigurations.vm = let
system = "x86_64-linux";
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["steam-original"];
pkgs = import nixpkgs {inherit system overlays config;};
in
lib.nixosSystem {
inherit system pkgs;
modules = [
self.nixosModules.vm # import vm module
{
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";
2024-05-17 18:50:01 +02:00
users.users.jdoe = {
password = "example";
isNormalUser = true;
extraGroups = [
"wheel"
"video"
"networkmanager"
];
};
2024-05-04 20:57:33 +02:00
home-manager.users.jdoe = {
2024-05-17 18:50:01 +02:00
home = {
username = "jdoe";
homeDirectory = "/home/jdoe";
};
jhome = {
enable = true;
gui.enable = true;
dev.rust.enable = true;
};
2024-05-04 20:57:33 +02:00
};
nix.registry.nixpkgs.flake = nixpkgs;
2024-05-17 18:50:01 +02:00
jconfig = {
enable = true;
gui.enable = true;
};
2024-05-04 20:57:33 +02:00
}
];
};
nixosModules = let
nvim-config.imports = [
nixvim.homeManagerModules.nixvim
./nvim
];
overlays = builtins.attrValues self.overlays;
homeManagerModuleSandalone = import ./home {inherit overlays nvim-config stylix;};
homeManagerModuleNixOS = import ./home {inherit overlays nvim-config;};
nixosModule = {
2024-05-10 23:21:26 +02:00
imports =
[
(import ./system {inherit stylix;})
home-manager.nixosModules.home-manager
]
++ nixpkgs.lib.optional (lix-module != null) lix-module.nixosModules.default;
2024-05-17 18:50:01 +02:00
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [homeManagerModuleNixOS];
};
2024-05-04 20:57:33 +02:00
# 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 homeManagerModuleNixOS homeManagerModuleSandalone;
}
// machineModules;
devShells = forEachSupportedSystem (
{
pkgs,
system,
}: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
just
self.packages.${system}.nvim
];
flake.lock: Update Replaced neovim with neovim-nightly-overlay as the flake from neovim was removed. Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/44677a1c96810a8e8c4ffaeaad10c842402647c1' (2024-05-12) → 'github:nix-community/home-manager/05e6ba83eb3585ce0aff7b41e4bd0e317d05ad4a' (2024-05-26) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/005ee33a9a145f714f4837b1c0b5c430ac3bc588.tar.gz?narHash=sha256-%2Baa9ZALET2yJEDK5wmBUcFjj60/lNQqA4%2BDUPK0wzZE%3D' (2024-05-17) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/5986a720d47041b79ead2d1f58a172f410d29db5.tar.gz?narHash=sha256-VXsSaj3athaUjgbX9bovTNhSOgevU%2B8qWx9pgaQePdE%3D' (2024-05-26) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/53d713eb486f21d653af3ef3528e9a19ecfc45e5.tar.gz?narHash=sha256-IUFYAl3158Ig5vySnRBHoPReb2/S97bjodCo6FhzJv4%3D' (2024-05-16) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/18fa4a89e208cb8e881f5f71c75bbd4c1c2fd37d.tar.gz?narHash=sha256-fzY708SyfHwLOFrg5ZU0fXW9mNdvRvqz64jg97vvpJM%3D' (2024-05-23) • Updated input 'neovim-flake': 'github:neovim/neovim/27fb62988e922c2739035f477f93cc052a4fee1e?dir=contrib' (2024-05-16) → 'github:nix-community/neovim-nightly-overlay/0f91f34a626baade98dfa091cc7a023266644d91' (2024-05-25) • Removed input 'neovim-flake/flake-utils' • Removed input 'neovim-flake/nixpkgs' • Added input 'neovim-src': 'github:neovim/neovim/27fb62988e922c2739035f477f93cc052a4fee1e' (2024-05-16) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/ff1be1e3cdf884df0935ab28745ab13c3c26d828' (2024-05-16) → 'github:NixOS/nixos-hardware/2e7d6c568063c83355fe066b8a8917ee758de1b8' (2024-05-26) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/33d1e753c82ffc557b4a585c77de43d4c922ebb5' (2024-05-15) → 'github:NixOS/nixpkgs/bfb7a882678e518398ce9a31a881538679f6f092' (2024-05-24) • Updated input 'nixvim': 'github:nix-community/nixvim/72ff1489c7f40dae829fafc689fb6a57099a9739' (2024-05-16) → 'github:nix-community/nixvim/8212bf1cd2d2dfe6ba521dd8c65a13b67e562d1a' (2024-05-26) • Updated input 'nixvim/flake-parts': 'github:hercules-ci/flake-parts/e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e' (2024-05-02) → 'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9' (2024-05-16) • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/c6aaf729f34a36c445618580a9f95a48f5e4e03f' (2024-04-25) → 'github:numtide/treefmt-nix/2fba33a182602b9d49f0b2440513e5ee091d838b' (2024-05-17) • Updated input 'pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/fa606cccd7b0ccebe2880051208e4a0f61bfc8c1' (2024-05-16) → 'github:cachix/pre-commit-hooks.nix/0e8fcc54b842ad8428c9e705cb5994eaf05c26a0' (2024-05-20) • Updated input 'stylix': 'github:jalil-salame/stylix/feeb35d2857ef6e32292ebdb862c2f6022c727fd' (2024-05-20) → 'github:jalil-salame/stylix/e5a4701b7d96c4909105a4c2366e4af3f188f802' (2024-05-24)
2024-05-24 06:29:14 +02:00
QEMU_OPTS_WL = "--enable-kvm -smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
2024-05-04 20:57:33 +02:00
};
}
);
};
2024-01-14 17:33:16 +01:00
}