2023-04-23 22:35:23 +02:00
|
|
|
{
|
|
|
|
description = "c8h4.io NixOS configuration";
|
|
|
|
|
|
|
|
inputs = {
|
2023-07-04 15:43:37 +02:00
|
|
|
nixpkgs = {
|
|
|
|
type = "github";
|
|
|
|
owner = "NixOS";
|
|
|
|
repo = "nixpkgs";
|
|
|
|
ref = "refs/heads/nixos-unstable";
|
2024-05-07 11:42:36 +02:00
|
|
|
rev = "43bd0ae390a1351d8c6eea85d8243e884987f200"; # 30-04-2024
|
2023-07-04 15:43:37 +02:00
|
|
|
};
|
2024-04-22 11:41:41 +02:00
|
|
|
home-manager = {
|
|
|
|
type = "github";
|
|
|
|
owner = "nix-community";
|
|
|
|
repo = "home-manager";
|
|
|
|
ref = "refs/heads/master";
|
2024-05-07 11:42:36 +02:00
|
|
|
rev = "2b87a11125f988a9f67ee63eeaa3682bc841d9b5"; # 06-05-2024
|
2024-04-22 11:41:41 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-05-07 01:00:09 +02:00
|
|
|
nixos-hardware = {
|
|
|
|
type = "github";
|
|
|
|
owner = "NixOS";
|
|
|
|
repo = "nixos-hardware";
|
|
|
|
ref = "refs/heads/master";
|
|
|
|
rev = "68d680c1b7c0e67a9b2144d6776583ee83664ef4"; # 30-04-2024
|
|
|
|
};
|
|
|
|
nixpkgs-sourcehut = {
|
|
|
|
type = "github";
|
|
|
|
owner = "christoph-heiss";
|
|
|
|
repo = "nixpkgs";
|
|
|
|
ref = "refs/heads/sourcehut-fix";
|
|
|
|
rev = "6729c6c653f17a5f9f1dcf5439d3e98652406042";
|
|
|
|
};
|
|
|
|
simple-nixos-mailserver = {
|
|
|
|
type = "gitlab";
|
|
|
|
owner = "simple-nixos-mailserver";
|
|
|
|
repo = "nixos-mailserver";
|
|
|
|
ref = "refs/heads/master";
|
|
|
|
rev = "c63f6e7b053c18325194ff0e274dba44e8d2271e"; # 21-07-2023
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-04-22 11:41:41 +02:00
|
|
|
nixgl = {
|
|
|
|
type = "github";
|
|
|
|
owner = "guibou";
|
|
|
|
repo = "nixGL";
|
|
|
|
ref = "refs/heads/main";
|
|
|
|
rev = "d709a8abcde5b01db76ca794280745a43c8662be"; # 19-03-2024
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
};
|
2023-04-23 22:35:23 +02:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-10-30 17:15:06 +01:00
|
|
|
treefmt-nix = {
|
|
|
|
url = "github:numtide/treefmt-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-05-07 01:00:09 +02:00
|
|
|
nixinate = {
|
|
|
|
url = "github:MatthewCroughan/nixinate";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
sops-nix = {
|
|
|
|
type = "github";
|
|
|
|
owner = "Mic92";
|
|
|
|
repo = "sops-nix";
|
|
|
|
ref = "refs/heads/master";
|
|
|
|
rev = "09f1bc8ba3277c0f052f7887ec92721501541938"; # 21-04-2024
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nixpkgs-stable.follows = "nixpkgs";
|
|
|
|
};
|
2023-04-23 22:35:23 +02:00
|
|
|
};
|
|
|
|
|
2024-05-07 01:00:09 +02:00
|
|
|
outputs = { self, nixpkgs, home-manager, nixos-hardware, nixpkgs-sourcehut
|
|
|
|
, simple-nixos-mailserver, nixgl, flake-utils, treefmt-nix, nixinate
|
|
|
|
, sops-nix }:
|
2024-01-23 12:42:16 +01:00
|
|
|
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
2023-10-30 17:15:06 +01:00
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
|
|
|
treefmt = treefmt-nix.lib.evalModule pkgs {
|
|
|
|
projectRootFile = "flake.nix";
|
|
|
|
programs = {
|
|
|
|
deadnix.enable = true;
|
2024-05-07 01:00:09 +02:00
|
|
|
nixfmt.enable = true;
|
|
|
|
prettier.enable = true;
|
2023-10-30 17:15:06 +01:00
|
|
|
shellcheck.enable = true;
|
2024-05-07 01:00:09 +02:00
|
|
|
statix.enable = true;
|
|
|
|
stylua.enable = true;
|
2023-10-30 17:15:06 +01:00
|
|
|
};
|
2023-08-08 21:06:33 +02:00
|
|
|
};
|
2023-10-30 17:15:52 +01:00
|
|
|
|
2024-04-22 11:41:41 +02:00
|
|
|
mkHomeManagerFlake = name:
|
|
|
|
pkgs.writeShellScript "hm-flake-${name}" ''
|
2023-11-09 11:10:02 +01:00
|
|
|
set -x
|
2024-04-22 11:41:41 +02:00
|
|
|
${pkgs.home-manager}/bin/home-manager switch --flake .#${name} -b bak
|
2023-10-31 09:16:35 +01:00
|
|
|
'';
|
|
|
|
|
2023-10-30 17:15:06 +01:00
|
|
|
in {
|
2024-05-07 01:00:09 +02:00
|
|
|
apps = (nixinate.nixinate.${system} self).nixinate // {
|
2023-10-31 09:16:35 +01:00
|
|
|
maui = {
|
|
|
|
type = "app";
|
2024-04-22 11:41:41 +02:00
|
|
|
program = "${mkHomeManagerFlake "maui"}";
|
2023-10-31 09:16:35 +01:00
|
|
|
};
|
|
|
|
};
|
2023-10-30 17:15:52 +01:00
|
|
|
|
2024-01-18 00:27:29 +01:00
|
|
|
checks = {
|
|
|
|
formatting = treefmt.config.build.check self;
|
2024-04-21 02:31:44 +02:00
|
|
|
} // (import ./pkgs { } pkgs)
|
|
|
|
// (import ./pkgs/vim-plugins.nix { } pkgs);
|
2024-01-18 00:27:29 +01:00
|
|
|
|
2023-10-30 17:15:06 +01:00
|
|
|
formatter = treefmt.config.build.wrapper;
|
|
|
|
|
2024-05-07 01:00:09 +02:00
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
inputsFrom = [ treefmt.config.build.devShell ];
|
2024-05-13 18:42:37 +02:00
|
|
|
nativeBuildInputs = with pkgs; [ age nix-tree sops ];
|
2024-05-07 01:00:09 +02:00
|
|
|
};
|
|
|
|
}) // (let
|
|
|
|
overlays = [
|
|
|
|
(import ./pkgs)
|
|
|
|
(self: super: {
|
|
|
|
vimPlugins = super.vimPlugins
|
|
|
|
// (import ./pkgs/vim-plugins.nix self super);
|
|
|
|
inherit (import nixpkgs-sourcehut { inherit (super) system; })
|
|
|
|
sourcehut;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
machines = {
|
|
|
|
back = { };
|
|
|
|
fort = { };
|
|
|
|
tank.extraModules = [{
|
|
|
|
disabledModules = [ "services/misc/sourcehut" ];
|
|
|
|
imports =
|
|
|
|
[ "${nixpkgs-sourcehut}/nixos/modules/services/misc/sourcehut" ];
|
|
|
|
}];
|
|
|
|
trek.extraModules =
|
|
|
|
[ nixos-hardware.nixosModules.framework-12th-gen-intel ];
|
|
|
|
zero = { };
|
|
|
|
};
|
|
|
|
mkSystem = name:
|
|
|
|
{ extraModules ? [ ], system ? "x86_64-linux" }:
|
|
|
|
nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
simple-nixos-mailserver.nixosModules.mailserver
|
|
|
|
{ nixpkgs = { inherit overlays; }; }
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
# who doesn't love a bit of composability
|
|
|
|
({ config, ... }: {
|
|
|
|
_module.args = {
|
|
|
|
inherit (config.sops) secrets;
|
|
|
|
my = import ./secrets/my.nix;
|
|
|
|
nixinate = {
|
|
|
|
host = name;
|
|
|
|
sshUser = "christoph";
|
|
|
|
buildOn = "local";
|
|
|
|
substituteOnTarget = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imports = [ (./machines + "/${name}.nix") ];
|
|
|
|
networking.hostName = name;
|
|
|
|
sops.age = {
|
|
|
|
sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
|
|
|
keyFile = "/var/lib/sops-nix/key.txt";
|
|
|
|
generateKey = true;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
] ++ (builtins.attrValues self.nixosModules) ++ extraModules;
|
|
|
|
};
|
2024-04-22 11:41:41 +02:00
|
|
|
in {
|
|
|
|
homeConfigurations.maui = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
overlays = overlays ++ [ nixgl.overlay ];
|
|
|
|
};
|
|
|
|
|
|
|
|
modules = [ ./machines/maui.nix ];
|
|
|
|
};
|
2024-05-07 01:00:09 +02:00
|
|
|
|
|
|
|
nixosConfigurations = builtins.mapAttrs mkSystem machines;
|
|
|
|
nixosModules = import ./modules;
|
2023-08-08 21:06:33 +02:00
|
|
|
});
|
2023-04-23 22:35:23 +02:00
|
|
|
}
|