Skip to content

Commit

Permalink
flake-parts
Browse files Browse the repository at this point in the history
closes #14
  • Loading branch information
mightyiam committed Jun 20, 2024
1 parent 6294215 commit f686220
Showing 1 changed file with 70 additions and 51 deletions.
121 changes: 70 additions & 51 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,63 +1,82 @@
{
inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable";
inputs.home-manager.url = "github:nix-community/home-manager";
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
inputs.catppuccin.url = "github:catppuccin/nix";
outputs = {
nixpkgs,
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
catppuccin.url = "github:catppuccin/nix";
};
outputs = inputs @ {
self,
catppuccin,
home-manager,
flake-parts,
...
}: let
pkgs = nixpkgs.legacyPackages.x86_64-linux;

evalExample = path: let
flake = import path;
in
assert flake.inputs.nixconfigs.url == "github:mightyiam/nixconfigs";
flake.outputs {nixconfigs = self;};
in {
nixosModules.mightyiam-desktop = {
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
./nixos-modules/hosts/mightyiam-desktop
home-manager.nixosModules.home-manager
{
home-manager.users.mightyiam.imports = [self.homeManagerModules.mightyiam];
}
inputs.devshell.flakeModule
];
};

homeManagerModules.mightyiam = {
imports = [
catppuccin.homeManagerModules.catppuccin
./home/home.nix
flake = {
nixosModules.mightyiam-desktop = {
imports = [
./nixos-modules/hosts/mightyiam-desktop
inputs.home-manager.nixosModules.home-manager
{
home-manager.users.mightyiam.imports = [self.homeManagerModules.mightyiam];
}
];
};

homeManagerModules.mightyiam = {
imports = [
inputs.catppuccin.homeManagerModules.catppuccin
./home/home.nix
];
};
};

systems = [
"x86_64-linux"
];
};

checks.x86_64-linux.home =
(evalExample examples/home/flake.nix)
.homeManagerConfigurations
.mightyiam
.config
.home
.activationPackage;
perSystem = {
checks = let
evalExample = path: let
flake = import path;
in
assert flake.inputs.nixconfigs.url == "github:mightyiam/nixconfigs";
flake.outputs {nixconfigs = self;};
in {
home =
(evalExample examples/home/flake.nix)
.homeManagerConfigurations
.mightyiam
.config
.home
.activationPackage;

checks.x86_64-linux."host/mightyiam-desktop" =
(evalExample ./examples/hosts/mightyiam-desktop/flake.nix)
.nixosConfigurations
.mightyiam-desktop
.config
.system
.build
.toplevel;
"host/mightyiam-desktop" =
(evalExample ./examples/hosts/mightyiam-desktop/flake.nix)
.nixosConfigurations
.mightyiam-desktop
.config
.system
.build
.toplevel;
};

devShells.x86_64-linux.default = pkgs.mkShell {
packages = [
(pkgs.writeShellScriptBin "check" ''
nix flake check --no-write-lock-file
'')
];
devshells.default = {
commands = [
{
help = "flake check that doesn't write lock file";
name = "check";
command = "nix flake check --no-write-lock-file";
}
];
};
};
};
};
}

0 comments on commit f686220

Please sign in to comment.