168 lines
5 KiB
Nix
168 lines
5 KiB
Nix
{
|
|
description = "Ray's Nix Config";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
ghostty.url = "github:ghostty-org/ghostty";
|
|
nix-index-database.url = "github:nix-community/nix-index-database";
|
|
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
|
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
|
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
git-hooks.url = "github:cachix/git-hooks.nix";
|
|
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
|
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
# linux-only
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
|
disko.url = "github:nix-community/disko";
|
|
disko.inputs.nixpkgs.follows = "nixpkgs";
|
|
zen-browser.url = "github:0xc000022070/zen-browser-flake";
|
|
zen-browser.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
# darwin-only
|
|
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
|
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
|
mac-app-util.url = "github:hraban/mac-app-util";
|
|
nixpkgs-firefox-darwin.url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
|
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
|
homebrew-core.url = "github:homebrew/homebrew-core";
|
|
homebrew-core.flake = false;
|
|
homebrew-cask.url = "github:homebrew/homebrew-cask";
|
|
homebrew-cask.flake = false;
|
|
homebrew-createzap.url = "github:nrlquaker/homebrew-createzap";
|
|
homebrew-createzap.flake = false;
|
|
homebrew-emacs-plus.url = "github:d12frosted/homebrew-emacs-plus";
|
|
homebrew-emacs-plus.flake = false;
|
|
homebrew-brewsci-bio.url = "github:brewsci/homebrew-bio";
|
|
homebrew-brewsci-bio.flake = false;
|
|
homebrew-valgrind.url = "github:LouisBrunner/homebrew-valgrind";
|
|
homebrew-valgrind.flake = false;
|
|
homebrew-nikitabobko.url = "github:nikitabobko/homebrew-tap";
|
|
homebrew-nikitabobko.flake = false;
|
|
|
|
# tools
|
|
aerospace-scratchpad.url = "github:cristianoliveira/aerospace-scratchpad";
|
|
yazi.url = "github:sxyazi/yazi";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
treefmt-nix,
|
|
...
|
|
}@inputs:
|
|
let
|
|
lib = nixpkgs.lib;
|
|
commonArgs = {
|
|
inherit
|
|
self
|
|
inputs
|
|
nixpkgs
|
|
lib
|
|
;
|
|
specialArgs = {
|
|
inherit self inputs;
|
|
};
|
|
};
|
|
|
|
# call with forAllSystems (commonArgs: function body)
|
|
forAllSystems =
|
|
fn:
|
|
lib.genAttrs
|
|
[
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
]
|
|
(
|
|
system:
|
|
fn (
|
|
commonArgs
|
|
// {
|
|
inherit system;
|
|
pkgs = import inputs.nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
}
|
|
)
|
|
);
|
|
treefmtEval = forAllSystems (
|
|
{ pkgs, ... }:
|
|
treefmt-nix.lib.evalModule pkgs {
|
|
projectRootFile = "flake.nix";
|
|
programs.nixfmt.enable = true;
|
|
programs.stylua.enable = true;
|
|
programs.shfmt.enable = true;
|
|
programs.shfmt.includes = [ "bin/*" ];
|
|
programs.shfmt.indent_size = 4;
|
|
programs.fish_indent.enable = true;
|
|
programs.shellcheck.enable = true;
|
|
settings.global.excludes = [ "flake.lock" ];
|
|
}
|
|
);
|
|
in
|
|
(import ./hosts commonArgs)
|
|
// {
|
|
checks = forAllSystems (
|
|
{
|
|
system,
|
|
...
|
|
}:
|
|
{
|
|
formatting = treefmtEval.${system}.config.build.check self;
|
|
pre-commit-check = inputs.git-hooks.lib.${system}.run {
|
|
src = ./.;
|
|
excludes = [ "flake.lock" ];
|
|
hooks = {
|
|
treefmt = {
|
|
enable = true;
|
|
package = lib.mkForce treefmtEval.${system}.config.build.wrapper;
|
|
args = [
|
|
# "--config-file ${treefmtEval.${system}.config.build.configFile}"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|
|
);
|
|
|
|
devShells = forAllSystems (
|
|
{
|
|
pkgs,
|
|
system,
|
|
...
|
|
}:
|
|
{
|
|
default = pkgs.mkShell {
|
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
|
|
name = "dotfiles";
|
|
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
|
|
nativeBuildInputs = [
|
|
treefmtEval.${system}.config.build.wrapper
|
|
];
|
|
packages = with pkgs; [
|
|
git
|
|
sops
|
|
age
|
|
ssh-to-age
|
|
nixfmt-rfc-style
|
|
shfmt
|
|
];
|
|
DIRENV_LOG_FORMAT = "";
|
|
};
|
|
}
|
|
);
|
|
|
|
packages = forAllSystems (commonArgs': (import ./packages commonArgs'));
|
|
|
|
formatter = forAllSystems ({ system, ... }: treefmtEval.${system}.config.build.wrapper);
|
|
|
|
};
|
|
}
|