dotfiles/flake.nix

183 lines
4.9 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.url = "github:nix-community/nur";
nekowinston-nur.url = "github:nekowinston/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";
# dev
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,
flake-utils,
2023-02-12 08:05:51 +01:00
home-manager,
nekowinston-nur,
nix-index-database,
2023-02-07 11:42:25 +01:00
nixpkgs,
nur,
2023-02-12 08:05:51 +01:00
pre-commit-hooks,
2023-02-07 11:42:25 +01:00
sops,
swayfx,
2023-02-07 11:42:25 +01:00
...
2023-02-10 07:46:37 +01:00
}: let
2023-02-18 22:36:15 +01:00
overlays = final: prev: {
nur = import nur {
nurpkgs = prev;
pkgs = prev;
repoOverrides = {
nekowinston = import nekowinston-nur {
2023-04-27 09:30:26 +02:00
pkgs = import nixpkgs {system = prev.system;};
};
};
};
2023-05-01 05:46:00 +02:00
sway-unwrapped = swayfx.packages.${prev.system}.default;
};
2023-04-08 13:03:00 +02:00
commonHMConfig = {
username,
machine,
}: ({
2023-04-03 22:44:03 +02:00
config,
pkgs,
...
}: {
config = {
nixpkgs.overlays = [overlays];
home-manager = {
useGlobalPkgs = true;
backupFileExtension = "backup";
sharedModules = [
./modules
nix-index-database.hmModules.nix-index
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";
2023-05-01 05:46:00 +02:00
inherit machine;
2023-04-03 22:44:03 +02:00
};
};
};
});
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";
machine.personal = true;
})
];
};
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";
machine.personal = false;
})
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";
machine.personal = true;
})
];
};
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
nix-index-database.hmModules.nix-index
sops.homeManagerModules.sops
];
extraSpecialArgs = {
flakePath =
if pkgs.stdenv.isDarwin
then "/Users/${username}/.config/nixpkgs"
else "/home/${username}/.config/nixpkgs";
machine.personal = false;
};
};
}
// flake-utils.lib.eachDefaultSystem (system: {
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
2023-02-18 23:25:28 +01:00
commitizen.enable = true;
editorconfig-checker.enable = true;
luacheck.enable = true;
nil.enable = true;
shellcheck.enable = true;
stylua.enable = true;
};
};
};
2023-04-03 22:44:03 +02:00
devShells.default = let
2023-02-11 02:37:39 +01:00
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
2023-05-08 23:49:13 +02:00
name = "nixpkgs";
2023-02-11 02:37:39 +01:00
inherit (self.checks.${system}.pre-commit-check) shellHook;
2023-05-14 07:07:08 +02:00
packages = [pkgs.just pkgs.git-crypt pkgs.sops];
2023-02-11 02:37:39 +01:00
};
2023-05-14 09:27:30 +02:00
formatter = nixpkgs.legacyPackages.${system}.alejandra;
});
2023-02-07 11:42:25 +01:00
}