213 lines
6.9 KiB
Nix
213 lines
6.9 KiB
Nix
{
|
|
description = "My awesome system config";
|
|
|
|
/*
|
|
╔══════════════════════════════════════════════════════════╗
|
|
║ Inputs ║
|
|
╚══════════════════════════════════════════════════════════╝
|
|
*/
|
|
inputs = {
|
|
# Nix
|
|
master.url = "github:nixos/nixpkgs";
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
stable.url = "github:nixos/nixpkgs/nixos-23.05";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
|
agenix.url = "github:ryantm/agenix";
|
|
|
|
attic.inputs.flake-utils.follows = "flake-utils";
|
|
attic.inputs.nixpkgs-stable.follows = "stable";
|
|
attic.inputs.nixpkgs.follows = "nixpkgs";
|
|
attic.url = "github:zhaofengli/attic";
|
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
|
|
nil.inputs.flake-utils.follows = "flake-utils";
|
|
nil.inputs.nixpkgs.follows = "nixpkgs";
|
|
nil.url = "github:oxalica/nil";
|
|
|
|
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
|
|
|
nix-super.url = "github:privatevoid-net/nix-super/aaba1f91e7eba8ce029fa6bfa81ad9e14a13708d";
|
|
nix-super.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
rofi-wayland.url = "github:lbonn/rofi/wayland";
|
|
rofi-wayland.flake = false;
|
|
|
|
# Neovim
|
|
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
|
|
|
cmp-async-path.url = "github:FelipeLema/cmp-async-path";
|
|
cmp-async-path.flake = false;
|
|
|
|
copilot-lua.flake = false;
|
|
copilot-lua.url = "github:zbirenbaum/copilot.lua";
|
|
|
|
lspsaga-nvim.flake = false;
|
|
lspsaga-nvim.url = "github:glepnir/lspsaga.nvim";
|
|
|
|
nvim-treesitter-textsubjects.flake = false;
|
|
nvim-treesitter-textsubjects.url = "github:RRethy/nvim-treesitter-textsubjects";
|
|
|
|
smartcolumn-nvim.flake = false;
|
|
smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim";
|
|
|
|
# Hyprland
|
|
hypr-contrib.url = "github:hyprwm/contrib";
|
|
hyprland.url = "github:hyprwm/Hyprland";
|
|
hyprpaper.url = "github:hyprwm/hyprpaper";
|
|
|
|
# Laptop
|
|
asus-touchpad-numpad-driver.url = "github:MoritzBoehme/asus-touchpad-numpad-driver/german-layout";
|
|
asus-touchpad-numpad-driver.flake = false;
|
|
|
|
# Firefox user.js
|
|
arkenfox-userjs.url = "github:arkenfox/user.js";
|
|
arkenfox-userjs.flake = false;
|
|
};
|
|
|
|
/*
|
|
╔══════════════════════════════════════════════════════════╗
|
|
║ Outputs ║
|
|
╚══════════════════════════════════════════════════════════╝
|
|
*/
|
|
outputs = inputs@{ self, nixpkgs, ... }:
|
|
let
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
forEachSystem = lib.genAttrs systems;
|
|
|
|
lib = nixpkgs.lib.extend
|
|
(self: _: { my = import ./lib { lib = self; }; });
|
|
|
|
overlay = import ./overlays {
|
|
inherit inputs;
|
|
inherit (self) lib;
|
|
};
|
|
|
|
config.allowUnfree = true;
|
|
|
|
overlays = [
|
|
inputs.hypr-contrib.overlays.default
|
|
inputs.hyprland.overlays.default
|
|
inputs.neovim-nightly-overlay.overlay
|
|
overlay
|
|
];
|
|
|
|
pkgsFor = system: import nixpkgs {
|
|
inherit system config;
|
|
overlays = overlays ++ [
|
|
(
|
|
_: prev: {
|
|
master = import inputs.master {
|
|
inherit (prev) system;
|
|
inherit overlays config;
|
|
};
|
|
stable = import inputs.stable {
|
|
inherit (prev) system;
|
|
inherit overlays config;
|
|
};
|
|
}
|
|
)
|
|
overlay
|
|
];
|
|
};
|
|
|
|
defaultModules = [
|
|
{ nixpkgs = { inherit config; }; }
|
|
./modules
|
|
inputs.home-manager.nixosModule
|
|
{
|
|
home-manager = {
|
|
useGlobalPkgs = true;
|
|
useUserPackages = true;
|
|
extraSpecialArgs = { inherit inputs self; };
|
|
};
|
|
}
|
|
inputs.agenix.nixosModules.age
|
|
];
|
|
|
|
hosts = self.lib.my.mapModules
|
|
(path:
|
|
let
|
|
system = import "${path}/system.nix";
|
|
pkgs = pkgsFor system;
|
|
in
|
|
lib.nixosSystem {
|
|
inherit pkgs system lib;
|
|
specialArgs = {
|
|
inherit inputs self;
|
|
};
|
|
modules = defaultModules ++ [ path ];
|
|
})
|
|
./hosts;
|
|
|
|
pre-commit-check = system: inputs.pre-commit-hooks.lib."${system}".run {
|
|
src = ./.;
|
|
hooks = {
|
|
nixpkgs-fmt.enable = true;
|
|
statix.enable = true;
|
|
shellcheck.enable = true;
|
|
stylua.enable = true;
|
|
};
|
|
};
|
|
in
|
|
with lib; {
|
|
inherit lib;
|
|
|
|
# ╔══════════════════════════════════════════════════════════╗
|
|
# ║ NixOS Configurations ║
|
|
# ╚══════════════════════════════════════════════════════════╝
|
|
|
|
nixosConfigurations = hosts;
|
|
|
|
# ╔══════════════════════════════════════════════════════════╗
|
|
# ║ Other Outputs ║
|
|
# ╚══════════════════════════════════════════════════════════╝
|
|
|
|
devShells = forEachSystem (system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
in
|
|
{
|
|
default = pkgs.mkShell
|
|
{
|
|
inherit (pre-commit-check system) shellHook;
|
|
name = "dotfiles";
|
|
packages = with pkgs; [
|
|
# Secrets
|
|
agenix
|
|
# cachix
|
|
cachix
|
|
];
|
|
};
|
|
});
|
|
|
|
checks = forEachSystem (system: {
|
|
pre-commit-check = pre-commit-check system;
|
|
});
|
|
|
|
legacyPackages = forEachSystem pkgsFor;
|
|
|
|
packages = forEachSystem (system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
in
|
|
filterAttrs (_: isDerivation)
|
|
(overlay pkgs pkgs)
|
|
);
|
|
|
|
overlays =
|
|
let
|
|
overlayNames = attrNames (overlay null null);
|
|
mkOverlay = name: final: prev: (overlay final prev).${name};
|
|
in
|
|
(genAttrs overlayNames mkOverlay) // {
|
|
default = overlay;
|
|
};
|
|
};
|
|
}
|