dotfiles/flake.nix

166 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";
caarlos0-nur.url = "github:caarlos0/nur";
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
};
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;
backupFileExtension = "backup";
sharedModules = [
./modules
inputs.nix-index-database.hmModules.nix-index
inputs.sops.homeManagerModules.sops
];
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
./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
};
2023-04-21 05:59:56 +02:00
homeConfigurations.winston = let
system = "aarch64-linux";
2023-04-27 09:30:26 +02:00
pkgs = import nixpkgs {
2023-04-21 05:59:56 +02:00
inherit system;
config.allowUnfree = true;
};
username = "winston";
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
{
home.homeDirectory = "/home/winston";
home.username = "/home/winston";
nixpkgs.overlays = [overlays];
nixpkgs.config.allowUnfree = true;
}
./modules
./home
inputs.nix-index-database.hmModules.nix-index
inputs.sops.homeManagerModules.sops
2023-04-21 05:59:56 +02:00
];
extraSpecialArgs = {
flakePath =
if pkgs.stdenv.isDarwin
then "/Users/${username}/.config/nixpkgs"
else "/home/${username}/.config/nixpkgs";
};
};
}
// 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
}