mirror of
https://github.com/sstent/vmimages.git
synced 2026-02-06 20:41:41 +00:00
new flake
This commit is contained in:
190
flake.nix
190
flake.nix
@@ -2,176 +2,68 @@
|
||||
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-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings
|
||||
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;
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }@inputs:
|
||||
let
|
||||
mkHost = hostName: system:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
# settings to nixpkgs goes to here
|
||||
# nixpkgs.pkgs.zathura.useMupdf = true;
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
};
|
||||
}
|
||||
// home-manager.lib);
|
||||
in {
|
||||
lib = lib.my;
|
||||
packages."${system}" =
|
||||
mapModules ./pkgs (p: pkgs.callPackage p {});
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
|
||||
|
||||
devShell."${system}" =
|
||||
import ./shell.nix {inherit pkgs;};
|
||||
specialArgs = {
|
||||
# By default, the system will only use packages from the
|
||||
# stable channel. You can selectively install packages
|
||||
# from the unstable channel. You can also add more
|
||||
# channels to pin package version.
|
||||
pkgs-unstable = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
# settings to nixpkgs-unstable goes to here
|
||||
};
|
||||
|
||||
#hostName = "StuPC";
|
||||
|
||||
overlay = final: prev: {
|
||||
#unstable = pkgs';
|
||||
my = self.packages."${system}";
|
||||
};
|
||||
# make all inputs availabe in other nix files
|
||||
inherit inputs;
|
||||
};
|
||||
|
||||
overlays = import ./overlays {inherit inputs;};
|
||||
modules = [
|
||||
# Root on ZFS related configuration
|
||||
./modules
|
||||
|
||||
# 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)));
|
||||
# Configuration shared by all hosts
|
||||
|
||||
##import our HM modules
|
||||
## -- imported in ./home-manger/general
|
||||
# Configuration per host
|
||||
./hosts/${hostName}
|
||||
|
||||
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";
|
||||
# home-manager
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.sstent = import ./home-manager;
|
||||
}
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
./hosts/go3-wsl
|
||||
];
|
||||
};
|
||||
StuPC-WSL = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs outputs lib;
|
||||
hostName = "StuPC";
|
||||
};
|
||||
modules = [
|
||||
./hosts/StuPC-WSL
|
||||
];
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
StuPC-WSL = mkHost "StuPC-WSL" "x86_64-linux";
|
||||
};
|
||||
};
|
||||
|
||||
# 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
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user