configuration.nix/flake.nix

245 lines
7.2 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
# Lix
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";
2024-05-10 23:21:26 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
[chore] flake.lock: update inputs Flake lock file updates: ``` • Updated input 'devshell': 'github:numtide/devshell/1ebbe68d57457c8cae98145410b164b5477761f4' (2024-06-03) → 'github:numtide/devshell/67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae' (2024-07-27) • Removed input 'devshell/flake-utils' • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/c716603a63aca44f39bef1986c13402167450e0a' (2024-07-17) → 'github:NixOS/nixpkgs/8c50662509100d53229d4be607f1a3a31157fa12' (2024-07-27) • Updated input 'nixvim': 'github:nix-community/nixvim/55bda0cc3b230255d271e5eef82f3279dae9f859' (2024-07-17) → 'github:nix-community/nixvim/2415edc0cb749bf81c9b142138c2bb705514f6cc' (2024-07-29) • Updated input 'nixvim/git-hooks': 'github:cachix/git-hooks.nix/8d6a17d0cdf411c55f12602624df6368ad86fac1' (2024-07-09) → 'github:cachix/git-hooks.nix/f451c19376071a90d8c58ab1a953c6e9840527fd' (2024-07-15) • Added input 'nixvim/nuschtosSearch': 'github:NuschtOS/search/16565307c267ec219c2b5d3494ba66df08e7d403' (2024-07-28) • Added input 'nixvim/nuschtosSearch/flake-utils': 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11) • Added input 'nixvim/nuschtosSearch/flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) • Added input 'nixvim/nuschtosSearch/nixpkgs': follows 'nixvim/nixpkgs' • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/5b002f8a53ed04c1a4177e7b00809d57bd2c696f' (2024-07-12) → 'github:numtide/treefmt-nix/8db8970be1fb8be9c845af7ebec53b699fe7e009' (2024-07-23) • Updated input 'unstable': 'github:NixOS/nixpkgs/ad0b5eed1b6031efaed382844806550c3dcb4206' (2024-07-16) → 'github:NixOS/nixpkgs/b73c2221a46c13557b1b3be9c2070cc42cf01eb3' (2024-07-27) ``` Also fixed some input duplication.
2024-07-29 09:00:01 +02:00
flake-utils.inputs.systems.follows = "systems";
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";
};
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";
# disable optional inputs
flake-compat.follows = "";
2024-05-10 23:21:26 +02:00
};
};
nixvim = {
url = "github:nix-community/nixvim";
inputs = {
[chore] flake.lock: update Also fix neovim errors Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/845a5c4c073f74105022533907703441e0464bc3?narHash=sha256-vWSkg6AMok1UUQiSYVdGMOXKD2cDFnajITiSi0Zjd1A%3D' (2024-06-04) → 'github:nix-community/home-manager/a1fddf0967c33754271761d91a3d921772b30d0e?narHash=sha256-BmO8d0r%2BBVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8%3D' (2024-06-16) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/068576042b3b58f8180b24a36c07199a1a3fd380.tar.gz?narHash=sha256-/hsqsiw3p5qMpazedgFFZF2sQghbCJIoef7XCpegTXw%3D' (2024-06-13) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/e44dcd63c4d96807536cdcf2afb688a537cce9be.tar.gz?narHash=sha256-cAkgZoiP2eHB%2BV2cPJMcXACzdaWZIMgI5sg4vpH%2BDYo%3D' (2024-06-20) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/4e25f1ab68f2270f9cff59216056c21073db0164.tar.gz?narHash=sha256-m8XYt8NU2T4gvkien7H7LFGXHhSA5z4tHOeuXQ3DJi4%3D' (2024-06-06) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/909e593ae9f5fe338ab19b4ed9d52bb0ea09bad8.tar.gz?narHash=sha256-DdcMvX9r29uHMlz7P1Shgs5xZw9WkZ4ObMGYzwROAiw%3D' (2024-06-19) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/ae5c8dcc4d0182d07d75df2dc97112de822cb9d6?narHash=sha256-SuPne4BMqh9/IkKIAG47Cu5qfmntAaqlHdX1yuFoDO0%3D' (2024-06-14) → 'github:NixOS/nixos-hardware/083823b7904e43a4fc1c7229781417e875359a42?narHash=sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA%3D' (2024-06-20) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/cc54fb41d13736e92229c21627ea4f22199fee6b?narHash=sha256-US1tAChvPxT52RV8GksWZS415tTS7PV42KTc2PNDBmc%3D' (2024-06-12) → 'github:NixOS/nixpkgs/dd457de7e08c6d06789b1f5b88fc9327f4d96309?narHash=sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4%3D' (2024-06-19) • Updated input 'nixvim': 'github:nix-community/nixvim/7a2a25af02be25987aa43cd681312f4b5ba12317?narHash=sha256-NIJZxmY2CWsqJK/9BQCRSHfcCY9K6thjq/1XtJobxmU%3D' (2024-06-14) → 'github:nix-community/nixvim/744dfea48bdd331e66b9e874822559fa6fae98af?narHash=sha256-artyEBzWUsNXtYj7jBr816wRJj2Y3DYDHw6ECrQotX0%3D' (2024-06-20) • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/1cb529bffa880746a1d0ec4e0f5076876af931f1?narHash=sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k%3D' (2024-06-11) → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81?narHash=sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls%3D' (2024-06-16) • Updated input 'unstable': 'github:NixOS/nixpkgs/e9ee548d90ff586a6471b4ae80ae9cfcbceb3420?narHash=sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY%3D' (2024-06-13) → 'github:NixOS/nixpkgs/c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e?narHash=sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak%3D' (2024-06-18)
2024-06-21 06:30:18 +02:00
nixpkgs.follows = "unstable";
2024-05-10 23:21:26 +02:00
home-manager.follows = "home-manager";
# disable optional inputs
flake-compat.follows = "";
nix-darwin.follows = "";
nuschtosSearch.follows = "";
devshell.follows = "";
git-hooks.follows = "";
2024-05-17 18:20:21 +02:00
};
};
# For deduplication
systems.url = "github:nix-systems/default";
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
outputs =
{
self,
nixpkgs,
unstable,
stylix,
home-manager,
nixvim,
lix-module,
[chore] flake.lock: update inputs Flake lock file updates: ``` • Updated input 'devshell': 'github:numtide/devshell/1ebbe68d57457c8cae98145410b164b5477761f4' (2024-06-03) → 'github:numtide/devshell/67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae' (2024-07-27) • Removed input 'devshell/flake-utils' • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/c716603a63aca44f39bef1986c13402167450e0a' (2024-07-17) → 'github:NixOS/nixpkgs/8c50662509100d53229d4be607f1a3a31157fa12' (2024-07-27) • Updated input 'nixvim': 'github:nix-community/nixvim/55bda0cc3b230255d271e5eef82f3279dae9f859' (2024-07-17) → 'github:nix-community/nixvim/2415edc0cb749bf81c9b142138c2bb705514f6cc' (2024-07-29) • Updated input 'nixvim/git-hooks': 'github:cachix/git-hooks.nix/8d6a17d0cdf411c55f12602624df6368ad86fac1' (2024-07-09) → 'github:cachix/git-hooks.nix/f451c19376071a90d8c58ab1a953c6e9840527fd' (2024-07-15) • Added input 'nixvim/nuschtosSearch': 'github:NuschtOS/search/16565307c267ec219c2b5d3494ba66df08e7d403' (2024-07-28) • Added input 'nixvim/nuschtosSearch/flake-utils': 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11) • Added input 'nixvim/nuschtosSearch/flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) • Added input 'nixvim/nuschtosSearch/nixpkgs': follows 'nixvim/nixpkgs' • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/5b002f8a53ed04c1a4177e7b00809d57bd2c696f' (2024-07-12) → 'github:numtide/treefmt-nix/8db8970be1fb8be9c845af7ebec53b699fe7e009' (2024-07-23) • Updated input 'unstable': 'github:NixOS/nixpkgs/ad0b5eed1b6031efaed382844806550c3dcb4206' (2024-07-16) → 'github:NixOS/nixpkgs/b73c2221a46c13557b1b3be9c2070cc42cf01eb3' (2024-07-27) ``` Also fixed some input duplication.
2024-07-29 09:00:01 +02:00
systems,
}:
let
inherit (nixpkgs) lib;
# Helpers for producing system-specific outputs
[chore] flake.lock: update inputs Flake lock file updates: ``` • Updated input 'devshell': 'github:numtide/devshell/1ebbe68d57457c8cae98145410b164b5477761f4' (2024-06-03) → 'github:numtide/devshell/67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae' (2024-07-27) • Removed input 'devshell/flake-utils' • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/c716603a63aca44f39bef1986c13402167450e0a' (2024-07-17) → 'github:NixOS/nixpkgs/8c50662509100d53229d4be607f1a3a31157fa12' (2024-07-27) • Updated input 'nixvim': 'github:nix-community/nixvim/55bda0cc3b230255d271e5eef82f3279dae9f859' (2024-07-17) → 'github:nix-community/nixvim/2415edc0cb749bf81c9b142138c2bb705514f6cc' (2024-07-29) • Updated input 'nixvim/git-hooks': 'github:cachix/git-hooks.nix/8d6a17d0cdf411c55f12602624df6368ad86fac1' (2024-07-09) → 'github:cachix/git-hooks.nix/f451c19376071a90d8c58ab1a953c6e9840527fd' (2024-07-15) • Added input 'nixvim/nuschtosSearch': 'github:NuschtOS/search/16565307c267ec219c2b5d3494ba66df08e7d403' (2024-07-28) • Added input 'nixvim/nuschtosSearch/flake-utils': 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11) • Added input 'nixvim/nuschtosSearch/flake-utils/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09) • Added input 'nixvim/nuschtosSearch/nixpkgs': follows 'nixvim/nixpkgs' • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/5b002f8a53ed04c1a4177e7b00809d57bd2c696f' (2024-07-12) → 'github:numtide/treefmt-nix/8db8970be1fb8be9c845af7ebec53b699fe7e009' (2024-07-23) • Updated input 'unstable': 'github:NixOS/nixpkgs/ad0b5eed1b6031efaed382844806550c3dcb4206' (2024-07-16) → 'github:NixOS/nixpkgs/b73c2221a46c13557b1b3be9c2070cc42cf01eb3' (2024-07-27) ``` Also fixed some input duplication.
2024-07-29 09:00:01 +02:00
supportedSystems = import systems;
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
}
);
overlays = builtins.attrValues self.overlays;
scripts_pkgs = import ./scripts;
scripts = final: prev: scripts_pkgs final;
in
{
checks = forEachSupportedSystem (
{ pkgs, system }:
let
src = builtins.path {
path = ./.;
name = "configuration.nix";
};
runCmdInSrc =
name: cmd:
pkgs.runCommandNoCC name { } ''
cd ${src}
${cmd}
mkdir $out
'';
in
{
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
pkgs = import nixpkgs { inherit system overlays; };
module = ./nvim/standalone.nix;
};
fmt = runCmdInSrc "fmt-src" "${lib.getExe self.formatter.${system}} --check .";
lint = runCmdInSrc "lint-src" "${lib.getExe pkgs.statix} check .";
typos = runCmdInSrc "typos-src" "${lib.getExe pkgs.typos} .";
}
);
2024-05-04 20:57:33 +02:00
packages = forEachSupportedSystem (
{ pkgs, system }:
scripts_pkgs pkgs
// {
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/standalone.nix;
};
}
);
2024-05-04 20:57:33 +02:00
# Provide necessary overlays
overlays = {
inherit scripts;
nixvim = nixvim.overlays.default;
unstable =
final: prev:
let
unstablePkgs = unstable.legacyPackages.${prev.system};
in
{
# Get unstable packages
unstable = unstablePkgs;
# Update vim plugins with the versions from unstable
vimPlugins = prev.vimPlugins // unstablePkgs.vimPlugins;
# Get specific packages from unstable
inherit (unstablePkgs)
gitoxide
jujutsu
neovim-unwrapped
# wezterm
;
};
};
# Nix files formatter (run `nix fmt`)
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
2024-05-04 20:57:33 +02:00
# 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";
users.users.jdoe = {
password = "example";
isNormalUser = true;
extraGroups = [
"wheel"
"video"
"networkmanager"
];
};
home-manager.users.jdoe = {
home = {
username = "jdoe";
homeDirectory = "/home/jdoe";
};
jhome = {
enable = true;
gui.enable = true;
dev.rust.enable = true;
};
2024-05-17 18:50:01 +02:00
};
nix.registry.nixpkgs.flake = nixpkgs;
jconfig = {
2024-05-17 18:50:01 +02:00
enable = true;
gui.enable = true;
};
}
];
2024-05-17 18:50:01 +02:00
};
2024-05-04 20:57:33 +02:00
nixosModules =
let
nvim-config.imports = [
nixvim.homeManagerModules.nixvim
./nvim
];
homeManagerModuleSandalone = import ./home { inherit nvim-config stylix; };
homeManagerModuleNixOS = import ./home { inherit nvim-config; };
nixosModule = {
imports = [
(import ./system { inherit stylix; })
home-manager.nixosModules.home-manager
] ++ nixpkgs.lib.optional (lix-module != null) lix-module.nixosModules.default;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [ homeManagerModuleNixOS ];
};
# Pin nixpkgs
nix.registry.nixpkgs.flake = nixpkgs;
};
2024-05-04 20:57:33 +02:00
machines = [ "vm" ];
mkMachine = hostname: {
imports = [
nixosModule
(import (./machines + "/${hostname}"))
];
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.mkShellNoCC {
buildInputs = [
pkgs.just
self.packages.${system}.nvim
];
QEMU_OPTS_WL = "--enable-kvm -smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
};
}
);
};
2024-01-14 17:33:16 +01:00
}