2024-06-20 13:03:44 -05:00
|
|
|
|
{
|
|
|
|
|
description = "My NixOS flake";
|
|
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
|
# Nixpkgs and unstable
|
2024-07-04 04:10:26 -05:00
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
2024-07-03 17:45:35 -05:00
|
|
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
2024-06-20 13:03:44 -05:00
|
|
|
|
|
2024-08-05 11:22:24 -05:00
|
|
|
|
# Lix - Substitution of the Nix package manager, focused on correctness, usability, and growth – and committed to doing right by its community.
|
|
|
|
|
# https://git.lix.systems/lix-project/lix
|
|
|
|
|
lix-module = {
|
2024-08-13 11:44:09 -05:00
|
|
|
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";
|
2024-08-05 11:22:24 -05:00
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
|
2024-06-20 13:03:44 -05:00
|
|
|
|
# impermanence
|
|
|
|
|
# https://github.com/nix-community/impermanence
|
|
|
|
|
impermanence.url = "github:nix-community/impermanence";
|
|
|
|
|
|
|
|
|
|
# Nix User Repository: User contributed nix packages
|
|
|
|
|
nur.url = "github:nix-community/NUR";
|
|
|
|
|
|
|
|
|
|
# nix-community hardware quirks
|
|
|
|
|
# https://github.com/nix-community
|
|
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
|
|
|
|
|
2024-07-03 12:49:10 -05:00
|
|
|
|
# disko - Declarative disk partitioning and formatting using nix
|
2024-07-13 03:13:00 -05:00
|
|
|
|
disko = {
|
2024-07-07 15:59:05 -05:00
|
|
|
|
url = "github:nix-community/disko";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-07-03 12:49:10 -05:00
|
|
|
|
|
2024-07-13 09:27:44 -05:00
|
|
|
|
# home-manager - Manage user configuration with nix
|
2024-06-20 13:03:44 -05:00
|
|
|
|
# https://github.com/nix-community/home-manager
|
|
|
|
|
home-manager = {
|
2024-07-03 17:45:35 -05:00
|
|
|
|
url = "github:nix-community/home-manager/release-24.05";
|
2024-06-20 13:03:44 -05:00
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# sops-nix - secrets with mozilla sops
|
|
|
|
|
# https://github.com/Mic92/sops-nix
|
|
|
|
|
sops-nix = {
|
|
|
|
|
url = "github:Mic92/sops-nix";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# VSCode community extensions
|
|
|
|
|
# https://github.com/nix-community/nix-vscode-extensions
|
|
|
|
|
nix-vscode-extensions = {
|
|
|
|
|
url = "github:nix-community/nix-vscode-extensions";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# nix-index database
|
|
|
|
|
# https://github.com/nix-community/nix-index-database
|
|
|
|
|
nix-index-database = {
|
|
|
|
|
url = "github:nix-community/nix-index-database";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# nix-inspect - inspect nix derivations usingn a TUI interface
|
|
|
|
|
# https://github.com/bluskript/nix-inspect
|
|
|
|
|
nix-inspect = {
|
|
|
|
|
url = "github:bluskript/nix-inspect";
|
2024-07-07 15:59:05 -05:00
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2024-06-20 13:03:44 -05:00
|
|
|
|
};
|
2024-06-24 13:00:06 -05:00
|
|
|
|
|
2024-07-03 12:49:10 -05:00
|
|
|
|
# talhelper - A tool to help creating Talos kubernetes cluster
|
2024-10-09 13:35:18 -05:00
|
|
|
|
# https://github.com/budimanjojo/talhelper
|
2024-07-03 12:49:10 -05:00
|
|
|
|
talhelper = {
|
|
|
|
|
url = "github:budimanjojo/talhelper";
|
2024-07-15 18:11:02 -05:00
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2024-07-03 12:49:10 -05:00
|
|
|
|
};
|
2024-07-11 08:17:10 -05:00
|
|
|
|
|
2024-07-13 09:27:44 -05:00
|
|
|
|
# NixVirt for qemu & libvirt
|
|
|
|
|
# https://github.com/AshleyYakeley/NixVirt
|
|
|
|
|
nixvirt-git = {
|
|
|
|
|
url = "github:AshleyYakeley/NixVirt/v0.5.0";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-01 16:39:07 -05:00
|
|
|
|
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
2024-09-08 18:20:14 -05:00
|
|
|
|
|
|
|
|
|
# krewfile - Declarative krew plugin management
|
|
|
|
|
krewfile = {
|
2024-09-11 16:15:18 -05:00
|
|
|
|
# url = "github:brumhard/krewfile";
|
|
|
|
|
url = "github:ajgon/krewfile?ref=feat/indexes";
|
2024-09-08 18:20:14 -05:00
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-09 13:35:18 -05:00
|
|
|
|
|
|
|
|
|
# nix-minecraft - Minecraft server management
|
|
|
|
|
# https://github.com/infinidoge/nix-minecraft
|
|
|
|
|
nix-minecraft = {
|
|
|
|
|
url = "github:Infinidoge/nix-minecraft";
|
2024-10-09 15:06:45 -05:00
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2024-10-09 13:35:18 -05:00
|
|
|
|
};
|
2024-06-20 13:03:44 -05:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
outputs =
|
2024-09-24 13:36:57 -05:00
|
|
|
|
{ self, nixpkgs, sops-nix, home-manager, nix-vscode-extensions, impermanence, disko, talhelper, lix-module, vscode-server, krewfile, ... } @ inputs:
|
2024-06-20 13:03:44 -05:00
|
|
|
|
let
|
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs [
|
|
|
|
|
"aarch64-linux"
|
|
|
|
|
"x86_64-linux"
|
|
|
|
|
];
|
|
|
|
|
in
|
|
|
|
|
rec {
|
|
|
|
|
# Use nixpkgs-fmt for 'nix fmt'
|
|
|
|
|
formatter = forAllSystems (system: nixpkgs.legacyPackages."${system}".nixpkgs-fmt);
|
|
|
|
|
|
|
|
|
|
# setup devshells against shell.nix
|
|
|
|
|
# devShells = forAllSystems (pkgs: import ./shell.nix { inherit pkgs; });
|
|
|
|
|
|
|
|
|
|
# extend lib with my custom functions
|
|
|
|
|
lib = nixpkgs.lib.extend (
|
|
|
|
|
final: prev: {
|
|
|
|
|
inherit inputs;
|
|
|
|
|
myLib = import ./nixos/lib { inherit inputs; lib = final; };
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
nixosConfigurations =
|
|
|
|
|
let
|
|
|
|
|
inherit inputs;
|
|
|
|
|
# Import overlays for building nixosconfig with them.
|
|
|
|
|
overlays = import ./nixos/overlays { inherit inputs; };
|
2024-07-13 09:27:44 -05:00
|
|
|
|
# generate a base nixos configuration with the specified overlays, hardware modules, and any AerModules applied
|
2024-06-20 13:03:44 -05:00
|
|
|
|
mkNixosConfig =
|
|
|
|
|
{ hostname
|
|
|
|
|
, system ? "x86_64-linux"
|
|
|
|
|
, nixpkgs ? inputs.nixpkgs
|
|
|
|
|
, hardwareModules ? [ ]
|
|
|
|
|
# basemodules is the base of the entire machine building
|
|
|
|
|
# here we import all the modules and setup home-manager
|
|
|
|
|
, baseModules ? [
|
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
|
impermanence.nixosModules.impermanence
|
|
|
|
|
./nixos/profiles/global.nix # all machines get a global profile
|
|
|
|
|
./nixos/modules/nixos # all machines get nixos modules
|
|
|
|
|
./nixos/hosts/${hostname} # load this host's config folder for machine-specific config
|
|
|
|
|
{
|
|
|
|
|
home-manager = {
|
|
|
|
|
useUserPackages = true;
|
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
|
extraSpecialArgs = {
|
|
|
|
|
inherit inputs hostname system;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
, profileModules ? [ ]
|
|
|
|
|
}:
|
|
|
|
|
nixpkgs.lib.nixosSystem {
|
|
|
|
|
inherit system lib;
|
|
|
|
|
modules = baseModules ++ hardwareModules ++ profileModules;
|
|
|
|
|
specialArgs = { inherit self inputs nixpkgs; };
|
|
|
|
|
# Add our overlays
|
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
|
inherit system;
|
|
|
|
|
overlays = builtins.attrValues overlays;
|
|
|
|
|
config = {
|
|
|
|
|
allowUnfree = true;
|
|
|
|
|
allowUnfreePredicate = _: true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
{
|
2024-07-10 12:06:41 -05:00
|
|
|
|
"telchar" = mkNixosConfig {
|
|
|
|
|
# Framework 16 Ryzen 7 7840HS - Radeon 780M Graphics
|
|
|
|
|
# Nix dev laptop
|
|
|
|
|
hostname = "telchar";
|
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
hardwareModules = [
|
|
|
|
|
inputs.nixos-hardware.nixosModules.framework-16-7040-amd
|
|
|
|
|
./nixos/profiles/hw-framework-16-7840hs.nix
|
|
|
|
|
disko.nixosModules.disko
|
2024-09-18 20:52:53 -05:00
|
|
|
|
(import ./nixos/profiles/disko-telchar.nix)
|
2024-07-11 08:17:10 -05:00
|
|
|
|
lix-module.nixosModules.default
|
2024-07-10 12:06:41 -05:00
|
|
|
|
];
|
|
|
|
|
profileModules = [
|
|
|
|
|
./nixos/profiles/role-dev.nix
|
|
|
|
|
./nixos/profiles/role-workstation.nix
|
|
|
|
|
{ home-manager.users.jahanson = ./nixos/home/jahanson/workstation.nix; }
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2024-06-20 13:03:44 -05:00
|
|
|
|
"varda" = mkNixosConfig {
|
|
|
|
|
# Arm64 cax21 @ Hetzner
|
|
|
|
|
# forgejo server
|
|
|
|
|
hostname = "varda";
|
|
|
|
|
system = "aarch64-linux";
|
|
|
|
|
hardwareModules = [
|
|
|
|
|
./nixos/profiles/hw-hetzner-cax.nix
|
|
|
|
|
];
|
|
|
|
|
profileModules = [
|
|
|
|
|
./nixos/profiles/role-server.nix
|
|
|
|
|
{ home-manager.users.jahanson = ./nixos/home/jahanson/server.nix; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2024-07-06 16:47:01 -05:00
|
|
|
|
|
|
|
|
|
"telperion" = mkNixosConfig {
|
|
|
|
|
# HP-S01 Intel G5900
|
|
|
|
|
# Network services server
|
|
|
|
|
hostname = "telperion";
|
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
hardwareModules = [
|
|
|
|
|
./nixos/profiles/hw-hp-s01.nix
|
2024-07-06 16:51:05 -05:00
|
|
|
|
disko.nixosModules.disko
|
|
|
|
|
(import ./nixos/profiles/disko-nixos.nix { disks = [ "/dev/nvme0n1" ]; })
|
|
|
|
|
|
2024-07-06 16:47:01 -05:00
|
|
|
|
];
|
|
|
|
|
profileModules = [
|
|
|
|
|
./nixos/profiles/role-server.nix
|
|
|
|
|
{ home-manager.users.jahanson = ./nixos/home/jahanson/server.nix; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2024-07-13 03:13:00 -05:00
|
|
|
|
|
|
|
|
|
"gandalf" = mkNixosConfig {
|
|
|
|
|
# X9DRi-LN4+/X9DR3-LN4+ - Intel(R) Xeon(R) CPU E5-2650 v2
|
|
|
|
|
# NAS
|
2024-07-13 09:27:44 -05:00
|
|
|
|
hostname = "gandalf";
|
2024-07-13 03:13:00 -05:00
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
hardwareModules = [
|
2024-07-13 13:12:01 -05:00
|
|
|
|
lix-module.nixosModules.default
|
2024-07-13 03:13:00 -05:00
|
|
|
|
./nixos/profiles/hw-supermicro.nix
|
|
|
|
|
];
|
|
|
|
|
profileModules = [
|
2024-09-01 16:39:07 -05:00
|
|
|
|
vscode-server.nixosModules.default
|
|
|
|
|
./nixos/profiles/role-dev.nix
|
2024-07-13 03:13:00 -05:00
|
|
|
|
./nixos/profiles/role-server.nix
|
|
|
|
|
{ home-manager.users.jahanson = ./nixos/home/jahanson/server.nix; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2024-09-03 20:56:49 -05:00
|
|
|
|
|
|
|
|
|
"shadowfax" = mkNixosConfig {
|
|
|
|
|
# Pro WS WRX80E-SAGE SE WIFI - AMD Ryzen Threadripper PRO 3955WX 16-Cores
|
|
|
|
|
# Workloads server
|
|
|
|
|
hostname = "shadowfax";
|
|
|
|
|
system = "x86_64-linux";
|
|
|
|
|
hardwareModules = [
|
|
|
|
|
lix-module.nixosModules.default
|
|
|
|
|
./nixos/profiles/hw-threadripperpro.nix
|
|
|
|
|
];
|
|
|
|
|
profileModules = [
|
|
|
|
|
vscode-server.nixosModules.default
|
|
|
|
|
./nixos/profiles/role-dev.nix
|
|
|
|
|
./nixos/profiles/role-server.nix
|
|
|
|
|
{ home-manager.users.jahanson = ./nixos/home/jahanson/server.nix; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2024-06-20 13:03:44 -05:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Convenience output that aggregates the outputs for home, nixos.
|
|
|
|
|
# Also used in ci to build targets generally.
|
|
|
|
|
top =
|
|
|
|
|
let
|
|
|
|
|
nixtop = nixpkgs.lib.genAttrs
|
|
|
|
|
(builtins.attrNames inputs.self.nixosConfigurations)
|
|
|
|
|
(attr: inputs.self.nixosConfigurations.${attr}.config.system.build.toplevel);
|
|
|
|
|
in
|
|
|
|
|
nixtop;
|
|
|
|
|
};
|
|
|
|
|
}
|