mirror of
https://git.lgmrszd.xyz/Lgmrszd/nix-cfg.git
synced 2025-12-13 23:28:20 +01:00
148 lines
4.4 KiB
Nix
148 lines
4.4 KiB
Nix
{
|
|
description = "Lgm's NixOS Flake";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
flake-compat.url = "github:edolstra/flake-compat";
|
|
systems.url = "github:nix-systems/default";
|
|
flake-utils = {
|
|
url = "github:numtide/flake-utils";
|
|
inputs.systems.follows = "systems";
|
|
};
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager/master";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
sops-nix = {
|
|
url = "github:Mic92/sops-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
mailserver = {
|
|
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
|
|
inputs.flake-compat.follows = "flake-compat";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
authentik-nix = {
|
|
url = "github:nix-community/authentik-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.flake-parts.follows = "flake-parts";
|
|
};
|
|
vscode-server = {
|
|
url = "github:nix-community/nixos-vscode-server";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
};
|
|
lix-module = {
|
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
|
|
nix-cfg-extra.url = "git+https://git.lgmrszd.xyz/lgmrszd/nix-cfg-extra-public.git";
|
|
};
|
|
|
|
outputs = inputs@{
|
|
nixpkgs,
|
|
lix-module,
|
|
nixpkgs-stable,
|
|
home-manager,
|
|
sops-nix,
|
|
mailserver,
|
|
authentik-nix,
|
|
vscode-server,
|
|
...
|
|
}:
|
|
let
|
|
system = "x86_64-linux";
|
|
mylib = import ./lib;
|
|
overlay-stable = final: prev: {
|
|
stable = import nixpkgs-stable {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
};
|
|
overlay-vaapiIntel = final: prev: {
|
|
vaapiIntel = prev.vaapiIntel.override { enableHybridCodec = true; };
|
|
};
|
|
overlay-nitrokey-udev-update = final: prev: {
|
|
nitrokey-udev-rules = prev.nitrokey-udev-rules.overrideAttrs(old: {
|
|
version = "1.1.0";
|
|
src = prev.fetchFromGitHub {
|
|
owner = "Nitrokey";
|
|
repo = "nitrokey-udev-rules";
|
|
rev = "v1.1.0";
|
|
hash = "sha256-LKpd6O9suAc2+FFgpuyTClEgL/JiZiokH3DV8P3C7Aw=";
|
|
};
|
|
dontBuild = true;
|
|
doCheck = false;
|
|
});
|
|
};
|
|
my-overlays = [
|
|
overlay-stable
|
|
overlay-vaapiIntel
|
|
overlay-nitrokey-udev-update
|
|
];
|
|
inherit (inputs.nix-cfg-extra.lib) extra-data;
|
|
inherit (inputs.nix-cfg-extra.lib) extra-host-modules;
|
|
inherit (inputs.nix-cfg-extra.lib) extra-host-home-modules;
|
|
|
|
mkHostConfig = ({ host, extraModules ? [], useHome ? false }:
|
|
let
|
|
# TODO: rename some of those
|
|
data = import ./hosts/${host}/data // (if extra-data ? ${host} then extra-data.${host} else {});
|
|
extra-modules = (if extra-host-modules ? ${host} then extra-host-modules.${host} else []);
|
|
extra-home-modules = (if extra-host-home-modules ? ${host} then extra-host-home-modules.${host} else []);
|
|
in
|
|
nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
specialArgs = { inherit data; inherit mylib; };
|
|
modules = [
|
|
{ nixpkgs.overlays = my-overlays; }
|
|
lix-module.nixosModules.default
|
|
./hosts/${host}/configuration.nix
|
|
./hosts/${host}/hardware-configuration.nix
|
|
sops-nix.nixosModules.sops
|
|
]
|
|
++ extra-modules
|
|
++ extraModules
|
|
++ (if !useHome then [] else [
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
home-manager.users.lgm = {
|
|
imports = [
|
|
./hosts/${host}/home
|
|
] ++ extra-home-modules;
|
|
};
|
|
home-manager.extraSpecialArgs = { inherit mylib; };
|
|
}
|
|
])
|
|
;
|
|
});
|
|
in
|
|
{
|
|
nixosConfigurations.lgm-nixos = mkHostConfig {
|
|
host = "laptop";
|
|
useHome = true;
|
|
extraModules = [
|
|
vscode-server.nixosModules.default
|
|
({ config, pkgs, ... }: {
|
|
services.vscode-server.enable = true;
|
|
services.vscode-server.installPath = "$HOME/.vscodium-server";
|
|
})
|
|
];
|
|
};
|
|
nixosConfigurations.lgm-vps1 = mkHostConfig {
|
|
host = "vps1";
|
|
extraModules = [
|
|
mailserver.nixosModule
|
|
authentik-nix.nixosModules.default
|
|
];
|
|
};
|
|
};
|
|
}
|