nixos/flake.nix

119 lines
2.7 KiB
Nix

{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix/master";
inputs.nixpkgs.follows = "nixpkgs";
};
elephant = {
url = "github:abenz1267/elephant/master";
inputs.nixpkgs.follows = "nixpkgs";
};
walker = {
url = "github:abenz1267/walker/master";
inputs = {
elephant.follows = "elephant";
nixpkgs.follows = "nixpkgs";
};
};
install-system = {
url = "path:scripts/install-system";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
home-manager,
install-system,
nix-vscode-extensions,
stylix,
...
}@inputs:
let
system = "x86_64-linux";
username = "josh";
profile = "desktop";
homePath = ./. + "/users/${username}/home.nix";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ nix-vscode-extensions.overlays.default ];
};
mkHost =
{
host,
extraModules ? [ ],
}:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit
homePath
host
inputs
profile
username
;
};
inherit pkgs;
modules = [ ./hosts/${host} ] ++ extraModules;
};
in
{
nixosConfigurations = {
laptop = mkHost { host = "laptop"; };
vm = mkHost { host = "vm"; };
live = mkHost {
host = "installation-iso";
extraModules = [
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
{ environment.systemPackages = [ install-system.packages.${system}.default ]; }
];
};
};
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = {
inherit inputs profile username;
};
inherit pkgs;
modules = [
{
modules.gpg.signingKey = null;
}
homePath
stylix.homeModules.stylix
];
};
devShell.${system} = pkgs.mkShell {
packages = with pkgs; [
nil
nixd
];
};
formatter.${system} = pkgs.nixfmt-tree;
};
}