dotfiles/flake.nix

216 lines
7 KiB
Nix
Raw Normal View History

2021-09-08 19:43:08 +02:00
{
description = "My awesome system config";
2021-09-15 00:41:46 +02:00
2023-04-05 08:51:06 +02:00
/*
Inputs
*/
2021-09-08 19:43:08 +02:00
inputs = {
# Nix
2022-03-21 13:23:54 +01:00
master.url = "github:nixos/nixpkgs";
2022-03-21 13:23:36 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2023-06-10 10:23:31 +02:00
stable.url = "github:nixos/nixpkgs/nixos-23.05";
2021-09-10 14:00:56 +02:00
2023-02-24 18:42:20 +01:00
flake-utils.url = "github:numtide/flake-utils";
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.url = "github:ryantm/agenix";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
2022-05-26 13:50:03 +02:00
nil.inputs.flake-utils.follows = "flake-utils";
nil.inputs.nixpkgs.follows = "nixpkgs";
nil.url = "github:oxalica/nil";
2022-03-30 10:55:57 +02:00
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
2022-04-18 12:33:07 +02:00
2023-06-27 22:03:38 +02:00
nix-super.url = "github:privatevoid-net/nix-super";
nix-super.inputs.nixpkgs.follows = "stable";
2023-05-29 12:48:43 +02:00
rofi-wayland.url = "github:lbonn/rofi/wayland";
rofi-wayland.flake = false;
# Neovim
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
2022-04-23 17:31:50 +02:00
smartcolumn-nvim.flake = false;
smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim";
2023-07-15 12:29:13 +02:00
telekasten-nvim.flake = false;
telekasten-nvim.url = "github:renerocksai/telekasten.nvim";
2023-09-06 08:58:23 +02:00
telescope-nvim.flake = false;
telescope-nvim.url = "github:nvim-telescope/telescope.nvim";
nvim-treesitter.flake = false;
nvim-treesitter.url = "github:nvim-treesitter/nvim-treesitter/v0.9.1"; # NOTE: to fix weird latest issues
2023-08-11 18:59:52 +02:00
hmts-nvim.flake = false;
hmts-nvim.url = "github:calops/hmts.nvim";
2023-09-06 08:43:03 +02:00
actions-preview-nvim.flake = false;
actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim";
2023-09-06 17:45:31 +02:00
codeium-nvim.url = "github:jcdickinson/codeium.nvim";
codeium-nvim.inputs.nixpkgs.follows = "nixpkgs";
# 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;
2023-08-14 08:46:19 +02:00
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
2021-09-08 19:43:08 +02:00
};
2023-04-05 08:51:06 +02:00
/*
Outputs
*/
2023-05-11 21:48:38 +02:00
outputs = inputs@{ self, nixpkgs, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" ];
2021-09-08 19:43:08 +02:00
2023-05-11 21:48:38 +02:00
forEachSystem = lib.genAttrs systems;
2021-10-05 13:58:06 +02:00
lib = nixpkgs.lib.extend
(self: _: { my = import ./lib { lib = self; }; });
2021-10-05 13:58:06 +02:00
overlay = import ./overlays {
inherit inputs;
inherit (self) lib;
};
2022-12-30 18:58:13 +01:00
2023-05-11 21:48:38 +02:00
config.allowUnfree = true;
overlays = [
2023-01-01 15:27:31 +01:00
inputs.hypr-contrib.overlays.default
2022-12-30 18:58:13 +01:00
inputs.hyprland.overlays.default
inputs.neovim-nightly-overlay.overlay
2023-05-11 21:48:38 +02:00
overlay
2021-09-11 13:15:08 +02:00
];
2023-05-11 21:48:38 +02:00
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
];
2023-05-02 09:04:57 +02:00
};
2022-12-30 18:58:13 +01:00
2023-05-11 21:48:38 +02:00
defaultModules = [
{ nixpkgs = { inherit config; }; }
./modules
inputs.home-manager.nixosModule
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs self; };
};
}
inputs.agenix.nixosModules.age
];
2023-05-11 21:48:38 +02:00
hosts = self.lib.my.mapModules
(path:
let
system = import "${path}/system.nix";
pkgs = pkgsFor system;
in
lib.nixosSystem {
inherit pkgs system lib;
specialArgs = {
2023-05-12 15:14:08 +02:00
inherit inputs self;
2023-05-11 21:48:38 +02:00
};
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;
2021-09-08 19:43:08 +02:00
2023-05-11 21:48:38 +02:00
# ╔══════════════════════════════════════════════════════════╗
# ║ NixOS Configurations ║
# ╚══════════════════════════════════════════════════════════╝
2022-12-23 12:39:24 +01:00
2023-05-11 21:48:38 +02:00
nixosConfigurations = hosts;
2021-10-05 13:58:06 +02:00
2023-05-11 21:48:38 +02:00
# ╔══════════════════════════════════════════════════════════╗
# ║ Other Outputs ║
# ╚══════════════════════════════════════════════════════════╝
2022-10-15 19:05:51 +02:00
2023-05-11 21:48:38 +02:00
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
];
2022-07-15 13:11:54 +02:00
};
2023-05-11 21:48:38 +02:00
});
2022-12-30 18:58:13 +01:00
2023-05-11 21:48:38 +02:00
checks = forEachSystem (system: {
pre-commit-check = pre-commit-check system;
});
2023-05-12 09:45:47 +02:00
legacyPackages = forEachSystem pkgsFor;
2023-05-12 09:45:47 +02:00
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;
};
2021-09-08 19:43:08 +02:00
};
}