nixos-config/flake.nix

296 lines
8.1 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
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 = {
url = "github:cachix/pre-commit-hooks.nix";
2023-09-13 14:50:03 +02:00
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
nixinate = {
url = "github:MatthewCroughan/nixinate";
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";
flake-utils.follows = "flake-utils";
};
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";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
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 = {
url = "github:Kirottu/anyrun";
inputs.nixpkgs.follows = "nixpkgs";
};
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";
};
};
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";
};
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";
flake-utils.follows = "flake-utils";
naersk.follows = "naersk";
};
2021-11-21 19:07:12 +01:00
};
2022-09-27 20:38:45 +02:00
sunshine = {
2022-10-17 22:19:37 +02:00
url = "git+https://git@git.datarift.nl/erwin/sunshine.git?ref=main";
2023-09-13 14:50:03 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
2022-09-27 20:38:45 +02:00
};
2021-11-12 07:23:46 +01:00
};
2021-10-05 23:45:02 +02:00
outputs =
{ self
, sops
, ha-now-playing
, pamedia
, nixinate
, flake-parts
, ...
} @ inputs:
with inputs; let
machines = import ./machines inputs;
defSystem = system: baseConfig: deployConfig:
nixpkgs.lib.nixosSystem {
system = "${system}";
modules = [
{ _module.args.inputs = inputs; }
2022-05-19 21:39:19 +02:00
{ _module.args.self-overlay = self.overlays.default; }
({ ... }: {
imports =
builtins.attrValues self.nixosModules
++ [
{
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
2022-11-22 17:33:35 +01:00
nixpkgs =
{
overlays = [
self.overlays.default
ha-now-playing.overlays.${system}
pamedia.overlays.${system}
2023-04-10 23:30:53 +02:00
emacs-overlay.overlay
nil.overlays.default
2023-07-10 13:42:25 +02:00
inputs.eww.overlays.default
inputs.rust-overlay.overlays.default
2022-11-22 17:33:35 +01:00
] ++ nixpkgs.lib.optional (system == "aarch64-linux")
(_final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
});
config = {
allowUnfree = true;
2023-09-11 20:16:40 +02:00
firefox.speechSynthesisSupport = true;
};
2022-11-22 17:33:35 +01:00
};
}
baseConfig
home-manager.nixosModules.home-manager
2023-05-23 17:10:45 +02:00
{
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
};
}
];
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
nix.registry.nixpkgs.flake = nixpkgs;
})
sops.nixosModules.sops
2023-04-10 23:30:53 +02:00
sunshine.nixosModules.sunshine
] ++ (nixpkgs.lib.optional (deployConfig != null) { _module.args.nixinate = deployConfig; })
;
};
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
flake = {
overlays.default = import ./overlays;
nixosModules = builtins.listToAttrs (map
(x: {
name = x;
value = import (./modules + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules)));
nixosConfigurations = builtins.listToAttrs (map
(machine: {
name = machine;
value = defSystem (machines.${machine}.system or "x86_64-linux")
{
imports = [
machines.${machine}.config
];
}
(machines.${machine}.deploy or null);
})
(builtins.attrNames machines));
apps = nixinate.nixinate.x86_64-linux self;
};
perSystem = { self', pkgs, system, lib, ... }:
2022-11-11 20:38:33 +01:00
{
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
deadnix.enable = true;
statix.enable = true;
black.enable = true;
shellcheck = {
enable = true;
types_or = [ "executable" ];
};
shfmt.enable = true;
};
};
2022-12-06 15:40:12 +01:00
2023-01-31 16:58:29 +01:00
};
2022-05-30 14:52:02 +02:00
devShells.default = with pkgs;
mkShell {
inherit (self'.checks.pre-commit-check) shellHook;
name = "dotfiles";
packages = [
2022-05-30 14:52:02 +02:00
pkgs.sops
2022-09-07 22:59:08 +02:00
ssh-to-age
age
nodejs
nodePackages.typescript-language-server
2022-09-07 22:59:08 +02:00
nodePackages.yaml-language-server
2022-11-08 09:46:07 +01:00
nodePackages.vscode-css-languageserver-bin
2023-06-01 16:59:39 +02:00
nodePackages.prettier
multimarkdown
nix-diff
nix-prefetch
nix-prefetch-scripts
nix-prefetch-github
nix-prefetch-docker
nix-top
2023-10-09 14:35:09 +02:00
opentofu
2023-01-06 00:11:11 +01:00
terraform-ls
2023-02-03 14:32:00 +01:00
taplo
2023-04-19 09:36:35 +02:00
just
2023-07-19 14:07:31 +02:00
pciutils
2023-09-11 20:16:40 +02:00
(cryptsetup.override {
withInternalArgon2 = true;
})
2023-01-17 13:53:25 +01:00
disko.packages.${system}.disko
2022-05-30 14:52:02 +02:00
];
};
2023-01-17 13:57:19 +01:00
devShells.install = with pkgs; mkShell {
name = "install";
packages = [
2023-01-17 13:57:19 +01:00
disko.packages.${system}.disko
];
};
formatter = pkgs.nixpkgs-fmt;
};
};
2021-10-05 23:45:02 +02:00
}