flakes/flake.nix

80 lines
2.6 KiB
Nix
Raw Normal View History

2021-05-11 14:32:58 +07:00
{
inputs = {
2021-07-14 07:42:25 +07:00
nixpkgs.url = "github:NixOS/nixpkgs";
2021-07-04 21:25:20 +07:00
home-manager.url = "github:nix-community/home-manager";
2021-07-05 10:40:52 +07:00
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
2021-07-04 21:25:20 +07:00
secrets.url = "github:LavaDesu/flakes-secrets";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2021-07-05 10:40:52 +07:00
neovim-nightly.inputs.nixpkgs.follows = "nixpkgs";
2021-07-14 11:02:42 +07:00
# zsh plugins
zsh-abbr = { url = "github:olets/zsh-abbr"; flake = false; };
zsh-history-substring-search = { url = "github:zsh-users/zsh-history-substring-search"; flake = false; };
2021-07-15 14:59:23 +07:00
fast-syntax-highlighting = { url = "github:zdharma/fast-syntax-highlighting"; flake = false; };
pure = { url = "github:sindresorhus/pure"; flake = false; };
2021-05-11 14:32:58 +07:00
};
2021-07-15 20:39:39 +07:00
outputs = { self, nixpkgs, home-manager, secrets, ... } @ inputs:
2021-05-13 17:59:46 +07:00
let
lib = nixpkgs.lib;
getPaths = root: builtins.map
(path: root + ("/" + path)) # Prepends root path
(builtins.attrNames (builtins.readDir root)); # Reads root path
modules =
2021-07-15 19:57:49 +07:00
let
getName = path: lib.removeSuffix ".nix" ( # Strip extension
lib.last ( # Gets the last part (filename)
lib.splitString "/" ( # Splits the path into components
builtins.toString path # Converts the path into a string
)
)
2021-07-15 19:57:49 +07:00
);
genModulePaths = basePath: builtins.listToAttrs (
builtins.map (path: {
name = getName path;
value = path;
}) (getPaths basePath)
);
in {
user = genModulePaths ./modules/user;
system = genModulePaths ./modules/system;
};
customPackages = pkgs:
let
callPackage = pkgs.callPackage;
in {
linux-lava = callPackage ./packages/linux-lava {};
wine-osu = callPackage ./packages/wine-osu { inherit getPaths; };
};
overlays = (builtins.map
(path: import path) # Imports path
(builtins.filter
(path: lib.hasSuffix ".nix" path) # Checks file extension
(getPaths ./overlays)
)
2021-07-05 10:40:52 +07:00
) ++ [(self: super: customPackages super)]
++ [inputs.neovim-nightly.overlay];
2021-05-13 17:59:46 +07:00
in
{
nixosConfigurations."winter" = lib.nixosSystem {
2021-05-13 17:59:46 +07:00
system = "x86_64-linux";
modules = [
2021-05-26 21:05:59 +07:00
home-manager.nixosModules.home-manager
./hosts/winter.nix
secrets.nixosModules.winter
2021-05-13 17:59:46 +07:00
];
specialArgs = {
2021-07-15 20:30:12 +07:00
inherit inputs modules overlays;
enableGUI = true;
};
2021-05-13 17:59:46 +07:00
};
2021-07-15 13:39:48 +07:00
packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux;
2021-05-11 14:32:58 +07:00
};
}