configuration.nix/flake.nix

303 lines
8.4 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-unstable";
# Software
jpassmenu = {
url = "github:jalil-salame/jpassmenu";
inputs.nixpkgs.follows = "nixpkgs";
};
audiomenu = {
url = "github:jalil-salame/audiomenu";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-flake = {
flake.lock: Update Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/6e277d9566de9976f47228dd8c580b97488734d4?narHash=sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0%3D' (2024-05-07) → 'github:nix-community/home-manager/44677a1c96810a8e8c4ffaeaad10c842402647c1?narHash=sha256-4pRuzsHZOW5W4CsXI9uhKtiJeQSUoe1d2M9mWU98HC4%3D' (2024-05-12) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/4ebbd4362f3e39315717706ebf853a9a2876fdbc.tar.gz?narHash=sha256-H4tntQASGNdP2UySLDc3KjcdXjEChpwCDweYrPI7KWo%3D' (2024-05-10) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/005ee33a9a145f714f4837b1c0b5c430ac3bc588.tar.gz?narHash=sha256-%2Baa9ZALET2yJEDK5wmBUcFjj60/lNQqA4%2BDUPK0wzZE%3D' (2024-05-17) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/c8ab1e79ba0140bc75731c75177242089506260b.tar.gz?narHash=sha256-Z787hdZuwBhQCQOeOmln5j9cCKxDWql7tbF1ukKDFZU%3D' (2024-05-09) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/53d713eb486f21d653af3ef3528e9a19ecfc45e5.tar.gz?narHash=sha256-IUFYAl3158Ig5vySnRBHoPReb2/S97bjodCo6FhzJv4%3D' (2024-05-16) • Updated input 'neovim-flake': 'github:neovim/neovim/ca735c7554701a1191e6afdac2ea4b4f94ba6d88?dir=contrib&narHash=sha256-Ml5HzPmVx/fnLedNpBYQs3YG2zhSKsPga89yaCDVYlM%3D' (2024-05-09) → 'github:neovim/neovim/06135cc21571b2707121e31176f544a0e0901e1d?dir=contrib&narHash=sha256-59K%2BjbZvf%2BX5q1aWj0VUIQ6YdFCcIuZBgI3EUS/p6IE%3D' (2024-05-16) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/a4e2b7909fc1bdf30c30ef21d388fde0b5cdde4a?narHash=sha256-lRxjTxY3103LGMjWdVqntKZHhlmMX12QUjeFrQMmGaE%3D' (2024-05-08) → 'github:NixOS/nixos-hardware/ff1be1e3cdf884df0935ab28745ab13c3c26d828?narHash=sha256-e4LJk5uV1wvrRkffGFZekPWvFUx29NnnOahBlLaq8Ek%3D' (2024-05-16) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/b211b392b8486ee79df6cdfb1157ad2133427a29?narHash=sha256-CLU5Tsg24Ke4%2B7sH8azHWXKd0CFd4mhLWfhYgUiDBpQ%3D' (2024-05-07) → 'github:NixOS/nixpkgs/33d1e753c82ffc557b4a585c77de43d4c922ebb5?narHash=sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg%3D' (2024-05-15) • Updated input 'nixvim': 'github:nix-community/nixvim/f7f255afe22fcca0c07177c3707fd61fa0c85835?narHash=sha256-oREqXPEtuYbOdBKbsDQzr2V01EzK4kD8MTdwO9ljTnU%3D' (2024-05-07) → 'github:nix-community/nixvim/72ff1489c7f40dae829fafc689fb6a57099a9739?narHash=sha256-HC3JxKLeXDL2NpHjD%2BGD%2BXxvGmYsq/yqSX8TCLa3atA%3D' (2024-05-16) • Updated input 'nixvim/devshell/nixpkgs': 'github:NixOS/nixpkgs/ac34158a823c7596e0106c806d0b7df47885fa73?narHash=sha256-X0xvboLSjfC5s/M1yuPdSdc6yzKV8536hTTWCSKF5Xc%3D' (2024-05-09) → follows 'nixvim/nixpkgs' • Updated input 'nixvim/pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/2849da033884f54822af194400f8dff435ada242?narHash=sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk%3D' (2024-04-30) → 'github:cachix/pre-commit-hooks.nix/c182c876690380f8d3b9557c4609472ebfa1b141?narHash=sha256-/5u29K0c%2B4jyQ8x7dUIEUWlz2BoTSZWUP2quPwFCE7M%3D' (2024-05-13)
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 = {
url = "github:jalil-salame/stylix/fallback-fonts-v2";
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:
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;
};
flake.lock: Update Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/6e277d9566de9976f47228dd8c580b97488734d4?narHash=sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0%3D' (2024-05-07) → 'github:nix-community/home-manager/44677a1c96810a8e8c4ffaeaad10c842402647c1?narHash=sha256-4pRuzsHZOW5W4CsXI9uhKtiJeQSUoe1d2M9mWU98HC4%3D' (2024-05-12) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/4ebbd4362f3e39315717706ebf853a9a2876fdbc.tar.gz?narHash=sha256-H4tntQASGNdP2UySLDc3KjcdXjEChpwCDweYrPI7KWo%3D' (2024-05-10) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/005ee33a9a145f714f4837b1c0b5c430ac3bc588.tar.gz?narHash=sha256-%2Baa9ZALET2yJEDK5wmBUcFjj60/lNQqA4%2BDUPK0wzZE%3D' (2024-05-17) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/c8ab1e79ba0140bc75731c75177242089506260b.tar.gz?narHash=sha256-Z787hdZuwBhQCQOeOmln5j9cCKxDWql7tbF1ukKDFZU%3D' (2024-05-09) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/53d713eb486f21d653af3ef3528e9a19ecfc45e5.tar.gz?narHash=sha256-IUFYAl3158Ig5vySnRBHoPReb2/S97bjodCo6FhzJv4%3D' (2024-05-16) • Updated input 'neovim-flake': 'github:neovim/neovim/ca735c7554701a1191e6afdac2ea4b4f94ba6d88?dir=contrib&narHash=sha256-Ml5HzPmVx/fnLedNpBYQs3YG2zhSKsPga89yaCDVYlM%3D' (2024-05-09) → 'github:neovim/neovim/06135cc21571b2707121e31176f544a0e0901e1d?dir=contrib&narHash=sha256-59K%2BjbZvf%2BX5q1aWj0VUIQ6YdFCcIuZBgI3EUS/p6IE%3D' (2024-05-16) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/a4e2b7909fc1bdf30c30ef21d388fde0b5cdde4a?narHash=sha256-lRxjTxY3103LGMjWdVqntKZHhlmMX12QUjeFrQMmGaE%3D' (2024-05-08) → 'github:NixOS/nixos-hardware/ff1be1e3cdf884df0935ab28745ab13c3c26d828?narHash=sha256-e4LJk5uV1wvrRkffGFZekPWvFUx29NnnOahBlLaq8Ek%3D' (2024-05-16) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/b211b392b8486ee79df6cdfb1157ad2133427a29?narHash=sha256-CLU5Tsg24Ke4%2B7sH8azHWXKd0CFd4mhLWfhYgUiDBpQ%3D' (2024-05-07) → 'github:NixOS/nixpkgs/33d1e753c82ffc557b4a585c77de43d4c922ebb5?narHash=sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg%3D' (2024-05-15) • Updated input 'nixvim': 'github:nix-community/nixvim/f7f255afe22fcca0c07177c3707fd61fa0c85835?narHash=sha256-oREqXPEtuYbOdBKbsDQzr2V01EzK4kD8MTdwO9ljTnU%3D' (2024-05-07) → 'github:nix-community/nixvim/72ff1489c7f40dae829fafc689fb6a57099a9739?narHash=sha256-HC3JxKLeXDL2NpHjD%2BGD%2BXxvGmYsq/yqSX8TCLa3atA%3D' (2024-05-16) • Updated input 'nixvim/devshell/nixpkgs': 'github:NixOS/nixpkgs/ac34158a823c7596e0106c806d0b7df47885fa73?narHash=sha256-X0xvboLSjfC5s/M1yuPdSdc6yzKV8536hTTWCSKF5Xc%3D' (2024-05-09) → follows 'nixvim/nixpkgs' • Updated input 'nixvim/pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/2849da033884f54822af194400f8dff435ada242?narHash=sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk%3D' (2024-04-30) → 'github:cachix/pre-commit-hooks.nix/c182c876690380f8d3b9557c4609472ebfa1b141?narHash=sha256-/5u29K0c%2B4jyQ8x7dUIEUWlz2BoTSZWUP2quPwFCE7M%3D' (2024-05-13)
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";
};
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-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;
# 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-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 != 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-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
}