dotfiles/flake.nix

160 lines
4.7 KiB
Nix
Raw Normal View History

2023-02-07 11:42:25 +01:00
{
description = "nekowinston's hm flake";
inputs = {
2023-04-27 09:30:26 +02:00
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2023-02-07 11:42:25 +01:00
darwin = {
2023-02-11 02:37:39 +01:00
url = "github:lnl7/nix-darwin";
2023-04-27 09:30:26 +02:00
inputs.nixpkgs.follows = "nixpkgs";
2023-02-10 07:46:37 +01:00
};
2023-04-21 05:59:56 +02:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-02-07 11:42:25 +01:00
# NUR
nur.url = "github:nix-community/nur";
nekowinston-nur.url = "github:nekowinston/nur";
2023-06-04 01:51:55 +02:00
caarlos0-nur.url = "github:nekowinston/caarlos0-nur/feat/add-apple-music-discord-module";
2023-02-11 02:37:39 +01:00
sops.url = "github:Mic92/sops-nix";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
swayfx.url = "github:willpower3309/swayfx";
2023-05-01 05:46:00 +02:00
swayfx.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
flake-utils.url = "github:numtide/flake-utils";
2023-02-07 11:42:25 +01:00
};
2023-05-29 14:11:41 +02:00
nixConfig = {
extra-substituters = [
"https://cache.garnix.io"
2023-05-29 14:11:41 +02:00
"https://mic92.cachix.org"
"https://nekowinston.cachix.org"
"https://nix-community.cachix.org"
"https://pre-commit-hooks.cachix.org"
];
extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
2023-05-29 14:11:41 +02:00
"mic92.cachix.org-1:gi8IhgiT3CYZnJsaW7fxznzTkMUOn1RY4GmXdT/nXYQ="
"nekowinston.cachix.org-1:lucpmaO+JwtoZj16HCO1p1fOv68s/RL1gumpVzRHRDs="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc="
];
extra-trusted-users = ["@wheel"];
tarball-ttl = 604800;
warn-dirty = false;
2023-05-29 14:11:41 +02:00
};
2023-02-07 11:42:25 +01:00
outputs = {
self,
darwin,
2023-02-12 08:05:51 +01:00
home-manager,
2023-02-07 11:42:25 +01:00
nixpkgs,
...
} @ inputs: let
2023-02-18 22:36:15 +01:00
overlays = final: prev: {
nur = import inputs.nur {
nurpkgs = prev;
pkgs = prev;
repoOverrides = {
caarlos0 = inputs.caarlos0-nur.packages.${prev.system};
nekowinston = inputs.nekowinston-nur.packages.${prev.system};
};
};
sway-unwrapped = inputs.swayfx.packages.${prev.system}.default;
};
2023-05-18 15:19:31 +02:00
commonHMConfig = {username}: ({
2023-04-03 22:44:03 +02:00
config,
pkgs,
...
}: {
config = {
nixpkgs.overlays = [overlays];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
2023-04-03 22:44:03 +02:00
backupFileExtension = "backup";
sharedModules = [
inputs.nix-index-database.hmModules.nix-index
inputs.sops.homeManagerModules.sops
2023-06-04 01:51:55 +02:00
inputs.caarlos0-nur.homeManagerModules.default
inputs.nekowinston-nur.homeManagerModules.default
];
2023-04-03 22:44:03 +02:00
users.${username}.imports = [./home];
extraSpecialArgs = {
flakePath =
if pkgs.stdenv.isDarwin
then "/Users/${username}/.config/nixpkgs"
else "/home/${username}/.config/nixpkgs";
};
};
};
});
in
{
nixosConfigurations = {
2023-05-11 23:26:32 +02:00
"futomaki" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
./machines/common
./machines/futomaki
2023-04-08 13:03:00 +02:00
(commonHMConfig {
username = "winston";
})
];
};
2023-05-11 23:26:32 +02:00
"bento" = nixpkgs.lib.nixosSystem {
2023-03-01 21:03:45 +01:00
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
./machines/common
2023-03-01 21:03:45 +01:00
./machines/bento
2023-04-08 13:03:00 +02:00
(commonHMConfig {
username = "w";
})
2023-03-01 21:03:45 +01:00
];
};
};
darwinConfigurations = {
2023-05-11 23:26:32 +02:00
"sashimi" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
home-manager.darwinModules.home-manager
inputs.nekowinston-nur.darwinModules.default
./machines/common
2023-02-20 09:09:29 +01:00
./machines/sashimi
2023-04-08 13:03:00 +02:00
(commonHMConfig {
username = "winston";
})
];
};
2023-02-07 11:42:25 +01:00
};
}
// inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
commitizen.enable = true;
editorconfig-checker.enable = true;
luacheck.enable = true;
nil.enable = true;
shellcheck.enable = true;
stylua.enable = true;
};
};
devShells.default = pkgs.mkShell {
name = "nixpkgs";
inherit (self.checks.${system}.pre-commit-check) shellHook;
nativeBuildInputs = [pkgs.just pkgs.git-crypt pkgs.sops];
};
formatter = pkgs.alejandra;
});
2023-02-07 11:42:25 +01:00
}