nixos-config/flake.nix

326 lines
8.3 KiB
Nix
Raw Normal View History

2021-10-05 23:45:02 +02:00
{
description = "System config";
inputs = {
2021-11-12 17:10:17 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2021-10-05 23:45:02 +02:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-11-12 07:23:46 +01:00
flake-utils.url = "github:numtide/flake-utils";
2021-10-05 23:45:02 +02:00
2024-08-19 22:30:04 +02:00
flake-parts.url = "github:hercules-ci/flake-parts";
2022-10-05 11:32:13 +02:00
nixos-hardware.url = "github:NixOS/nixos-hardware";
pre-commit-hooks = {
2024-04-16 19:41:12 +02:00
url = "github:cachix/git-hooks.nix";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
2024-04-16 19:32:32 +02:00
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-01-24 11:17:44 +01:00
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
};
2022-01-24 11:17:44 +01:00
};
2023-01-27 15:36:05 +01:00
microvm = {
url = "github:astro/microvm.nix";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
2023-01-27 15:36:05 +01:00
};
2021-11-26 22:21:16 +01:00
sops = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-02-09 08:13:16 +01:00
emacs-overlay = {
url = "github:nix-community/emacs-overlay/ed670c7246dd4bfd24e50939eb5d9bcaa95e638b";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
};
2022-02-09 08:13:16 +01:00
};
2022-11-22 17:33:35 +01:00
nil = {
url = "github:oxalica/nil";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
rust-overlay.follows = "rust-overlay";
};
2022-11-22 17:33:35 +01:00
};
2023-01-17 13:45:37 +01:00
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-11-22 17:33:35 +01:00
2023-07-10 13:42:25 +02:00
eww = {
url = "github:elkowar/eww";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
rust-overlay.follows = "rust-overlay";
};
2023-07-10 13:42:25 +02:00
};
anyrun = {
flake.lock: Update Flake lock file updates: • Updated input 'disko': 'github:nix-community/disko/341482e2f4d888e3f60cae1c12c3df896e7230d8?narHash=sha256-i%2BUw8VOHzQe9YdNwKRbzvaPWLE07tYVqUDzSFTXhRgk%3D' (2024-11-27) → 'github:nix-community/disko/2814a5224a47ca19e858e027f7e8bff74a8ea9f1?narHash=sha256-2uMaVAZn7fiyTUGhKgleuLYe5%2BEAAYB/diKxrM7g3as%3D' (2024-11-30) • Updated input 'home-manager': 'github:nix-community/home-manager/0941a2e14486ee30e2088afa1d2869f2486dd3b8?narHash=sha256-04V/vZK7Eca2EbEJNqKHUSa0RU5zXt15t03EdO0yEqs%3D' (2024-11-28) → 'github:nix-community/home-manager/d2e2bda6c050a61d51b8e395ad66b8fa48318e07?narHash=sha256-eZcDctzoDsdHAooCYc2uDwoAdt0weTYfNChtrAhJFN8%3D' (2024-12-02) • Updated input 'microvm': 'github:astro/microvm.nix/093ef734d3c37669860043a87dbf1c09fc6f5b38?narHash=sha256-6LmtOmeDpv9iHS8l0GNcppP11dKIJFMZLdFyxQ%2BqQBM%3D' (2024-11-26) → 'github:astro/microvm.nix/e8d5f12b834a59187c7ec147a8952a0567f97939?narHash=sha256-ratU5qCcRuOojgPWM90gda4qrxukNqbyFi%2Bkan2Ln04%3D' (2024-11-30) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/45348ad6fb8ac0e8415f6e5e96efe47dd7f39405?narHash=sha256-kF6rDeCshoCgmQz%2B7uiuPdREVFuzhIorGOoPXMalL2U%3D' (2024-11-24) → 'github:NixOS/nixos-hardware/fe01780d356d70fd119a19277bff71d3e78dad00?narHash=sha256-aQorWITXZu7b095UwnpUvcGt9dNJie/GO9r4hZfe2sU%3D' (2024-12-01) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/4633a7c72337ea8fd23a4f2ba3972865e3ec685d?narHash=sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0%3D' (2024-11-25) → 'github:nixos/nixpkgs/ac35b104800bff9028425fec3b6e8a41de2bbfff?narHash=sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE%2Bcrk%3D' (2024-12-01) • Updated input 'rust-overlay': 'github:oxalica/rust-overlay/fd0e3bf854b937632c92819d55d4ff8a130d5658?narHash=sha256-A2a4Cw66421Wojv1uqSGkD1XW960uJ7wHuwmvGCUJ8s%3D' (2024-11-28) → 'github:oxalica/rust-overlay/e66c0d43abf5bdefb664c3583ca8994983c332ae?narHash=sha256-aJmAIjZfWfPSWSExwrYBLRgXVvgF5LP1vaeUGOOIQ98%3D' (2024-12-02) • Updated input 'sops': 'github:Mic92/sops-nix/3433ea14fbd9e6671d0ff0dd45ed15ee4c156ffa?narHash=sha256-xtt95%2Bc7OUMoqZf4OvA/7AemiH3aVuWHQbErYQoPwFk%3D' (2024-11-25) → 'github:Mic92/sops-nix/c6134b6fff6bda95a1ac872a2a9d5f32e3c37856?narHash=sha256-m6/qwJAJYcidGMEdLqjKzRIjapK4nUfMq7rDCTmZajc%3D' (2024-12-02) • Updated input 'treefmt-nix': 'github:numtide/treefmt-nix/84637a7ab04179bdc42aa8fd0af1909fba76ad0c?narHash=sha256-uI7TXEb231o8dkwB5AUCecx3AQtosRmL6hKgnckvjps%3D' (2024-11-26) → 'github:numtide/treefmt-nix/6209c381904cab55796c5d7350e89681d3b2a8ef?narHash=sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII%2BoAc%3D' (2024-11-29)
2024-11-28 11:38:03 +01:00
url = "github:anyrun-org/anyrun";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-03-16 22:38:29 +01:00
colmena = {
# url = "github:zhaofengli/colmena";
url = "github:pks-t/colmena/pks-nix-eval-job-fix-patch";
2024-03-16 22:38:29 +01:00
inputs.nixpkgs.follows = "nixpkgs";
};
2024-09-20 11:49:45 +02:00
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
2024-04-10 21:34:05 +02:00
comin = {
url = "github:nlewo/comin";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-12-03 20:02:13 +01:00
caddy-nix = {
url = "github:vincentbernat/caddy-nix";
};
ghostty = {
2024-12-12 09:14:51 +01:00
url = "git+https://git.datarift.nl/erwin/ghostty.git?ref=main";
};
caddy-with-plugins = {
url = "github:eboskma/caddy-with-plugins";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
treefmt-nix.follows = "treefmt-nix";
2023-09-13 14:50:03 +02:00
};
};
2021-11-21 19:07:12 +01:00
ha-now-playing = {
2022-03-18 21:14:51 +01:00
url = "git+https://git.datarift.nl/erwin/ha-now-playing.git?ref=main";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
rust-overlay.follows = "rust-overlay";
pre-commit-hooks.follows = "pre-commit-hooks";
2024-12-02 14:50:29 +01:00
treefmt-nix.follows = "treefmt-nix";
2023-09-13 14:50:03 +02:00
};
2021-11-21 19:07:12 +01:00
};
2021-10-05 23:45:02 +02:00
2021-11-21 19:07:12 +01:00
pamedia = {
2022-03-18 21:14:51 +01:00
url = "git+https://git.datarift.nl/erwin/pamedia-rs.git?ref=main";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
2024-08-19 22:30:04 +02:00
flake-parts.follows = "flake-parts";
rust-overlay.follows = "rust-overlay";
2023-09-13 14:50:03 +02:00
};
2021-11-21 19:07:12 +01:00
};
2021-11-12 07:23:46 +01:00
};
2021-10-05 23:45:02 +02:00
outputs =
{
self,
sops,
flake-parts,
...
}@inputs:
with inputs;
let
machines = import ./machines inputs;
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
2024-04-16 19:32:32 +02:00
imports = [
inputs.pre-commit-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
flake = {
lib = import ./lib inputs;
2024-12-13 11:12:16 +01:00
overlays.default = import ./overlays inputs;
nixosModules = builtins.listToAttrs (
2024-03-11 17:47:04 +01:00
map (x: {
name = x;
value = import (./modules + "/${x}");
}) (builtins.attrNames (builtins.readDir ./modules))
);
nixosConfigurations = builtins.listToAttrs (
2024-03-11 17:47:04 +01:00
map (machine: {
name = machine;
value = self.lib.defSystem (machines.${machine}.system or "x86_64-linux") {
imports = [ machines.${machine}.config ];
} (machines.${machine}.deploy or null);
}) (builtins.attrNames machines)
);
colmenaHive = inputs.colmena.lib.makeHive self.outputs.colmena;
colmena =
{
2023-10-14 16:55:13 +02:00
meta = {
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
specialArgs = {
inherit nixpkgs;
};
};
}
// builtins.listToAttrs (
2024-03-11 17:47:04 +01:00
map (machine: {
name = machine;
value = {
deployment = {
targetHost = machines.${machine}.deploy.host;
targetUser = "root"; # machines.${machine}.deploy.sshUser;
# targetUser = machines.${machine}.deploy.sshUser;
tags = machines.${machine}.deploy.tags or [ ];
};
2024-03-11 17:47:04 +01:00
imports = self.lib.systemModules (machines.${machine}.system or "x86_64-linux"
) machines.${machine}.config;
};
}) (builtins.filter (machine: machines.${machine} ? deploy) (builtins.attrNames machines))
);
};
perSystem =
{
inputs',
pkgs,
config,
2024-10-03 08:36:01 +02:00
system,
...
}:
{
2024-01-10 21:53:04 +01:00
2024-10-03 08:36:01 +02:00
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
2024-01-10 21:53:04 +01:00
pre-commit = {
settings = {
hooks = {
nixfmt-rfc-style.enable = true;
2024-01-10 21:53:04 +01:00
deadnix.enable = true;
black.enable = true;
shellcheck = {
enable = true;
types_or = [ "executable" ];
};
2024-01-10 21:53:04 +01:00
shfmt.enable = true;
};
2023-12-23 20:20:04 +01:00
};
2024-01-10 21:53:04 +01:00
};
2023-12-23 20:20:04 +01:00
2024-04-16 19:32:32 +02:00
treefmt = {
projectRootFile = "flake.lock";
programs = {
black.enable = true;
deadnix.enable = true;
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
shellcheck.enable = true;
shfmt = {
enable = true;
indent_size = 0;
};
2024-04-16 19:32:32 +02:00
};
};
2024-01-10 21:53:04 +01:00
packages = {
2024-07-03 11:29:57 +02:00
dnspyre = pkgs.callPackage ./pkgs/dnspyre { };
2024-10-03 08:36:01 +02:00
git-repo-go = pkgs.git-repo-go;
hassbridge = pkgs.callPackage ./pkgs/hassbridge { };
2024-10-21 23:27:03 +02:00
mapshot = pkgs.mapshot;
2024-12-03 20:02:13 +01:00
pds = pkgs.pds;
pdsadmin = pkgs.pdsadmin;
2024-09-26 11:27:34 +02:00
peakperf = pkgs.callPackage ./pkgs/peakperf { };
2024-05-20 14:21:00 +02:00
tinyows = pkgs.callPackage ./pkgs/tinyows { };
2024-09-05 21:02:28 +02:00
tsui = pkgs.callPackage ./pkgs/tsui { };
2024-01-10 21:53:04 +01:00
};
devShells.default =
with pkgs;
mkShell {
name = "dotfiles";
packages = [
age
config.packages.git-repo-go
2024-09-10 19:26:59 +02:00
fontpreview
2024-03-16 22:38:29 +01:00
inputs'.colmena.packages.colmena
just
2024-05-08 15:53:38 +02:00
libxkbcommon
2024-04-23 16:32:38 +02:00
lswt
multimarkdown
nix-diff
2024-03-11 17:53:56 +01:00
nix-init
2024-03-28 16:10:24 +01:00
nix-output-monitor
nix-prefetch
nix-prefetch-docker
nix-prefetch-github
nix-prefetch-scripts
nix-tree
2024-03-28 16:10:24 +01:00
nix-update
2024-03-11 17:53:56 +01:00
nixfmt-rfc-style
2024-03-28 16:10:24 +01:00
nodejs
nodePackages.typescript-language-server
nodePackages.yaml-language-server
nodePackages.prettier
2024-02-29 14:23:22 +01:00
openssl
pciutils
pkgs.sops
2024-12-03 20:02:13 +01:00
python3Packages.websocket-client
ssh-to-age
taplo
2024-04-26 11:28:23 +02:00
yj
inputs'.disko.packages.disko
];
shellHook = ''
${config.pre-commit.installationScript}
'';
};
2023-01-17 13:57:19 +01:00
devShells.install =
with pkgs;
mkShell {
name = "install";
packages = [ inputs'.disko.packages.disko ];
};
2024-01-10 21:53:04 +01:00
};
};
2021-10-05 23:45:02 +02:00
}