2024-12-27 18:47:23 +01:00
|
|
|
{
|
2025-04-12 17:05:38 +02:00
|
|
|
description = "Martin's NixOS configuration - Based on EmergentMind/nix-config";
|
2024-12-27 18:47:23 +01:00
|
|
|
|
|
|
|
inputs = {
|
2025-04-12 17:05:38 +02:00
|
|
|
#
|
|
|
|
# ========= Official NixOS and HM Package Sources =========
|
|
|
|
#
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
|
|
|
# The next two are for pinning to stable vs unstable regardless of what the above is set to
|
|
|
|
# This is particularly useful when an upcoming stable release is in beta because you can effectively
|
|
|
|
# keep 'nixpkgs-stable' set to stable for critical packages while setting 'nixpkgs' to the beta branch to
|
|
|
|
# get a jump start on deprecation changes.
|
|
|
|
# See also 'stable-packages' and 'unstable-packages' overlays at 'overlays/default.nix"
|
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
|
|
|
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2025-01-05 18:14:52 +01:00
|
|
|
|
2025-04-12 17:05:38 +02:00
|
|
|
home-manager = {
|
|
|
|
url = "github:nix-community/home-manager/release-24.11";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
|
|
|
#
|
|
|
|
# ========= Utilities =========
|
|
|
|
#
|
|
|
|
# Secrets management
|
2025-04-17 00:31:19 +02:00
|
|
|
sops-nix = {
|
|
|
|
url = "github:mic92/sops-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2025-04-12 17:05:38 +02:00
|
|
|
# Catppuccin theming
|
2025-01-11 12:15:19 +01:00
|
|
|
catppuccin = {
|
|
|
|
url = "github:catppuccin/nix";
|
|
|
|
};
|
2025-04-12 17:05:38 +02:00
|
|
|
# vim
|
|
|
|
nixvim = {
|
|
|
|
url = "github:nix-community/nixvim/nixos-24.11";
|
2024-12-27 18:47:23 +01:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2025-04-12 17:05:38 +02:00
|
|
|
# Bar
|
2025-04-12 20:25:10 +02:00
|
|
|
hyprpanel.url = "github:Jas-SinghFSU/HyprPanel";
|
2025-04-12 17:05:38 +02:00
|
|
|
# Spotify
|
2025-01-09 22:23:28 +01:00
|
|
|
spicetify-nix = {
|
|
|
|
url = "github:Gerg-L/spicetify-nix";
|
2025-04-12 17:05:38 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
2025-01-09 22:23:28 +01:00
|
|
|
};
|
2025-04-12 17:05:38 +02:00
|
|
|
# Browser
|
2025-01-12 12:27:00 +01:00
|
|
|
zen-browser.url = "github:0xc000022070/zen-browser-flake";
|
2025-04-12 17:05:38 +02:00
|
|
|
# Video aggregator
|
2025-04-02 20:09:55 +02:00
|
|
|
grayjay.url = "github:rishabh5321/grayjay-flake";
|
2024-12-27 18:47:23 +01:00
|
|
|
};
|
|
|
|
|
2024-12-27 21:31:18 +01:00
|
|
|
outputs =
|
2025-04-12 17:05:38 +02:00
|
|
|
{
|
|
|
|
self,
|
2024-12-28 20:25:37 +01:00
|
|
|
nixpkgs,
|
|
|
|
home-manager,
|
|
|
|
...
|
2025-04-12 17:05:38 +02:00
|
|
|
}@inputs:
|
2024-12-27 21:31:18 +01:00
|
|
|
let
|
2025-01-04 23:36:16 +01:00
|
|
|
inherit (self) outputs;
|
2025-04-12 17:05:38 +02:00
|
|
|
common = import ./shared/common.nix;
|
|
|
|
theme = import ./shared/theme.nix;
|
2025-01-09 19:52:08 +01:00
|
|
|
|
2025-04-12 17:05:38 +02:00
|
|
|
#
|
|
|
|
# ========= Architectures =========
|
|
|
|
#
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
];
|
|
|
|
|
|
|
|
# ========== Extend lib with lib.custom ==========
|
|
|
|
# NOTE: This approach allows lib.custom to propagate into hm
|
|
|
|
# see: https://github.com/nix-community/home-manager/pull/3454
|
|
|
|
customLib = (_self: _super: { custom = import ./lib { inherit (nixpkgs) lib; }; });
|
|
|
|
lib = nixpkgs.lib.extend customLib;
|
|
|
|
libHm = home-manager.lib.extend customLib;
|
2025-02-13 21:52:01 +01:00
|
|
|
|
2025-04-15 12:48:27 +02:00
|
|
|
systems = builtins.map (config: defaultAttrs // config) [
|
2025-04-12 19:45:01 +02:00
|
|
|
{
|
|
|
|
hostName = "desktop";
|
|
|
|
system = "x86_64-linux";
|
2025-04-14 23:30:50 +02:00
|
|
|
nvidia.enable = true;
|
2025-04-12 19:45:01 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
hostName = "thinkpad";
|
|
|
|
system = "x86_64-linux";
|
|
|
|
}
|
2025-04-12 20:25:10 +02:00
|
|
|
{
|
|
|
|
hostName = "pi4";
|
|
|
|
system = "aarch64-linux";
|
2025-04-14 23:30:50 +02:00
|
|
|
wayland.enable = false;
|
2025-04-12 20:25:10 +02:00
|
|
|
}
|
|
|
|
# TODO Homelab config
|
2025-04-12 19:45:01 +02:00
|
|
|
];
|
|
|
|
|
2025-04-15 12:48:27 +02:00
|
|
|
defaultAttrs = {
|
|
|
|
user = {
|
|
|
|
name = common.username;
|
2025-04-16 00:08:42 +02:00
|
|
|
password = "temp"; # TODO
|
2025-04-15 12:48:27 +02:00
|
|
|
};
|
|
|
|
version = common.system.version;
|
|
|
|
wayland.enable = true;
|
|
|
|
nvidia.enable = false;
|
|
|
|
};
|
|
|
|
|
2025-04-12 17:05:38 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
#
|
|
|
|
# ========= Overlays =========
|
|
|
|
#
|
|
|
|
# Custom modifications/overrides to upstream packages
|
|
|
|
overlays = import ./overlays.nix { inherit inputs; };
|
2025-01-04 23:36:16 +01:00
|
|
|
|
2025-04-12 17:05:38 +02:00
|
|
|
#
|
|
|
|
# ========= Host Configurations =========
|
|
|
|
#
|
2025-04-12 19:45:01 +02:00
|
|
|
nixosConfigurations = builtins.listToAttrs (
|
|
|
|
builtins.map (
|
|
|
|
{
|
|
|
|
hostName,
|
|
|
|
system,
|
2025-04-15 12:48:27 +02:00
|
|
|
user,
|
|
|
|
...
|
|
|
|
}@systemConfig:
|
2025-04-12 20:25:10 +02:00
|
|
|
|
2025-04-12 19:45:01 +02:00
|
|
|
{
|
|
|
|
name = hostName;
|
|
|
|
value = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
specialArgs = {
|
|
|
|
inherit
|
|
|
|
outputs
|
|
|
|
inputs
|
|
|
|
common
|
|
|
|
theme
|
|
|
|
lib
|
2025-04-14 23:30:50 +02:00
|
|
|
systemConfig
|
2025-04-12 19:45:01 +02:00
|
|
|
;
|
|
|
|
isDarwin = false;
|
2025-04-12 17:05:38 +02:00
|
|
|
};
|
2025-04-12 19:45:01 +02:00
|
|
|
modules = [
|
|
|
|
./hosts/${hostName}
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager = {
|
|
|
|
# Backups conflicting files in case of error
|
|
|
|
backupFileExtension = "bkp";
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
extraSpecialArgs = {
|
|
|
|
inherit
|
|
|
|
inputs
|
|
|
|
common
|
|
|
|
theme
|
|
|
|
libHm
|
2025-04-14 23:30:50 +02:00
|
|
|
systemConfig
|
2025-04-12 19:45:01 +02:00
|
|
|
;
|
|
|
|
};
|
|
|
|
users.${user.name} = import ./hosts/${hostName}/home-manager;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
nixpkgs.overlays = with inputs; [
|
|
|
|
hyprpanel.overlay
|
|
|
|
];
|
|
|
|
}
|
2025-04-12 18:51:28 +02:00
|
|
|
];
|
2025-04-12 19:45:01 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
) systems
|
|
|
|
);
|
2025-01-04 23:36:16 +01:00
|
|
|
|
2025-04-12 17:05:38 +02:00
|
|
|
#
|
|
|
|
# ========= Formatting =========
|
|
|
|
#
|
|
|
|
# Nix formatter available through 'nix fmt' https://github.com/NixOS/nixfmt
|
|
|
|
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
|
|
|
|
|
|
|
|
#
|
|
|
|
# ========= DevShell =========
|
|
|
|
#
|
|
|
|
# Custom shell for bootstrapping on new hosts, modifying nix-config, and secrets management
|
|
|
|
devShells = forAllSystems (
|
|
|
|
system:
|
|
|
|
import ./shell.nix {
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
}
|
|
|
|
);
|
2024-12-27 18:47:23 +01:00
|
|
|
};
|
|
|
|
}
|