nix/flake.nix

394 lines
11 KiB
Nix
Raw Normal View History

2023-09-04 11:40:30 -05:00
{
inputs = {
2024-06-01 20:08:59 -05:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
2024-06-29 01:40:25 -05:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2024-02-29 09:02:36 -06:00
2024-06-17 13:00:23 -05:00
disko.url = "github:nix-community/disko/master";
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
2024-06-29 01:40:25 -05:00
sops-nix.inputs.nixpkgs.follows = "nixpkgs-unstable";
2024-06-17 13:00:23 -05:00
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
2024-06-28 09:51:25 -05:00
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
2024-06-17 13:00:23 -05:00
home-manager.url = "github:nix-community/home-manager/release-24.05";
2023-11-07 17:09:05 -06:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2023-12-04 09:14:13 -06:00
helix.url = "github:helix-editor/helix/master";
2023-10-03 17:09:12 -05:00
hardware.url = "github:nixos/nixos-hardware";
2024-03-22 09:54:00 -05:00
hyprland.url = "github:hyprwm/Hyprland";
2024-05-29 14:58:10 -05:00
slippi.url = "github:lytedev/slippi-nix";
2023-09-04 11:40:30 -05:00
};
nixConfig = {
extra-experimental-features = ["nix-command" "flakes"];
extra-substituters = [
"https://cache.nixos.org/"
"https://helix.cachix.org"
"https://nix-community.cachix.org"
"https://nix.h.lyte.dev"
"https://hyprland.cachix.org"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
2023-10-03 11:52:44 -05:00
outputs = {
self,
2023-10-18 09:14:19 -05:00
nixpkgs,
2024-06-29 01:40:25 -05:00
nixpkgs-unstable,
2024-06-28 09:51:25 -05:00
disko,
2024-06-28 14:01:32 -05:00
sops-nix,
2024-06-28 09:51:25 -05:00
pre-commit,
2023-10-03 11:52:44 -05:00
home-manager,
2024-06-28 09:51:25 -05:00
helix,
2024-02-28 09:31:58 -06:00
hardware,
2024-06-28 11:50:18 -05:00
# hyprland,
2024-06-28 09:51:25 -05:00
slippi,
2023-10-03 11:52:44 -05:00
...
2024-06-28 09:51:25 -05:00
}: let
inherit (self) outputs;
2024-06-28 14:01:32 -05:00
inherit (outputs) nixosModules homeManagerModules overlays;
2024-06-28 09:51:25 -05:00
# TODO: make @ inputs unnecessary by making arguments explicit in all modules?
2024-06-25 09:38:00 -05:00
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
forSystems = nixpkgs.lib.genAttrs systems;
2024-06-28 14:01:32 -05:00
pkgsFor = system: (import nixpkgs {inherit system;}).extend overlays.default;
2024-06-28 09:51:25 -05:00
genPkgs = func: (forSystems (system: func (pkgsFor system)));
pkg = callee: overrides: genPkgs (pkgs: pkgs.callPackage callee overrides);
2024-06-28 14:01:32 -05:00
colors = (import ./lib/colors.nix {inherit (nixpkgs) lib;}).schemes.catppuccin-mocha-sapphire;
2024-06-28 09:51:25 -05:00
# font = {
# name = "IosevkaLyteTerm";
# size = 12;
# };
2024-01-04 14:45:10 -06:00
2024-06-28 11:50:18 -05:00
# moduleArgs = {
# # inherit colors font;
# inherit helix slippi hyprland hardware disko home-manager;
# inherit (outputs) nixosModules homeManagerModules diskoConfigurations overlays;
# };
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAPLXOjupz3ScYjgrF+ehrbp9OvGAWQLI6fplX6w9Ijb daniel@lyte.dev";
2024-06-28 09:51:25 -05:00
in {
2024-06-28 14:01:32 -05:00
# kind of a quirk, but package definitions are actually in the "additions"
# overlay I did this to work around some recursion problems
2024-07-11 12:51:51 -05:00
# TODO: https://discourse.nixos.org/t/infinite-recursion-getting-started-with-overlays/48880
2024-06-28 14:01:32 -05:00
packages = genPkgs (pkgs: {inherit (pkgs) iosevkaLyteTerm iosevkaLyteTermSubset;});
2024-06-28 09:51:25 -05:00
diskoConfigurations = import ./disko;
templates = import ./templates;
formatter = genPkgs (p: p.alejandra);
2023-10-06 01:30:15 -05:00
2024-06-28 11:50:18 -05:00
checks = pkg ({system}: {
2024-06-28 09:51:25 -05:00
pre-commit-check = pre-commit.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
};
2024-06-28 11:50:18 -05:00
}) {};
2024-06-28 11:50:18 -05:00
devShells = pkg ({
2024-06-28 09:51:25 -05:00
system,
pkgs,
mkShell,
}: {
default = mkShell {
inherit (outputs.checks.${system}.pre-commit-check) shellHook;
2024-03-25 09:44:55 -05:00
buildInputs = with pkgs; [
lua-language-server
2024-06-28 09:51:25 -05:00
nodePackages.bash-language-server
2024-03-25 09:44:55 -05:00
];
2024-06-28 09:51:25 -05:00
};
2024-06-28 11:50:18 -05:00
}) {};
2024-06-28 09:51:25 -05:00
overlays = {
2024-06-28 11:50:18 -05:00
# the default overlay composes all the other overlays together
default = final: prev: {
2024-06-28 14:01:32 -05:00
overlays = with overlays; [
2024-06-28 11:50:18 -05:00
additions
modifications
2024-06-29 01:40:25 -05:00
unstable-packages
2024-06-28 11:50:18 -05:00
];
};
2024-06-28 14:01:32 -05:00
additions = final: prev: let
iosevkaLyteTerm = prev.callPackage ./packages/iosevkaLyteTerm.nix {};
in {
inherit iosevkaLyteTerm;
iosevkaLyteTermSubset = prev.callPackage ./packages/iosevkaLyteTermSubset.nix {
inherit iosevkaLyteTerm;
};
};
2023-10-03 11:52:44 -05:00
2024-06-28 09:51:25 -05:00
modifications = final: prev: {
2024-06-28 14:01:32 -05:00
final.helix = helix.outputs.packages.${prev.system}.helix;
};
2023-10-03 11:52:44 -05:00
2024-06-29 01:40:25 -05:00
unstable-packages = final: _prev: {
unstable-packages = import nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
2024-06-28 11:50:18 -05:00
};
nixosModules = import ./modules/nixos {
inherit home-manager helix nixosModules homeManagerModules pubkey overlays colors sops-nix disko;
flakeInputs = self.inputs;
2024-06-28 11:50:18 -05:00
};
homeManagerModules = import ./modules/home-manager {
inherit home-manager helix nixosModules homeManagerModules pubkey overlays colors;
2024-06-28 21:36:19 -05:00
inherit (nixpkgs) lib;
flakeInputs = self.inputs;
2024-06-28 14:01:32 -05:00
};
nixosConfigurations = {
beefcake = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
hardware.nixosModules.common-cpu-intel
2024-07-11 12:51:51 -05:00
common
2024-06-28 14:01:32 -05:00
fonts
2024-07-11 12:51:51 -05:00
./nixos/beefcake.nix
2024-06-28 14:01:32 -05:00
{
time = {
timeZone = "America/Chicago";
};
services.smartd.enable = true;
services.fwupd.enable = true;
2024-06-28 14:44:46 -05:00
}
2024-06-28 14:01:32 -05:00
];
};
dragon = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
2024-06-28 22:04:37 -05:00
outputs.diskoConfigurations.standard
hardware.nixosModules.common-cpu-amd
hardware.nixosModules.common-pc-ssd
2024-06-28 14:01:32 -05:00
2024-07-11 12:51:51 -05:00
common
2024-07-10 09:57:10 -05:00
password-manager
wifi
graphical-workstation
music-production
gaming
slippi.nixosModules.default
2024-06-28 14:01:32 -05:00
./nixos/dragon.nix
2024-06-28 14:01:32 -05:00
{
2024-06-28 14:01:32 -05:00
home-manager.users.daniel = {
imports = with homeManagerModules; [
senpai
iex
cargo
firefox-no-tabs
linux-desktop-environment-config
slippi.homeManagerModules.default
];
};
2024-06-28 14:44:46 -05:00
}
2024-06-28 14:01:32 -05:00
];
};
2024-06-28 11:50:18 -05:00
2024-06-29 00:51:22 -05:00
htpc = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
hardware.nixosModules.common-pc-ssd
2024-07-11 12:51:51 -05:00
common
2024-06-29 00:51:22 -05:00
graphical-workstation
./nixos/htpc.nix
{
home-manager.users.daniel = {
imports = with homeManagerModules; [
linux-desktop-environment-config
];
};
}
];
};
2024-06-28 14:44:46 -05:00
foxtrot = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
2024-06-28 21:36:19 -05:00
outputs.diskoConfigurations.standard
hardware.nixosModules.framework-13-7040-amd
2024-07-11 12:51:51 -05:00
common
2024-07-11 21:25:18 -05:00
password-manager
2024-06-28 21:36:19 -05:00
graphical-workstation
laptop
gaming
2024-06-28 14:44:46 -05:00
./nixos/foxtrot.nix
2024-06-28 21:36:19 -05:00
({pkgs, ...}: {
2024-06-28 21:36:19 -05:00
home-manager.users.daniel = {
imports = with homeManagerModules; [
senpai
iex
cargo
firefox-no-tabs
linux-desktop-environment-config
];
};
2024-07-14 22:29:42 -05:00
environment.systemPackages = with pkgs; [
fw-ectool
(writeShellApplication
{
name = "reset-wifi-module";
runtimeInputs = with pkgs; [kmod];
text = ''
modprobe -rv mt7921e
modprobe -v mt7921e
'';
})
];
})
2024-06-28 11:50:18 -05:00
];
};
2024-06-28 14:44:46 -05:00
thablet = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
2024-06-28 21:36:19 -05:00
outputs.diskoConfigurations.standard
hardware.nixosModules.lenovo-thinkpad-x1-yoga
2024-06-29 02:55:19 -05:00
common
2024-07-13 10:32:19 -05:00
password-manager
2024-06-29 02:55:19 -05:00
graphical-workstation
laptop
gaming
./nixos/thablet.nix
{
home-manager.users.daniel = {
imports = with homeManagerModules; [
iex
cargo
linux-desktop-environment-config
];
};
}
];
};
2024-07-11 12:51:51 -05:00
# grablet = nixpkgs.lib.nixosSystem {
# system = "x86_64-linux";
# modules = with nixosModules; [
# common
# outputs.diskoConfigurations.standard
# hardware.nixosModules.common-cpu-intel-kaby-lake
# hardware.nixosModules.common-pc-laptopp-ssd
# graphical-workstation
# laptop
# gaming
# ./nixos/thablet.nix
# {
# home-manager.users.daniel = {
# imports = with homeManagerModules; [
# iex
# cargo
# linux-desktop-environment-config
# ];
# };
# powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
# }
# ];
# };
2024-06-28 14:44:46 -05:00
thinker = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
2024-06-28 11:50:18 -05:00
common
2024-06-28 14:44:46 -05:00
./nixos/thinker.nix
2024-06-28 11:50:18 -05:00
];
};
2024-06-28 09:51:25 -05:00
2024-06-28 14:44:46 -05:00
rascal = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
2024-06-28 15:50:00 -05:00
hardware.nixosModules.common-cpu-amd
2024-06-28 14:44:46 -05:00
common
./nixos/rascal.nix
];
};
router = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with nixosModules; [
2024-07-13 14:41:30 -05:00
outputs.diskoConfigurations.unencrypted
common
./nixos/router.nix
2024-06-28 14:44:46 -05:00
];
};
};
2024-06-28 09:51:25 -05:00
2024-06-28 14:44:46 -05:00
# TODO: homeconfigs?
2024-06-28 09:51:25 -05:00
# homeConfigurations = {
# # TODO: non-system-specific home configurations?
# "deck" = let
# system = "x86_64-linux";
# in
# home-manager.lib.homeManagerConfiguration {
# pkgs = pkgsFor system;
# extraSpecialArgs = moduleArgs;
2024-06-28 14:01:32 -05:00
# modules = with homeManagerModules; [
2024-06-28 09:51:25 -05:00
# common
# {
# home.homeDirectory = "/home/deck";
# home.username = "deck";
# home.stateVersion = "24.05";
# }
# linux
# ];
# };
# workm1 = let
# system = "aarch64-darwin";
# in
# home-manager.lib.homeManagerConfiguration {
# pkgs = pkgsFor system;
# extraSpecialArgs = moduleArgs;
2024-06-28 14:01:32 -05:00
# modules = with homeManagerModules; [
2024-06-28 09:51:25 -05:00
# common
# {
# home.homeDirectory = "/Users/daniel.flanagan";
# home.username = "daniel.flanagan";
# home.stateVersion = "24.05";
# }
# macos
# ];
# };
# };
2024-01-04 14:45:10 -06:00
# TODO: nix-on-droid for phone terminal usage?
# TODO: nix-darwin for work?
# TODO: nixos ISO?
2023-12-19 10:27:11 -06:00
};
2023-09-04 11:40:30 -05:00
}