Files
vmimages/flake.nix
2023-10-18 19:28:10 +00:00

166 lines
5.7 KiB
Nix

{
description = "Your new nix config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/release-23.05";
# You can access packages and modules from different nixpkgs revs
# at the same time. Here's an working example:
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
# Home manager
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# TODO: Add any other flake you might need
# hardware.url = "github:nixos/nixos-hardware";
# Shameless plug: looking for a way to nixify your themes and make
# everything match nicely? Try nix-colors!
# nix-colors.url = "github:misterio77/nix-colors";
nixos-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings
# nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs";}; #import nixos-generators for building images
nixos-wsl = {url = "github:nix-community/nixos-wsl"; inputs.nixpkgs.follows = "nixpkgs";};
sops-nix.url = github:Mic92/sops-nix;
flake-utils.url = "github:numtide/flake-utils";
# nix.url = "github:NixOS/nix/2.12.0";
vscode-server.url = "github:msteen/nixos-vscode-server";
# homeage = {url = "github:jordanisaacs/homeage"; inputs.nixpkgs.follows = "nixpkgs";};
# Nix Library Functions
library = {
type = "github";
owner = "nix-community";
repo = "nixpkgs.lib";
ref = "master";
rev = "af5239f892ae6e1c8bb560b11ed874cebbd10696";
};
# Source Filter Functions
filter.url = "github:numtide/nix-filter";
ignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Flake Utility Functions
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
};
outputs = { self, nixpkgs, home-manager,nixpkgs-unstable,... }@inputs:
let
inherit (lib.my) mapModules mapModulesRec mapHosts;
inherit (self) outputs;
system = "x86_64-linux";
mkPkgs = pkgs: extraOverlays: import pkgs {
inherit system;
config.allowUnfree = true; # forgive me Stallman senpai
overlays = extraOverlays ++ (lib.attrValues self.overlays);
};
pkgs = mkPkgs nixpkgs [ self.overlay ];
pkgs' = mkPkgs nixpkgs-unstable [];
lib = nixpkgs.lib.extend
(self: super: { my = import ./lib { inherit pkgs inputs outputs; lib = self; }; }// home-manager.lib);
in {
lib = lib.my;
packages."${system}" =
mapModules ./pkgs (p: pkgs.callPackage p {});
devShell."${system}" =
import ./shell.nix { inherit pkgs; };
overlay =
final: prev: {
unstable = pkgs';
my = self.packages."${system}";
};
overlays = import ./overlays { inherit inputs; };
# Output all modules in ./modules to flake. Modules should be in
# individual subdirectories and contain a default.nix file
nixosModules = builtins.listToAttrs (map
(x: {
name = x;
value = import (./modules/nixos + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules/nixos)));
##import our HM modules
## -- imported in ./home-manger/general
homeManagerModules = builtins.listToAttrs (map
(name: {
inherit name;
value = import (./modules/home-manager + "/${name}");
})
(builtins.attrNames (builtins.readDir ./modules/home-manager)));
# nixosConfigurations =
# mapHosts ./hosts {};
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
go3-wsl = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib;hostName = "go3-wsl"; };
modules = [
./hosts/go3-wsl
];
};
StuPC-WSL = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib; hostName = "StuPC";};
modules = [
./hosts/StuPC-WSL
home-manager.nixosModules.home-manager
{
home-manager.sharedModules = [
inputs.sops-nix.homeManagerModules.sops
];
home-manager.useGlobalPkgs = true;
home-manager.users.sstent = ./home-manager/users/sstent;
}
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
# FIXME replace with your username@hostname
"sstent@go3-wsl" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "go3-wsl"; };
modules = [
# > Our main home-manager configuration file <
./home-manager/users/sstent
inputs.sops-nix.homeManagerModules.sops
];
};
"sstent@StuPC-WSL" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "StuPC-WSL";};
modules = [
# > Our main home-manager configuration file <
./home-manager/users/sstent
inputs.sops-nix.homeManagerModules.sops
];
};
};
};
}