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";
2022-11-26 11:37:59 +01:00
stable.url = "github:nixos/nixpkgs/nixos-22.11";
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";
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";
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
# Neovim
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
2022-04-23 17:31:50 +02:00
bufferline-nvim.flake = false;
bufferline-nvim.url = "github:akinsho/bufferline.nvim";
2022-11-25 10:24:29 +01:00
cmp-async-path.url = "github:FelipeLema/cmp-async-path";
cmp-async-path.flake = false;
2022-12-23 12:39:24 +01:00
comment-box-nvim.flake = false;
comment-box-nvim.url = "github:LudoPinelli/comment-box.nvim";
2023-02-17 12:31:31 +01:00
copilot-lua.flake = false;
copilot-lua.url = "github:zbirenbaum/copilot.lua";
2023-02-17 13:01:11 +01:00
gitignore-nvim.flake = false;
gitignore-nvim.url = "github:wintermute-cell/gitignore.nvim";
2023-02-17 22:19:47 +01:00
lspsaga-nvim.flake = false;
lspsaga-nvim.url = "github:glepnir/lspsaga.nvim";
2023-04-17 14:37:06 +02:00
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;
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
};
}