clan/flake.nix

251 lines
9.1 KiB
Nix

{
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} ({self, ...}: {
# We define our own systems below. you can still use this to add system specific outputs to your flake.
# See: https://flake.parts/getting-started
systems = ["x86_64-linux"];
# import clan-core modules
imports = [
inputs.clan-core.flakeModules.default
inputs.git-hooks.flakeModule
./clanServices/flake-module.nix
];
perSystem = {
config,
inputs',
pkgs,
...
}: {
devShells = rec {
default = pkgs.mkShell {
inherit (config.pre-commit.devShell) shellHook nativeBuildInputs;
packages = [
inputs'.clan-core.packages.clan-cli
pkgs.alejandra
(pkgs.writeShellApplication {
name = "nix-follows";
text = ''
nix flake metadata --json | jq -r '(.locks.nodes.root.inputs | keys) as $root_input_keys
| .locks.nodes | to_entries[]
| select(.key | IN($root_input_keys[]))
| select((.value | has("flake") | not) or (.value.flake == true))
| select(.value | has("inputs"))
| .key as $parent_key
| .value.inputs | keys[]
| select(IN($root_input_keys[]))
| $parent_key + ".inputs." + . + ".follows = \"" + . + "\";"'
'';
runtimeInputs = [pkgs.jq];
})
(pkgs.writeShellApplication {
name = "blah";
text = ''
'';
runtimeInputs = [];
})
];
};
zola = let
theme = inputs.zola-theme;
themeName = (builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name;
in
pkgs.mkShell {
inputsFrom = [default];
packages = [pkgs.zola];
shellHook = ''
mkdir themes
ln -s ${inputs.zola-theme} themes/${themeName}
'';
};
};
pre-commit.settings.hooks = {
alejandra.enable = true;
check-merge-conflicts.enable = true;
flake-checker.enable = true;
deadnix.enable = true;
nil.enable = true;
};
};
flake = {
templates.rust = {
description = "Crane + Fenix flake with mold for faster local builds.";
path = ./templates/rust;
};
templates.elixir-phoenix = {
description = "A flake for building development environment of Phoenix project.";
path = ./templates/elixir-phoenix;
};
};
# Define your clan
# See: https://docs.clan.lol/reference/nix-api/buildclan/
clan = {
# Clan wide settings. (Required)
meta.name = "cool-clan"; # Ensure to choose a unique name.
specialArgs = {
inherit inputs self;
};
inventory.instances = {
sshd-basic = {
module = {
name = "sshd";
input = "clan-core";
};
roles.server.tags.all = {};
roles.client.tags.all = {};
};
zerotier = {
module = {
name = "zerotier";
input = "clan-core";
};
roles.peer.tags.all = {};
roles.controller.machines.moritz-server = {};
};
user-moritz = {
module = {
name = "users";
input = "clan-core";
};
roles.default.tags.all = {};
roles.default.settings.user = "moritz";
roles.default.settings.groups = [
"wheel"
"networkmanager"
"video"
"input"
];
};
user-mangoiv = {
module = {
name = "users";
input = "clan-core";
};
roles.default.tags.all = {};
roles.default.settings.user = "mangoiv";
roles.default.settings.groups = [
"wheel"
"networkmanager"
"video"
"input"
];
};
user-root = {
module = {
name = "users";
input = "clan-core";
};
roles.default.tags.all = {};
roles.default.settings.user = "root";
};
};
};
});
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
master.url = "github:nixos/nixpkgs";
stable.url = "github:nixos/nixpkgs/nixos-25.05";
mango.url = "git+https://git.mangoiv.com/mangoiv/dotfiles.git";
nixos-hardware.url = "github:nixos/nixos-hardware";
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.2";
# New flake-parts input
flake-parts.url = "github:hercules-ci/flake-parts";
clan-core.url = "git+https://git.clan.lol/clan/clan-core";
clan-core.inputs.nixpkgs.follows = "nixpkgs"; # Needed if your configuration uses nixpkgs unstable.
flake-utils.url = "github:numtide/flake-utils";
git-hooks.url = "github:cachix/git-hooks.nix";
home-manager.url = "github:nix-community/home-manager";
impermanence.url = "github:nix-community/impermanence";
jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-monitored.url = "github:ners/nix-monitored";
nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
nur.url = "github:nix-community/NUR";
treefmt-nix.url = "github:numtide/treefmt-nix";
flake-compat.url = "github:edolstra/flake-compat";
niri.url = "github:sodiboo/niri-flake";
systems.url = "github:nix-systems/default";
stylix.url = "github:nix-community/stylix";
base16-helix.url = "github:MoritzBoehme/base16-helix/fix-primary-cursor-color";
base16-helix.flake = false;
nixarr.url = "github:rasmus-kirk/nixarr";
transmission-protonvpn.url = "github:pborzenkov/transmission-protonvpn-nat-pmp";
# Programs
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
filetags.url = "git+https://gitea.moritzboeh.me/moritz/filetags.git";
rofi-nix.url = "git+https://git.sr.ht/~fgaz/rofi-nix";
rofi.url = "github:davatorium/rofi/next";
rofi.flake = false;
jj.url = "github:gusinacio/jj/lfs"; # HACK: to get lfs support early
# Neovim
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
nixvim.url = "github:nix-community/nixvim";
plenary-nvim.url = "github:nvim-lua/plenary.nvim";
plenary-nvim.flake = false;
# Helix
helix.url = "github:helix-editor/helix";
# 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;
zola-theme.url = "github:Speyll/anemone";
zola-theme.flake = false;
# NOTE: create follows statements with nix-follows
clan-core.inputs.flake-parts.follows = "flake-parts";
clan-core.inputs.systems.follows = "systems";
clan-core.inputs.treefmt-nix.follows = "treefmt-nix";
filetags.inputs.flake-utils.follows = "flake-utils";
filetags.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.inputs.systems.follows = "systems";
git-hooks.inputs.flake-compat.follows = "flake-compat";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
helix.inputs.nixpkgs.follows = "nixpkgs";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
jj.inputs.flake-utils.follows = "flake-utils";
jj.inputs.nixpkgs.follows = "nixpkgs";
jovian.inputs.nixpkgs.follows = "nixpkgs";
neovim-nightly-overlay.inputs.flake-compat.follows = "flake-compat";
neovim-nightly-overlay.inputs.flake-parts.follows = "flake-parts";
neovim-nightly-overlay.inputs.git-hooks.follows = "git-hooks";
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
neovim-nightly-overlay.inputs.treefmt-nix.follows = "treefmt-nix";
niri.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-monitored.inputs.nixpkgs.follows = "nixpkgs";
nixos-mailserver.inputs.flake-compat.follows = "flake-compat";
nixos-mailserver.inputs.git-hooks.follows = "git-hooks";
nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
nixvim.inputs.flake-parts.follows = "flake-parts";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
nixvim.inputs.systems.follows = "systems";
nur.inputs.flake-parts.follows = "flake-parts";
nur.inputs.nixpkgs.follows = "nixpkgs";
rofi-nix.inputs.nixpkgs.follows = "nixpkgs";
stylix.inputs.base16-helix.follows = "base16-helix";
stylix.inputs.flake-parts.follows = "flake-parts";
stylix.inputs.nixpkgs.follows = "nixpkgs";
stylix.inputs.nur.follows = "nur";
stylix.inputs.systems.follows = "systems";
timers.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
}