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-unstable";
|
|
|
|
# Software
|
|
|
|
jpassmenu = {
|
|
|
|
url = "github:jalil-salame/jpassmenu";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
audiomenu = {
|
|
|
|
url = "github:jalil-salame/audiomenu";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
neovim-flake = {
|
2024-05-17 06:29:41 +02:00
|
|
|
url = "github:neovim/neovim?dir=contrib&ref=v0.10.0";
|
2024-05-10 23:21:26 +02:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
2024-05-17 18:20:21 +02:00
|
|
|
flake-utils.follows = "flake-utils";
|
2024-05-10 23:21:26 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
# 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";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
|
|
|
stylix = {
|
2024-05-20 14:40:15 +02:00
|
|
|
url = "github:jalil-salame/stylix/enable-option";
|
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 = "nixpkgs";
|
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";
|
|
|
|
pre-commit-hooks.follows = "pre-commit-hooks";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# 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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
pre-commit-hooks = {
|
|
|
|
url = "github:cachix/pre-commit-hooks.nix";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
nixpkgs-stable.follows = "nixpkgs";
|
2024-05-10 23:21:26 +02:00
|
|
|
flake-compat.follows = "stylix/flake-compat";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
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,
|
|
|
|
stylix,
|
|
|
|
home-manager,
|
|
|
|
nixos-hardware,
|
|
|
|
jpassmenu,
|
|
|
|
audiomenu,
|
|
|
|
nixvim,
|
|
|
|
neovim-flake,
|
2024-05-10 21:47:38 +02:00
|
|
|
lix,
|
|
|
|
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:
|
2024-04-05 11:55:35 +02:00
|
|
|
f {
|
|
|
|
inherit system;
|
2024-05-04 20:57:33 +02:00
|
|
|
pkgs = import nixpkgs {inherit system;};
|
2024-04-05 11:55:35 +02:00
|
|
|
}
|
|
|
|
);
|
2024-05-04 20:57:33 +02:00
|
|
|
overlays = builtins.attrValues self.overlays;
|
|
|
|
in {
|
|
|
|
checks = forEachSupportedSystem (
|
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
system,
|
2024-05-04 20:59:17 +02:00
|
|
|
}: 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-05-17 06:29:41 +02:00
|
|
|
formatting = pkgs.stdenvNoCC.mkDerivation {
|
|
|
|
name = "nix-formatting-check";
|
|
|
|
dontUnpack = true;
|
|
|
|
dontBuild = true;
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = "${pkgs.lib.getExe self.formatter.${system}} --check --quiet ${src}";
|
|
|
|
installPhase = "mkdir $out";
|
|
|
|
};
|
2024-05-04 20:59:17 +02:00
|
|
|
typos = let
|
|
|
|
typos = pkgs.lib.getExe pkgs.typos;
|
|
|
|
in
|
|
|
|
pkgs.stdenvNoCC.mkDerivation {
|
|
|
|
name = "typos-check";
|
|
|
|
dontUnpack = true;
|
|
|
|
dontBuild = true;
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = "${typos} --color=always ${src}";
|
|
|
|
installPhase = "mkdir $out";
|
|
|
|
};
|
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-04-05 11:55:35 +02:00
|
|
|
};
|
2024-05-04 20:57:33 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
# Provide necessary overlays
|
|
|
|
overlays = {
|
|
|
|
nixvim = nixvim.overlays.default;
|
|
|
|
neovim-nightly = neovim-flake.overlay;
|
|
|
|
jpassmenu = jpassmenu.overlays.default;
|
|
|
|
audiomenu = audiomenu.overlays.default;
|
2024-05-10 21:20:16 +02:00
|
|
|
# FIXME: remove once merged in nixpkgs
|
|
|
|
fix-noice-nvim = final: prev: {
|
|
|
|
vimPlugins =
|
|
|
|
prev.vimPlugins
|
|
|
|
// {
|
|
|
|
noice-nvim = prev.vimUtils.buildVimPlugin {
|
|
|
|
pname = "noice.nvim";
|
|
|
|
version = "2024-05-09";
|
|
|
|
src = final.fetchFromGitHub {
|
|
|
|
owner = "folke";
|
|
|
|
repo = "noice.nvim";
|
|
|
|
rev = "v2.0.2";
|
|
|
|
sha256 = "sha256-YWqphpaxr/729/6NTDEWKOi2FnY/8xgjdsDQ9ePj7b8=";
|
|
|
|
};
|
|
|
|
meta.homepage = "https://github.com/folke/noice.nvim/";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-05-04 20:57:33 +02:00
|
|
|
};
|
2024-01-15 23:26:00 +01: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
|
|
|
};
|
2024-01-15 12:57:44 +01: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 != null && 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
|
2024-04-05 11:55:35 +02:00
|
|
|
];
|
2024-05-04 20:57:33 +02:00
|
|
|
QEMU_OPTS_WL = "-smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
2024-01-14 17:33:16 +01:00
|
|
|
}
|