dotfiles/flake.nix

186 lines
6.0 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";
2024-03-21 17:19:06 +01:00
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";
2024-06-19 09:16:42 +02:00
stable.url = "github:nixos/nixpkgs/nixos-24.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
2024-01-16 12:33:48 +01:00
nix-super.url = "github:privatevoid-net/nix-super";
2024-02-16 11:02:24 +01:00
nix-monitored.url = "github:ners/nix-monitored";
nix-monitored.inputs.nixpkgs.follows = "nixpkgs";
2023-09-27 13:29:34 +02:00
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
2023-09-25 18:29:29 +02:00
# Neovim
2023-11-30 14:46:29 +01:00
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
avante-nvim.flake = false;
avante-nvim.url = "github:yetone/avante.nvim";
2023-09-06 08:58:23 +02:00
2024-08-31 10:14:44 +02:00
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.devshell.follows = "devshell";
nixvim.inputs.flake-parts.follows = "flake-parts";
nixvim.inputs.home-manager.follows = "home-manager";
2024-03-24 13:16:27 +01:00
# river
river.url = "git+https://github.com/riverwm/river?submodules=1";
river.flake = false;
# Hyprland
hypr-contrib.url = "github:hyprwm/contrib";
2024-06-24 09:42:58 +02:00
hyprland = {
type = "git";
url = "https://github.com/hyprwm/Hyprland";
submodules = true;
};
# 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, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
2024-06-17 10:01:08 +02:00
debug = true; # NOTE: for nixd
2023-09-27 12:38:41 +02:00
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, ... }: {
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
2024-08-31 10:14:44 +02:00
nixpkgs-fmt
];
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
};
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 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
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs self; };
2024-08-31 10:14:44 +02:00
sharedModules = [
inputs.nixvim.homeManagerModules.nixvim
];
2023-09-27 13:29:34 +02:00
};
}
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 = {
2024-01-20 13:08:31 +01:00
description = "Simple poetry shell.nix";
2023-11-03 14:14:39 +01:00
path = ./templates/python;
};
2024-01-20 13:08:31 +01:00
rust = {
description = "Crane + Fenix flake with mold for faster local builds.";
path = ./templates/rust;
};
2023-11-03 14:14:39 +01:00
};
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
}