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";
|
2021-05-20 14:02:49 +07:00
|
|
|
|
|
|
|
|
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
|
2021-07-15 15:09:38 +07:00
|
|
|
lib = nixpkgs.lib;
|
|
|
|
|
|
2021-06-26 23:48:15 +07:00
|
|
|
getPaths = root: builtins.map
|
|
|
|
|
(path: root + ("/" + path)) # Prepends root path
|
|
|
|
|
(builtins.attrNames (builtins.readDir root)); # Reads root path
|
|
|
|
|
|
2021-07-15 15:09:38 +07:00
|
|
|
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 15:09:38 +07:00
|
|
|
)
|
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;
|
|
|
|
|
};
|
2021-07-15 15:09:38 +07:00
|
|
|
|
2021-06-26 23:48:15 +07:00
|
|
|
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
|
2021-07-15 15:09:38 +07:00
|
|
|
(path: lib.hasSuffix ".nix" path) # Checks file extension
|
2021-06-26 23:48:15 +07:00
|
|
|
(getPaths ./overlays)
|
|
|
|
|
)
|
2021-07-05 10:40:52 +07:00
|
|
|
) ++ [(self: super: customPackages super)]
|
|
|
|
|
++ [inputs.neovim-nightly.overlay];
|
2021-07-15 20:41:38 +07:00
|
|
|
|
|
|
|
|
mkSystem =
|
|
|
|
|
if !(self ? rev) then throw "Dirty git tree detected." else
|
|
|
|
|
name: arch: enableGUI: lib.nixosSystem {
|
|
|
|
|
system = arch;
|
|
|
|
|
modules = [
|
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
|
secrets.nixosModules.winter
|
|
|
|
|
./hosts/winter.nix
|
|
|
|
|
];
|
|
|
|
|
specialArgs = { inherit inputs modules overlays enableGUI; };
|
|
|
|
|
};
|
2021-05-13 17:59:46 +07:00
|
|
|
in
|
|
|
|
|
{
|
2021-07-15 20:41:38 +07:00
|
|
|
nixosConfigurations."winter" = mkSystem "winter" "x86_64-linux" true;
|
2021-07-15 13:39:48 +07:00
|
|
|
|
2021-06-26 23:48:15 +07:00
|
|
|
packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux;
|
2021-05-11 14:32:58 +07:00
|
|
|
};
|
|
|
|
|
}
|