dotfiles/flake.nix

231 lines
7.6 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
2021-09-08 19:43:08 +02:00
inputs = {
# Nix
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.url = "github:ryantm/agenix";
2023-09-27 13:29:34 +02:00
devshell.url = "github:numtide/devshell";
disko.url = "github:nix-community/disko";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
2023-09-27 13:29:34 +02:00
impermanence.url = "github:nix-community/impermanence";
master.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
2023-09-27 13:29:34 +02:00
stable.url = "github:nixos/nixpkgs/nixos-23.05";
2023-10-10 11:51:41 +02:00
nur.url = "github:nix-community/NUR";
2023-10-10 11:50:54 +02:00
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
2022-04-18 12:33:07 +02:00
2023-09-27 13:29:34 +02:00
# Programs
2023-11-30 14:46:29 +01:00
nix-super.url = "github:privatevoid-net/nix-super/c076362db8b438c921d9bbe196ede50205f788c6";
rofi-wayland.flake = false;
2023-09-27 13:29:34 +02:00
rofi-wayland.url = "github:lbonn/rofi/wayland";
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
2023-09-25 18:29:29 +02:00
# Neovim
2023-09-27 13:29:34 +02:00
actions-preview-nvim.flake = false;
actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim";
hmts-nvim.flake = false;
hmts-nvim.url = "github:calops/hmts.nvim";
2023-11-30 14:46:29 +01:00
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
2023-09-27 13:29:34 +02:00
nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim";
nvim-lspconfig.flake = false;
nvim-lspconfig.url = "github:neovim/nvim-lspconfig";
nvim-puppeteer.flake = false;
nvim-puppeteer.url = "github:chrisgrieser/nvim-puppeteer";
nvim-treesitter.flake = false;
nvim-treesitter.url = "github:nvim-treesitter/nvim-treesitter/v0.9.1"; # NOTE: to fix weird latest issues
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-10-08 13:32:42 +02:00
none-ls-nvim.flake = false;
none-ls-nvim.url = "github:nvimtools/none-ls.nvim";
2023-10-27 19:31:03 +02:00
neotest-python.flake = false;
neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search";
2023-11-30 14:46:29 +01:00
statuscol-nvim.flake = false;
statuscol-nvim.url = "github:luukvbaal/statuscol.nvim/0.10"; # HACK: fix for neovim-nightly
gen-nvim.flake = false;
gen-nvim.url = "github:David-Kunz/gen.nvim";
2023-09-06 08:58:23 +02:00
# 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-09-27 12:38:41 +02:00
outputs = inputs@{ self, flake-parts, ... }:
2023-05-11 21:48:38 +02:00
let
2023-09-27 12:38:41 +02:00
defaultOverlays = [
2023-01-01 15:27:31 +01:00
inputs.hypr-contrib.overlays.default
2023-09-27 13:29:34 +02:00
self.overlays.default
];
finalOverlays = defaultOverlays ++ [
(
_: prev: {
master = import inputs.master {
inherit (prev) system;
overlays = defaultOverlays;
};
stable = import inputs.stable {
inherit (prev) system;
overlays = defaultOverlays;
};
2023-10-10 11:51:41 +02:00
nur = import inputs.nur {
pkgs = prev;
nurpkgs = prev;
};
2023-09-27 13:29:34 +02:00
}
)
2021-09-11 13:15:08 +02:00
];
2023-09-27 12:38:41 +02:00
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.pre-commit-hooks.flakeModule
inputs.devshell.flakeModule
];
2022-12-30 18:58:13 +01:00
2023-09-27 12:38:41 +02:00
systems = [ "x86_64-linux" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
_module.args.pkgs =
import inputs.nixpkgs {
inherit system;
overlays = finalOverlays;
};
2023-09-27 12:38:41 +02:00
devshells.default = {
devshell.startup.pre-commit-hook.text = config.pre-commit.installationScript;
commands = [
{
name = "agenix";
help = "wrapper around agenix";
command = ''
sudo EDITOR="${pkgs.lib.getExe pkgs.vim}" ${pkgs.lib.getExe' inputs'.agenix.packages.default "agenix"} --identity /etc/ssh/ssh_host_ed25519_key "$@"
'';
}
{
2023-10-28 15:19:29 +02:00
name = "build";
2023-09-27 12:38:41 +02:00
help = "use nom to build system";
command =
''
nom build --no-link ".#nixosConfigurations.$(hostname).config.system.build.toplevel" $@
'';
}
{
2023-10-28 15:19:29 +02:00
name = "apply";
2023-09-27 12:38:41 +02:00
help = "wrapper for nixos-rebuild switch";
command = "sudo nixos-rebuild switch --flake . $@";
}
{
2023-10-28 15:19:29 +02:00
name = "test";
2023-09-27 12:38:41 +02:00
help = "wrapper for nixos-rebuild switch";
command = "sudo nixos-rebuild test --flake . $@";
}
{
2023-10-28 15:19:29 +02:00
name = "boot";
2023-09-27 12:38:41 +02:00
help = "wrapper for nixos-rebuild switch";
command = "sudo nixos-rebuild boot --flake . $@";
}
];
packages = with pkgs; [
stylua
sumneko-lua-language-server
];
2023-09-27 12:38:41 +02:00
};
pre-commit = {
check.enable = true;
settings = {
hooks = {
nixpkgs-fmt.enable = true;
statix.enable = true;
shellcheck.enable = true;
stylua.enable = true;
2023-05-11 21:48:38 +02:00
};
2023-09-27 12:38:41 +02:00
};
2023-05-11 21:48:38 +02:00
};
2021-09-08 19:43:08 +02:00
2023-09-27 12:38:41 +02:00
legacyPackages = pkgs;
2022-12-23 12:39:24 +01:00
2023-09-27 12:38:41 +02:00
packages =
self.lib.filterAttrs (_: self.lib.isDerivation)
2023-09-27 13:29:34 +02:00
(self.overlays.default pkgs pkgs);
2023-09-27 12:38:41 +02:00
};
2021-10-05 13:58:06 +02:00
2023-09-27 12:38:41 +02:00
flake = {
lib = inputs.nixpkgs.lib.extend
(self: _: { my = import ./lib { lib = self; }; });
2022-10-15 19:05:51 +02:00
2023-09-27 13:29:34 +02:00
overlays.default = import ./overlays {
2023-09-27 12:38:41 +02:00
inherit inputs;
inherit (self) lib;
2023-05-12 09:45:47 +02:00
};
2023-09-27 12:38:41 +02:00
nixosConfigurations = self.lib.my.mapModules
2023-09-27 13:29:34 +02:00
(path: self.lib.nixosSystem {
inherit (self) lib;
specialArgs = {
inherit inputs self;
};
modules =
[
./modules
{
nixpkgs = {
overlays = finalOverlays;
config.allowUnfree = true;
};
}
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs self; };
sharedModules = [ inputs.nix-lazy-nvim.homeManagerModules.default ];
};
}
inputs.agenix.nixosModules.age
inputs.disko.nixosModules.default
inputs.home-manager.nixosModule
inputs.impermanence.nixosModules.impermanence
2023-10-10 11:50:54 +02:00
inputs.nix-index-database.nixosModules.nix-index
2023-09-27 13:29:34 +02:00
path
];
})
2023-09-27 12:38:41 +02:00
./hosts;
2023-11-03 14:14:39 +01:00
templates = {
python = {
path = ./templates/python;
};
};
2023-09-27 12:38:41 +02:00
};
2021-09-08 19:43:08 +02:00
};
2023-09-23 09:50:12 +02:00
nixConfig = {
extra-substituters = [
"https://hyprland.cachix.org"
"https://nix-community.cachix.org"
"https://pre-commit-hooks.cachix.org"
];
extra-trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
];
};
2021-09-08 19:43:08 +02:00
}