2024-11-22 00:58:04 -05:00
|
|
|
{
|
2024-11-22 20:46:58 -05:00
|
|
|
description = "cy's flake";
|
2024-11-22 00:58:04 -05:00
|
|
|
|
|
|
|
inputs = {
|
2024-12-12 23:35:10 -05:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2024-11-23 21:41:28 -05:00
|
|
|
sops-nix = {
|
|
|
|
url = "github:Mic92/sops-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-11-30 20:24:04 -05:00
|
|
|
home-manager = {
|
|
|
|
url = "github:nix-community/home-manager";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2025-01-01 21:46:36 -05:00
|
|
|
treefmt = {
|
|
|
|
url = "github:numtide/treefmt-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-12-28 22:16:46 -05:00
|
|
|
disko = {
|
|
|
|
url = "github:nix-community/disko/latest";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2025-01-01 02:07:32 -05:00
|
|
|
lanzaboote = {
|
|
|
|
url = "github:nix-community/lanzaboote/v0.4.1";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2025-01-05 05:42:52 -05:00
|
|
|
attic = {
|
2025-01-08 23:43:31 -05:00
|
|
|
url = "github:cything/attic/compression";
|
2025-01-05 05:42:52 -05:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-12-28 22:16:46 -05:00
|
|
|
|
2024-12-30 17:50:29 -05:00
|
|
|
nixpkgs-borg.url = "github:cything/nixpkgs/borg"; # unmerged PR
|
|
|
|
nixpkgs-btrbk.url = "github:cything/nixpkgs/btrbk"; # unmerged PR
|
2024-11-22 00:58:04 -05:00
|
|
|
};
|
|
|
|
|
2025-01-05 06:11:02 -05:00
|
|
|
nixConfig = {
|
|
|
|
extra-substituters = [
|
2025-01-05 07:03:26 -05:00
|
|
|
"https://cache.cything.io/central"
|
2025-01-08 23:43:31 -05:00
|
|
|
"https://cache.cything.io/infra-ci"
|
|
|
|
"https://cache.cything.io/attic"
|
2025-01-05 06:11:02 -05:00
|
|
|
];
|
2025-01-05 13:55:25 -05:00
|
|
|
extra-trusted-public-keys = [
|
2025-01-06 00:45:49 -05:00
|
|
|
"central:uWhjva6m6dhC2hqNisjn2hXGvdGBs19vPkA1dPEuwFg="
|
2025-01-08 23:43:31 -05:00
|
|
|
"infra-ci:xG5f5tddUBcvToYjlpHD5OY/puYQkKmgKeIQCshNs38="
|
|
|
|
"attic:HL3hVpqXxwcF7Q1R+IvU2i0+YxIjQA2xxKM5EJMXLLs="
|
2025-01-05 13:55:25 -05:00
|
|
|
];
|
2025-01-05 06:11:02 -05:00
|
|
|
builders-use-substitutes = true;
|
|
|
|
};
|
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
outputs =
|
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
home-manager,
|
2024-12-28 10:59:57 -05:00
|
|
|
treefmt,
|
2024-12-28 22:16:46 -05:00
|
|
|
disko,
|
2024-12-19 02:32:58 -05:00
|
|
|
...
|
|
|
|
}@inputs:
|
|
|
|
let
|
|
|
|
lib = nixpkgs.lib;
|
|
|
|
inherit (self) outputs;
|
2024-12-13 11:27:01 -05:00
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
systems = [ "x86_64-linux" ];
|
|
|
|
forEachSystem = f: lib.genAttrs systems (system: f pkgsFor.${system});
|
2024-12-28 10:40:35 -05:00
|
|
|
|
|
|
|
overridePkgsFromFlake =
|
|
|
|
pkgs: flake: pkgNames:
|
|
|
|
let
|
|
|
|
pkgs' = import flake { inherit (pkgs) system config; };
|
|
|
|
pkgNames' = builtins.map (lib.splitString ".") pkgNames;
|
|
|
|
pkgVals = builtins.map (
|
|
|
|
path:
|
|
|
|
let
|
|
|
|
package = lib.getAttrFromPath path pkgs';
|
|
|
|
in
|
|
|
|
lib.setAttrByPath path package
|
|
|
|
) pkgNames';
|
|
|
|
in
|
|
|
|
lib.foldl' lib.recursiveUpdate { } pkgVals;
|
|
|
|
overlayPkgsFromFlake =
|
2025-01-01 03:43:02 -05:00
|
|
|
flake: pkgNames: _final: prev:
|
2024-12-28 10:40:35 -05:00
|
|
|
overridePkgsFromFlake prev flake pkgNames;
|
|
|
|
overlays = [
|
2025-01-06 22:06:36 -05:00
|
|
|
(overlayPkgsFromFlake inputs.attic [
|
2025-01-07 04:58:15 -05:00
|
|
|
# home-manager doesn't like these
|
|
|
|
# "attic-server"
|
|
|
|
# "attic-client"
|
2024-12-30 17:27:24 -05:00
|
|
|
])
|
2025-01-05 16:45:18 -05:00
|
|
|
] ++ import ./overlay;
|
2024-12-28 10:40:35 -05:00
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
pkgsFor = lib.genAttrs systems (
|
|
|
|
system:
|
2024-12-13 11:28:27 -05:00
|
|
|
import nixpkgs {
|
2024-12-28 10:40:35 -05:00
|
|
|
inherit system overlays;
|
2024-12-13 11:44:22 -05:00
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
};
|
2024-12-13 11:28:27 -05:00
|
|
|
}
|
2024-12-19 02:32:58 -05:00
|
|
|
);
|
2024-12-28 10:59:57 -05:00
|
|
|
|
|
|
|
treefmtEval = forEachSystem (
|
|
|
|
pkgs:
|
|
|
|
treefmt.lib.evalModule pkgs {
|
|
|
|
projectRootFile = "flake.nix";
|
|
|
|
programs.nixfmt.enable = true;
|
|
|
|
programs.stylua.enable = true;
|
2024-12-28 12:03:07 -05:00
|
|
|
programs.yamlfmt.enable = true;
|
2025-01-01 03:43:02 -05:00
|
|
|
programs.typos.enable = true;
|
|
|
|
programs.shellcheck.enable = true;
|
|
|
|
programs.deadnix.enable = true;
|
|
|
|
|
|
|
|
settings.global.excludes = [ "secrets/*" ];
|
2024-12-28 10:59:57 -05:00
|
|
|
}
|
|
|
|
);
|
2024-12-19 02:32:58 -05:00
|
|
|
in
|
|
|
|
{
|
2024-12-28 10:59:57 -05:00
|
|
|
formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
|
|
|
|
checks = forEachSystem (pkgs: {
|
|
|
|
formatting = treefmtEval.${pkgs.system}.config.build.check self;
|
|
|
|
});
|
2025-01-08 23:43:42 -05:00
|
|
|
# lets us build overlayed packages with `nix build .#<package>`
|
|
|
|
packages = pkgsFor;
|
2024-12-12 23:35:10 -05:00
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
nixosConfigurations =
|
|
|
|
let
|
|
|
|
pkgs = pkgsFor.x86_64-linux;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
ytnix = lib.nixosSystem {
|
|
|
|
specialArgs = { inherit inputs outputs; };
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
nixpkgs = { inherit pkgs; };
|
|
|
|
}
|
|
|
|
./hosts/ytnix
|
|
|
|
inputs.sops-nix.nixosModules.sops
|
2024-12-30 21:54:25 -05:00
|
|
|
./modules
|
2025-01-01 02:07:32 -05:00
|
|
|
inputs.lanzaboote.nixosModules.lanzaboote
|
2024-12-19 02:32:58 -05:00
|
|
|
];
|
|
|
|
};
|
2024-12-13 21:57:30 -05:00
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
chunk = lib.nixosSystem {
|
|
|
|
specialArgs = { inherit inputs outputs; };
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
nixpkgs = { inherit pkgs; };
|
|
|
|
}
|
|
|
|
./hosts/chunk
|
|
|
|
inputs.sops-nix.nixosModules.sops
|
2024-12-30 21:54:25 -05:00
|
|
|
./modules
|
2024-12-19 02:32:58 -05:00
|
|
|
];
|
|
|
|
};
|
2024-12-28 22:16:46 -05:00
|
|
|
|
|
|
|
titan = lib.nixosSystem {
|
|
|
|
specialArgs = { inherit inputs outputs; };
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
nixpkgs = { inherit pkgs; };
|
|
|
|
}
|
|
|
|
./hosts/titan
|
|
|
|
disko.nixosModules.disko
|
2024-12-28 23:20:41 -05:00
|
|
|
inputs.sops-nix.nixosModules.sops
|
2024-12-30 21:54:25 -05:00
|
|
|
./modules
|
2024-12-28 22:16:46 -05:00
|
|
|
];
|
|
|
|
};
|
2024-12-19 02:32:58 -05:00
|
|
|
};
|
2024-12-12 23:35:10 -05:00
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
homeConfigurations = {
|
|
|
|
"yt@ytnix" = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = pkgsFor.x86_64-linux;
|
|
|
|
extraSpecialArgs = { inherit inputs outputs; };
|
|
|
|
modules = [
|
|
|
|
./home/yt/ytnix.nix
|
|
|
|
];
|
|
|
|
};
|
2024-12-13 22:13:25 -05:00
|
|
|
|
2024-12-19 02:32:58 -05:00
|
|
|
"yt@chunk" = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = pkgsFor.x86_64-linux;
|
|
|
|
extraSpecialArgs = { inherit inputs outputs; };
|
|
|
|
modules = [
|
|
|
|
./home/yt/chunk.nix
|
|
|
|
];
|
|
|
|
};
|
2024-12-13 22:13:25 -05:00
|
|
|
};
|
2024-11-22 00:58:04 -05:00
|
|
|
};
|
|
|
|
}
|