flake root cleanup

This commit is contained in:
Daniel Flanagan 2024-06-28 09:51:25 -05:00
parent f87fbad500
commit a783f6c146
8 changed files with 297 additions and 284 deletions

222
flake.nix
View file

@ -11,8 +11,8 @@
sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs"; sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; pre-commit.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; pre-commit.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
@ -26,29 +26,51 @@
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
nixpkgs-unstable,
disko,
# sops-nix,
pre-commit,
home-manager, home-manager,
helix,
hardware, hardware,
pre-commit-hooks, hyprland,
slippi,
... ...
} @ inputs: let }: let
inherit (self) outputs;
# TODO: make @ inputs unnecessary by making arguments explicit in all modules? # TODO: make @ inputs unnecessary by making arguments explicit in all modules?
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"]; systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
forSystems = nixpkgs.lib.genAttrs systems; forSystems = nixpkgs.lib.genAttrs systems;
pkgsFor = system: import nixpkgs {inherit system;}; pkgsFor = system: (import nixpkgs {
genPkgs = f: (f (forSystems pkgsFor)); inherit system;
in { inherit (outputs) overlays;
colors = (import ./lib/colors.nix {inherit (nixpkgs) lib;}).schemes.catppuccin-mocha-sapphire; });
# colors = (import ./lib/colors.nix inputs).color-schemes.donokai; genPkgs = func: (forSystems (system: func (pkgsFor system)));
pkg = callee: overrides: genPkgs (pkgs: pkgs.callPackage callee overrides);
vanillaPkg = callee: pkg callee {};
font = { # colors = (pkg ./lib/colors.nix {}).schemes.catppuccin-mocha-sapphire;
name = "IosevkaLyteTerm";
size = 12; # font = {
# name = "IosevkaLyteTerm";
# size = 12;
# };
moduleArgs = {
# inherit colors font;
inherit helix slippi hyprland hardware disko home-manager;
inherit (outputs) nixosModules homeManagerModules diskoConfigurations overlays;
}; };
in {
diskoConfigurations = import ./disko;
templates = import ./templates;
packages = vanillaPkg ./packages;
packages = genPkgs (pkgs: import ./packages {inherit pkgs;}); formatter = genPkgs (p: p.alejandra);
formatter = genPkgs (pkgs: pkgs.alejandra);
checks = genPkgs (pkgs: { checks = vanillaPkg ({system}: {
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run { pre-commit-check = pre-commit.lib.${system}.run {
src = ./.; src = ./.;
hooks = { hooks = {
alejandra.enable = true; alejandra.enable = true;
@ -56,109 +78,97 @@
}; };
}); });
devShell = genPkgs (pkgs: devShells = vanillaPkg ({
pkgs.mkShell { system,
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook; pkgs,
mkShell,
}: {
default = mkShell {
inherit (outputs.checks.${system}.pre-commit-check) shellHook;
buildInputs = with pkgs; [ buildInputs = with pkgs; [
lua-language-server lua-language-server
nodePackages.bash-language-server
]; ];
};
}); });
overlays = import ./overlays {inherit nixpkgs;}; overlays = {
additions = _final: prev: outputs.packages.${prev.system};
modifications = final: prev: {
final.helix = helix.outputs.packages.${final.system}.helix;
};
unstable-packages = final: _prev: {
final.unstable = import nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
};
nixosModules = import ./modules/nixos; nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager; homeManagerModules = import ./modules/home-manager;
nixosConfigurations = # nixosConfigurations =
(builtins.mapAttrs (name: { # (builtins.mapAttrs (name: {
system, # system,
modules, # modules,
... # ...
}: # }:
# let # nixpkgs.lib.nixosSystem {
# commonModules = # inherit system;
# # specialArgs = moduleArgs;
# modules =
# [
# self.nixosModules.common
# ]
# ++ modules;
# }) (import ./nixos))
# // {
# beefcake = nixpkgs.lib.nixosSystem {
# system = "x86_64-linux";
# specialArgs = moduleArgs;
# modules = [self.nixosModules.common ./nixos/beefcake.nix];
# };
# };
# homeConfigurations = {
# # TODO: non-system-specific home configurations?
# "deck" = let
# system = "x86_64-linux";
# in # in
nixpkgs.lib.nixosSystem { # home-manager.lib.homeManagerConfiguration {
inherit system; # pkgs = pkgsFor system;
specialArgs = { # extraSpecialArgs = moduleArgs;
# TODO: avoid special args and actually pass inputs to modules? # modules = with self.outputs.homeManagerModules; [
inherit (self) outputs; # common
inherit inputs hardware; # {
}; # home.homeDirectory = "/home/deck";
# extraSpecialArgs = { # home.username = "deck";
# inherit inputs outputs system; # home.stateVersion = "24.05";
# }
# linux
# ];
# }; # };
modules = # workm1 = let
[ # system = "aarch64-darwin";
self.nixosModules.common # in
] # home-manager.lib.homeManagerConfiguration {
++ modules; # pkgs = pkgsFor system;
}) (import ./nixos)) # extraSpecialArgs = moduleArgs;
// { # modules = with self.outputs.homeManagerModules; [
beefcake = nixpkgs.lib.nixosSystem { # common
system = "x86_64-linux"; # {
specialArgs = { # home.homeDirectory = "/Users/daniel.flanagan";
inherit (self) outputs; # home.username = "daniel.flanagan";
inherit inputs hardware; # home.stateVersion = "24.05";
}; # }
modules = [self.nixosModules.common ./nixos/beefcake.nix]; # macos
}; # ];
# rascal = {
# system = "x86_64-linux";
# modules = [./rascal.nix];
# }; # };
# router = {
# system = "x86_64-linux";
# modules = [./router.nix];
# }; # };
};
homeConfigurations = {
# TODO: non-system-specific home configurations?
"deck" = let
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor system;
extraSpecialArgs = {
inherit (self) outputs;
inherit inputs system;
inherit (self.outputs) colors font;
};
modules = with self.outputs.homeManagerModules; [
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 = {
inherit (self) outputs;
inherit inputs system;
inherit (self.outputs) colors font;
};
modules = with self.outputs.homeManagerModules; [
common
{
home.homeDirectory = "/Users/daniel.flanagan";
home.username = "daniel.flanagan";
home.stateVersion = "24.05";
}
macos
];
};
};
diskoConfigurations = import ./disko;
templates = import ./templates/all.nix;
# TODO: nix-on-droid for phone terminal usage? # TODO: nix-on-droid for phone terminal usage?
# TODO: nix-darwin for work? # TODO: nix-darwin for work?

View file

@ -1,9 +1,12 @@
{ {
overlays,
config, config,
lib, lib,
inputs,
outputs,
pkgs, pkgs,
colors,
sops-nix,
home-manager,
disko,
modulesPath, modulesPath,
... ...
}: let }: let
@ -13,14 +16,14 @@ in {
imports = imports =
[ [
(modulesPath + "/installer/scan/not-detected.nix") # (modulesPath + "/installer/scan/not-detected.nix")
inputs.sops-nix.nixosModules.sops # sops-nix.nixosModules.sops
inputs.disko.nixosModules.disko # disko.nixosModules.disko
inputs.home-manager.nixosModules.home-manager # home-manager.nixosModules.home-manager
] ]
++ [ ++ [
./avahi.nix # ./avahi.nix
./daniel.nix # ./daniel.nix
]; ];
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
@ -174,7 +177,7 @@ in {
useXkbConfig = true; useXkbConfig = true;
earlySetup = true; earlySetup = true;
colors = with outputs.colors; [ colors = with colors; [
bg bg
red red
green green
@ -263,9 +266,9 @@ in {
# You can add overlays here # You can add overlays here
overlays = [ overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir): # Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions overlays.additions
outputs.overlays.modifications overlays.modifications
outputs.overlays.unstable-packages overlays.unstable-packages
# You can also add overlays exported from other flakes: # You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default # neovim-nightly-overlay.overlays.default

View file

@ -1,5 +0,0 @@
{inputs, ...}: {
imports = [
inputs.slippi.nixosModules.default
];
}

View file

@ -4,46 +4,35 @@
modules = [./base.nix]; modules = [./base.nix];
}; };
# workstation
dragon = { dragon = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [./dragon.nix]; modules = [
./dragon.nix
];
}; };
# primary laptop
foxtrot = { foxtrot = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [./foxtrot.nix]; modules = [./foxtrot.nix];
}; };
# entertainment convertible laptop
thablet = { thablet = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [./thablet.nix]; modules = [./thablet.nix];
}; };
# thinkpad backup laptop
thinker = { thinker = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [./thinker.nix]; modules = [./thinker.nix];
}; };
# TODO: stabilize these machines on nixpkgs-stable
# owned offsite backup
rascal = { rascal = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [./rascal.nix]; modules = [./rascal.nix];
}; };
# TODO: deploy this to the actual router
# home gateway
router = { router = {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [./router.nix]; modules = [./router.nix];
}; };
# htpifour = {
# system = "aarch64-linux";
# modules = [./htpifour.nix];
# };
} }

View file

@ -1,7 +1,13 @@
{ {
config, # flake inputs
inputs, hardware,
outputs, slippi,
# inputs from our flake
diskoConfigurations,
nixosModules,
homeManagerModules,
# module args
# config,
lib, lib,
pkgs, pkgs,
... ...
@ -11,156 +17,163 @@
# support interacting with the windows drive # support interacting with the windows drive
boot.supportedFilesystems = ["ntfs"]; boot.supportedFilesystems = ["ntfs"];
imports = with outputs.nixosModules; [ imports = with nixosModules; [
outputs.diskoConfigurations.standard # diskoConfigurations.standard
inputs.hardware.nixosModules.common-cpu-amd # hardware.nixosModules.common-cpu-amd
inputs.hardware.nixosModules.common-pc-ssd # hardware.nixosModules.common-pc-ssd
outputs.nixosModules.pipewire-low-latency
outputs.nixosModules.music-production
desktop-usage # slippi.outputs.nixosModules.default
podman
kde-plasma # pipewire-low-latency
postgres # music-production
wifi # desktop-usage
# hyprland # podman
printing # kde-plasma
melee # postgres
steam # wifi
lutris # # hyprland
# printing
# steam
# lutris
]; ];
programs.steam = { # programs.steam = {
enable = true; # enable = true;
remotePlay.openFirewall = true; # remotePlay.openFirewall = true;
gamescopeSession.enable = true; # gamescopeSession.enable = true;
}; # };
environment = { # environment = {
systemPackages = with pkgs; [ # systemPackages = with pkgs; [
spotify # spotify
discord # discord
radeontop # radeontop
slack # slack
godot_4 # godot_4
fractal # fractal
jdk17 # jdk17
prismlauncher # prismlauncher
# variety # # variety
radeontop # radeontop
sops # sops
obs-studio # obs-studio
xh # xh
]; # ];
}; # };
home-manager.users.daniel = { # home-manager.users.daniel = {
imports = with outputs.homeManagerModules; [ # imports = with homeManagerModules; [
sway # # sway
pass # # pass
firefox-no-tabs # # firefox-no-tabs
# wallpaper-manager # # # wallpaper-manager
inputs.slippi.homeManagerModules.default # # slippi.homeManagerModules.default
{ # # {
slippi.launcher = { # # slippi.launcher = {
enable = true; # # enable = true;
isoPath = "${config.home-manager.users.daniel.home.homeDirectory}/../games/roms/dolphin/melee.iso"; # # isoPath = "${config.home-manager.users.daniel.home.homeDirectory}/../games/roms/dolphin/melee.iso";
launchMeleeOnPlay = false; # # launchMeleeOnPlay = false;
}; # # };
} # # }
hyprland # # hyprland
]; # ];
services.mako.enable = lib.mkForce false; # don't use mako when using plasma # services.mako.enable = lib.mkForce false; # don't use mako when using plasma
wayland.windowManager.hyprland = { # wayland.windowManager.hyprland = {
settings = { # settings = {
env = [ # env = [
"EWW_BAR_MON,1" # "EWW_BAR_MON,1"
]; # ];
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # # See https://wiki.hyprland.org/Configuring/Keywords/ for more
monitor = [ # monitor = [
# "DP-2,3840x2160@60,-2160x0,1,transform,3" # # "DP-2,3840x2160@60,-2160x0,1,transform,3"
"DP-3,3840x2160@120,${toString (builtins.ceil (2160 / 1.5))}x0,1" # "DP-3,3840x2160@120,${toString (builtins.ceil (2160 / 1.5))}x0,1"
# HDR breaks screenshare? "DP-3,3840x2160@120,${toString (builtins.ceil (2160 / 1.5))}x0,1,bitdepth,10" # # HDR breaks screenshare? "DP-3,3840x2160@120,${toString (builtins.ceil (2160 / 1.5))}x0,1,bitdepth,10"
# "desc:LG Display 0x0521,3840x2160@120,0x0,1" # # "desc:LG Display 0x0521,3840x2160@120,0x0,1"
# "desc:Dell Inc. DELL U2720Q D3TM623,3840x2160@60,3840x0,1.5,transform,1" # # "desc:Dell Inc. DELL U2720Q D3TM623,3840x2160@60,3840x0,1.5,transform,1"
"DP-2,3840x2160@60,0x0,1.5,transform,1" # "DP-2,3840x2160@60,0x0,1.5,transform,1"
]; # ];
input = { # input = {
force_no_accel = true; # force_no_accel = true;
sensitivity = 1; # -1.0 - 1.0, 0 means no modification. # sensitivity = 1; # -1.0 - 1.0, 0 means no modification.
}; # };
}; # };
}; # };
wayland.windowManager.sway = { # wayland.windowManager.sway = {
config = { # config = {
output = { # output = {
"GIGA-BYTE TECHNOLOGY CO., LTD. AORUS FO48U 23070B000307" = { # "GIGA-BYTE TECHNOLOGY CO., LTD. AORUS FO48U 23070B000307" = {
mode = "3840x2160@120Hz"; # mode = "3840x2160@120Hz";
position = "${toString (builtins.ceil (2160 / 1.5))},0"; # position = "${toString (builtins.ceil (2160 / 1.5))},0";
}; # };
"Dell Inc. DELL U2720Q D3TM623" = { # "Dell Inc. DELL U2720Q D3TM623" = {
# desktop left vertical monitor # # desktop left vertical monitor
mode = "3840x2160@60Hz"; # mode = "3840x2160@60Hz";
transform = "90"; # transform = "90";
scale = "1.5"; # scale = "1.5";
position = "0,0"; # position = "0,0";
}; # };
}; # };
workspaceOutputAssign = # workspaceOutputAssign =
( # (
map # map
(ws: { # (ws: {
output = "GIGA-BYTE TECHNOLOGY CO., LTD. AORUS FO48U 23070B000307"; # output = "GIGA-BYTE TECHNOLOGY CO., LTD. AORUS FO48U 23070B000307";
workspace = toString ws; # workspace = toString ws;
}) # })
(lib.range 1 7) # (lib.range 1 7)
) # )
++ ( # ++ (
map # map
(ws: { # (ws: {
output = "Dell Inc. DELL U2720Q D3TM623"; # output = "Dell Inc. DELL U2720Q D3TM623";
workspace = toString ws; # workspace = toString ws;
}) # })
(lib.range 8 9) # (lib.range 8 9)
); # );
}; # };
}; # };
}; # };
services.printing.enable = true; # services.printing.enable = true;
# TODO: https://nixos.wiki/wiki/Remote_LUKS_Unlocking # # TODO: https://nixos.wiki/wiki/Remote_LUKS_Unlocking
# hardware # # hardware
boot.loader.efi.canTouchEfiVariables = true; # boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = true; # boot.loader.systemd-boot.enable = true;
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "ahci"]; # boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "ahci"];
boot.kernelModules = ["kvm-amd"]; # boot.kernelModules = ["kvm-amd"];
hardware.bluetooth = { # hardware.bluetooth = {
enable = true; # enable = true;
package = pkgs.bluez; # package = pkgs.bluez;
# powerOnBoot = true; # this is the default # # powerOnBoot = true; # this is the default
}; # settings = {
powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; # General = {
# AutoConnect = true;
networking = { # MultiProfile = "multiple";
firewall = let # };
terraria = 7777; # };
stardew-valley = 24642; # };
in { # powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
enable = true;
allowPing = true; # networking = {
allowedTCPPorts = [22 terraria stardew-valley]; # firewall = let
allowedUDPPorts = [terraria stardew-valley]; # terraria = 7777;
}; # stardew-valley = 24642;
}; # in {
# enable = true;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion # allowPing = true;
system.stateVersion = "24.05"; # allowedTCPPorts = [22 terraria stardew-valley];
# allowedUDPPorts = [terraria stardew-valley];
# };
# };
# # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
# system.stateVersion = "24.05";
} }

View file

@ -2,7 +2,7 @@
# This one brings our custom packages from the 'pkgs' directory # This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: additions = final: _prev:
import ../packages { import ../packages {
pkgs = nixpkgs.legacyPackages.${final.system}; pkgs = import nixpkgs {inherit (final) system;};
}; };
# This one contains whatever you want to overlay # This one contains whatever you want to overlay

View file

@ -24,10 +24,13 @@
}; };
}); });
devShell = genPkgs (pkgs: devShells = genPkgs (pkgs: {
pkgs.mkShell { nix = pkgs.mkShell {
buildInputs = with pkgs; [nil alejandra]; buildInputs = with pkgs; [nil alejandra];
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook; inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook;
};
default = self.outputs.devShells.${pkgs.system}.nix;
}); });
# packages = genPkgs (pkgs: import ./pkgs {inherit pkgs;}); # packages = genPkgs (pkgs: import ./pkgs {inherit pkgs;});