Compare commits
2 commits
c6100f63d7
...
32771cf392
Author | SHA1 | Date | |
---|---|---|---|
32771cf392 | |||
7539811ce3 |
61 changed files with 427 additions and 333 deletions
124
flake.nix
124
flake.nix
|
@ -57,121 +57,27 @@
|
|||
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, home-manager, nix-index-database, vscode-server, colmena, ... }: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
secrets = import ./secrets.nix;
|
||||
outputs = inputs@{ self, colmena, ... }: let
|
||||
utils = import ./utils {
|
||||
inherit inputs;
|
||||
secrets = import ./secrets.nix;
|
||||
};
|
||||
in {
|
||||
nixosConfigurations.ty-nixos = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./hosts/laptop
|
||||
|
||||
# Better command-not-found
|
||||
nix-index-database.nixosModules.nix-index
|
||||
{ programs.nix-index-database.comma.enable = true; }
|
||||
|
||||
# Home manager
|
||||
home-manager.nixosModules.home-manager
|
||||
./home-manager
|
||||
{
|
||||
ty-home-manager-options = {
|
||||
plasma.enable = true;
|
||||
beets.enable = true;
|
||||
firefox.enable = true;
|
||||
thunderbird.enable = true;
|
||||
rescrobbled.enable = true;
|
||||
vscode.enable = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
specialArgs = {
|
||||
inherit inputs system secrets;
|
||||
};
|
||||
# Setup nixos-rebuild configurations
|
||||
nixosConfigurations = {
|
||||
"ty-nixos" = utils.createNixosSystem { entrypoint = ./hosts/laptop; };
|
||||
"ty-laptop-server" = utils.createNixosSystem { entrypoint = ./hosts/laptop-server; };
|
||||
};
|
||||
|
||||
nixosConfigurations."ty-laptop-server" = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./hosts/laptop-server
|
||||
|
||||
# Better command-not-found
|
||||
nix-index-database.nixosModules.nix-index
|
||||
{ programs.nix-index-database.comma.enable = true; }
|
||||
|
||||
# Home manager
|
||||
home-manager.nixosModules.home-manager
|
||||
./home-manager
|
||||
{
|
||||
ty-home-manager-options = {
|
||||
plasma.enable = false;
|
||||
beets.enable = false;
|
||||
firefox.enable = false;
|
||||
thunderbird.enable = false;
|
||||
rescrobbled.enable = false;
|
||||
vscode.enable = false;
|
||||
};
|
||||
}
|
||||
|
||||
# VSCode server support
|
||||
vscode-server.nixosModules.default
|
||||
({ pkgs, ... }: { services.vscode-server = { enable = true; nodejsPackage = pkgs.nodejs-18_x; installPath = "$HOME/.vscodium-server"; }; })
|
||||
# Setup colmena configurations
|
||||
colmena = utils.createColmenaHive {
|
||||
hostConfigs = [
|
||||
{ name = "ty-nixos"; entrypoint = ./hosts/laptop; }
|
||||
{ name = "ty-laptop-server"; entrypoint = ./hosts/laptop-server; sshHost = "old-lenovo-laptop"; }
|
||||
];
|
||||
|
||||
specialArgs = {
|
||||
inherit inputs system secrets;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable direct flake support for colmena
|
||||
colmenaHive = colmena.lib.makeHive self.outputs.colmena;
|
||||
colmena = {
|
||||
meta = {
|
||||
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
specialArgs = {
|
||||
inherit inputs secrets;
|
||||
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
allowApplyAll = false;
|
||||
};
|
||||
|
||||
"ty-laptop-server" = { config, ... }: {
|
||||
deployment = {
|
||||
replaceUnknownProfiles = false;
|
||||
targetUser = "root";
|
||||
targetHost = "old-lenovo-laptop"; # i should rename my tailscale devices properly
|
||||
targetPort = 22;
|
||||
};
|
||||
|
||||
imports = [
|
||||
./hosts/laptop-server
|
||||
|
||||
# Better command-not-found
|
||||
nix-index-database.nixosModules.nix-index
|
||||
{ programs.nix-index-database.comma.enable = true; }
|
||||
|
||||
# Home manager
|
||||
home-manager.nixosModules.home-manager
|
||||
./home-manager
|
||||
{
|
||||
ty-home-manager-options = {
|
||||
plasma.enable = false;
|
||||
beets.enable = false;
|
||||
firefox.enable = false;
|
||||
thunderbird.enable = false;
|
||||
rescrobbled.enable = false;
|
||||
vscode.enable = false;
|
||||
};
|
||||
}
|
||||
|
||||
# VSCode server support
|
||||
vscode-server.nixosModules.default
|
||||
({ pkgs, ... }: { services.vscode-server = { enable = true; nodejsPackage = pkgs.nodejs-18_x; installPath = "$HOME/.vscodium-server"; }; })
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, ty-home-manager-options, ... }:
|
||||
{ lib, config, ... }:
|
||||
{
|
||||
accounts.email.accounts = lib.mkIf ty-home-manager-options.thunderbird.enable {
|
||||
accounts.email.accounts = lib.mkIf config.meta.home-manager.email.enable {
|
||||
PurelyMail = rec {
|
||||
realName = "Tyler Beckman";
|
||||
address = "ty@myriation.xyz";
|
||||
|
@ -38,7 +38,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
thunderbird.enable = true;
|
||||
thunderbird.enable = config.meta.home-manager.email.thunderbird.enable;
|
||||
};
|
||||
|
||||
Gmail = rec {
|
||||
|
@ -62,7 +62,7 @@
|
|||
|
||||
smtp.tls.useStartTls = false;
|
||||
|
||||
thunderbird.enable = true;
|
||||
thunderbird.enable = config.meta.home-manager.email.thunderbird.enable;
|
||||
};
|
||||
|
||||
School = rec {
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, secrets, ty-home-manager-options, ... }:
|
||||
{ lib, secrets, config, ... }:
|
||||
{
|
||||
programs.beets = lib.mkIf ty-home-manager-options.beets.enable {
|
||||
programs.beets = lib.mkIf config.meta.home-manager.beets.enable {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
20
home-manager/config/default.nix
Normal file
20
home-manager/config/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
# Directories
|
||||
./accounts
|
||||
./shell
|
||||
./vcs
|
||||
# Individual files
|
||||
./beets.nix
|
||||
./desktop.nix
|
||||
./firefox.nix
|
||||
./gpg.nix
|
||||
./gtk.nix
|
||||
./packages.nix
|
||||
./plasma.nix
|
||||
./rescrobbled.nix
|
||||
./thunderbird.nix
|
||||
./vscode.nix
|
||||
];
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, ty-home-manager-options, ... }:
|
||||
{ lib, config, ... }:
|
||||
{
|
||||
xdg.desktopEntries = lib.mkIf ty-home-manager-options.plasma.enable {
|
||||
xdg.desktopEntries = lib.mkIf config.meta.home-manager.desktop.enable {
|
||||
# Override vesktop for matching icon in beautyline (make it generic discord icon)
|
||||
vesktop = {
|
||||
categories = [ "Network" "InstantMessaging" "Chat" ];
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, inputs, system, lib, ty-home-manager-options, ... }:
|
||||
{ pkgs, inputs, system, lib, config, ... }:
|
||||
{
|
||||
programs.firefox = lib.mkIf ty-home-manager-options.firefox.enable {
|
||||
programs.firefox = lib.mkIf config.meta.home-manager.firefox.enable {
|
||||
enable = true;
|
||||
policies = {
|
||||
ExtensionSettings = {
|
|
@ -1,12 +1,12 @@
|
|||
{ pkgs, lib, config, ty-home-manager-options, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
config = lib.mkIf ty-home-manager-options.plasma.enable {
|
||||
config = lib.mkIf config.meta.home-manager.desktop.enable {
|
||||
gtk = {
|
||||
enable = true;
|
||||
|
||||
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
|
||||
|
||||
theme = {
|
||||
theme = lib.mkIf config.meta.home-manager.desktop.plasma.enable {
|
||||
name = "Breeze-Dark";
|
||||
package = pkgs.kdePackages.breeze-gtk;
|
||||
};
|
73
home-manager/config/packages.nix
Executable file
73
home-manager/config/packages.nix
Executable file
|
@ -0,0 +1,73 @@
|
|||
{ pkgs, inputs, system, lib, config, ... }:
|
||||
{
|
||||
home.packages =
|
||||
## Packages that are always installed, no matter what
|
||||
(with pkgs; [
|
||||
# :3
|
||||
fastfetch # Modern & faster neofetch alternative
|
||||
|
||||
# CLI Tools
|
||||
ripgrep # Text searching and manipulation
|
||||
jq # JSON filtering
|
||||
eza # Directory lister
|
||||
bat # File reading
|
||||
doggo # DNS Requests
|
||||
nmap # Network scanning
|
||||
glow # Markdown rendering
|
||||
tealdeer # TLDR
|
||||
usbutils # `lsusb`
|
||||
pciutils # `lspci`
|
||||
unzip # Extract zip files
|
||||
|
||||
# Process tools
|
||||
btop # Process monitor
|
||||
nvtopPackages.full # GPU monitor
|
||||
])
|
||||
## Packages that are only installed when a desktop environment is desired
|
||||
++ (lib.optionals config.meta.home-manager.desktop.enable (with pkgs; [
|
||||
# Documents
|
||||
logseq # Outliner
|
||||
libreoffice-qt6-fresh # Office-style editing
|
||||
hunspell
|
||||
hunspellDicts.en_US-large
|
||||
|
||||
# Video
|
||||
jellyfin-media-player # Jellyfin electron client w/ MPV
|
||||
vlc # Video file player
|
||||
|
||||
# Chat
|
||||
element-desktop # Matrix client
|
||||
vesktop # Discord client
|
||||
signal-desktop # Signal client
|
||||
|
||||
# KDE Themes
|
||||
vimix-cursors # Cursors
|
||||
(pkgs.callPackage ../../packages/beautyline {}) # Icons
|
||||
(pkgs.callPackage ../../packages/magna-splash-6 {}) # Splash
|
||||
|
||||
# Programming
|
||||
jetbrains.idea-ultimate # Jetbrains IntelliJ Idea Ultimate IDE
|
||||
nixd # LSP for .nix files
|
||||
gcc # GNU C++ Compiler
|
||||
(lib.meta.hiPrio clang) # LLVM C++ Compiler (better than g++)
|
||||
clang-tools # Clang language server
|
||||
cling # C++ REPL
|
||||
deno # Typescript & Javascript runtime
|
||||
gnumake # Makefile support
|
||||
|
||||
# UI Tools
|
||||
qalculate-qt # Calculator
|
||||
]))
|
||||
## Packages that are only installed if plasma is used as the desktop environment
|
||||
++ (lib.optionals config.meta.home-manager.desktop.plasma.enable (with pkgs.kdePackages; [
|
||||
kate # IDE
|
||||
elisa # Music
|
||||
kdeconnect-kde # Phone sync
|
||||
polkit-kde-agent-1 # Polkit authentication popup support
|
||||
]))
|
||||
## Firefox is only installed when requested
|
||||
++ (lib.optionals config.meta.home-manager.firefox.enable [
|
||||
# Firefox nightly
|
||||
inputs.firefox-nightly.packages.${system}.firefox-nightly-bin
|
||||
]);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, lib, ty-home-manager-options, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
programs.plasma = lib.mkIf ty-home-manager-options.plasma.enable {
|
||||
programs.plasma = lib.mkIf config.meta.home-manager.desktop.plasma.enable {
|
||||
enable = true;
|
||||
|
||||
workspace = {
|
23
home-manager/config/rescrobbled.nix
Normal file
23
home-manager/config/rescrobbled.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ secrets, lib, config, ... }:
|
||||
{
|
||||
config = lib.mkIf config.meta.home-manager.rescrobbled.enable {
|
||||
services.custom.rescrobbled = let s = secrets.programs.rescrobbled; in lib.mkIf s.enable {
|
||||
enable = true;
|
||||
|
||||
session = s.lastfm.session;
|
||||
|
||||
settings = {
|
||||
player-whitelist = [ "elisa" ];
|
||||
|
||||
listenbrainz = lib.mkIf (s.listenbrainz.token != null) [
|
||||
{
|
||||
token = s.listenbrainz.token;
|
||||
}
|
||||
];
|
||||
|
||||
lastfm-key = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.key;
|
||||
lastfm-secret = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.secret;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, lib, ty-home-manager-options, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
programs.konsole = lib.mkIf ty-home-manager-options.plasma.enable {
|
||||
programs.konsole = lib.mkIf config.meta.home-manager.desktop.plasma.enable {
|
||||
enable = true;
|
||||
defaultProfile = "Primary";
|
||||
profiles = {
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, lib, ty-home-manager-options, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
programs.thunderbird = lib.mkIf ty-home-manager-options.thunderbird.enable {
|
||||
programs.thunderbird = lib.mkIf config.meta.home-manager.email.thunderbird.enable {
|
||||
enable = true;
|
||||
package = pkgs.thunderbird-latest;
|
||||
profiles = {
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, inputs, system, lib, ty-home-manager-options, ... }:
|
||||
{ pkgs, inputs, system, lib, config, ... }:
|
||||
{
|
||||
programs.vscode = lib.mkIf ty-home-manager-options.vscode.enable (
|
||||
programs.vscode = lib.mkIf config.meta.home-manager.vscode.enable (
|
||||
let vscode-package = pkgs.vscodium; in {
|
||||
enable = true;
|
||||
package = vscode-package;
|
|
@ -1,85 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let tomlFormat = pkgs.formats.toml { }; in {
|
||||
options = {
|
||||
services.custom.rescrobbled = {
|
||||
enable = lib.mkEnableOption "rescrobbled";
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = (pkgs.callPackage ../../packages/rescrobbled {});
|
||||
defaultText = lib.literalExpression "pkgs.rescrobbled";
|
||||
description = "The package to use for rescrobbled";
|
||||
};
|
||||
|
||||
session = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The session token to use for last.fm.
|
||||
This can be found by setting a last.fm API key & secret,
|
||||
and then manually running the daemon. Then, the session token
|
||||
will be located at {file}`$XDG_CONFIG_HOME/rescrobbled/session`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = {};
|
||||
example = lib.literalExpression ''
|
||||
lastfm-key = "Last.fm API key"
|
||||
lastfm-secret = "Last.fm API secret"
|
||||
min-play-time = 0
|
||||
player-whitelist = [ "Player MPRIS identity or bus name" ]
|
||||
filter-script = "path/to/script"
|
||||
|
||||
[[listenbrainz]]
|
||||
url = "Custom API URL"
|
||||
token = "User token"
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
{file}`$XDG_CONFIG_HOME/rescrobbled/config.toml`.
|
||||
|
||||
See <https://github.com/InputUsername/rescrobbled#configuration> for the full list
|
||||
of options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let cfg = config.services.custom.rescrobbled; in lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile ={
|
||||
"rescrobbled/config.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
enable = true;
|
||||
|
||||
source = tomlFormat.generate "rescrobbled-config" cfg.settings;
|
||||
};
|
||||
|
||||
"rescrobbled/session" = lib.mkIf (cfg.settings != { }) {
|
||||
enable = true;
|
||||
# Force makes it easy to generate the session file, then add it to nix cfg without issues
|
||||
force = true;
|
||||
|
||||
text = cfg.session;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.rescrobbled = {
|
||||
Unit = {
|
||||
Description = "An MPRIS scrobbler";
|
||||
Documentation = "https://github.com/InputUsername/rescrobbled";
|
||||
Wants = "network-online.target";
|
||||
After = "network-online.target";
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/sleep 15"; # Avoid listenbrainz errors by adding delay till network is connected
|
||||
ExecStart = "${cfg.package}/bin/rescrobbled";
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,31 +1,36 @@
|
|||
{ inputs, system, secrets, lib, config, ... }:
|
||||
{
|
||||
options.ty-home-manager-options = {
|
||||
plasma.enable = lib.mkEnableOption "plasma configuration";
|
||||
firefox.enable = lib.mkEnableOption "firefox configuration";
|
||||
thunderbird.enable = lib.mkEnableOption "thunderbird configuration";
|
||||
vscode.enable = lib.mkEnableOption "vscode configuration";
|
||||
beets.enable = lib.mkEnableOption "beets configuration";
|
||||
rescrobbled.enable = lib.mkEnableOption "rescrobbled configuration";
|
||||
};
|
||||
imports = [ ./meta.nix ];
|
||||
|
||||
config = {
|
||||
# Allow user installation of packages
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.sharedModules = [
|
||||
# Import plasma manager and all of my custom modules for use
|
||||
inputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
./custom-modules
|
||||
./modules
|
||||
];
|
||||
# Inherit all of my nixos config custom arguments
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs system secrets;
|
||||
inherit (config) ty-home-manager-options;
|
||||
};
|
||||
|
||||
# Hopefully avoid file conflicts
|
||||
home-manager.backupFileExtension = "backup";
|
||||
|
||||
home-manager.users.ty = {
|
||||
imports = [
|
||||
./home.nix
|
||||
# Import meta options for configuring the configuration
|
||||
./meta.nix
|
||||
# Import all of my config
|
||||
./config
|
||||
];
|
||||
|
||||
home.stateVersion = "24.05";
|
||||
|
||||
# Inherit my home manager config options
|
||||
meta.home-manager = config.meta.home-manager;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
home.stateVersion = "24.05";
|
||||
home.username = "ty";
|
||||
home.homeDirectory = "/home/ty";
|
||||
|
||||
imports = [
|
||||
./modules/packages.nix
|
||||
./modules/plasma.nix
|
||||
./modules/vcs
|
||||
./modules/firefox.nix
|
||||
./modules/thunderbird.nix
|
||||
./modules/accounts
|
||||
./modules/gpg.nix
|
||||
./modules/shell
|
||||
./modules/vscode.nix
|
||||
./modules/desktop.nix
|
||||
./modules/gtk.nix
|
||||
./modules/beets.nix
|
||||
./modules/rescrobbled.nix
|
||||
];
|
||||
}
|
60
home-manager/meta.nix
Normal file
60
home-manager/meta.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
options.meta.home-manager = {
|
||||
# Presets for easy configuring the configuration
|
||||
preset = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum [ "plasma-desktop" "cli" ]);
|
||||
default = null;
|
||||
defaultText = lib.literalExpression "null";
|
||||
description = ''
|
||||
The preset to use for enabling individual home-manager meta configuration options.
|
||||
|
||||
Presets:
|
||||
- plasma-desktop
|
||||
- Will enable anything that requires a desktop, and plasma-specific configuration
|
||||
- cli
|
||||
- Will only enable what is necessary for a CLI environment, excluding everything else
|
||||
'';
|
||||
};
|
||||
|
||||
# Individual configuration options
|
||||
beets.enable = lib.mkEnableOption "beets configuration";
|
||||
desktop = {
|
||||
enable = lib.mkEnableOption "configuration that requires a desktop environment";
|
||||
plasma.enable = lib.mkEnableOption "plasma configuration";
|
||||
};
|
||||
email = {
|
||||
enable = lib.mkEnableOption "email configuration";
|
||||
thunderbird.enable = lib.mkEnableOption "email configuration for thunderbird";
|
||||
};
|
||||
firefox.enable = lib.mkEnableOption "firefox configuration";
|
||||
rescrobbled.enable = lib.mkEnableOption "rescrobbled configuration";
|
||||
vscode.enable = lib.mkEnableOption "vscode configuration";
|
||||
};
|
||||
|
||||
# Handle preset logic
|
||||
config.meta.home-manager = lib.mkMerge [
|
||||
# Desktop w/ Plasma preset
|
||||
(lib.mkIf (config.meta.home-manager.preset == "plasma-desktop") {
|
||||
beets.enable = true;
|
||||
desktop.enable = true;
|
||||
desktop.plasma.enable = true;
|
||||
email.enable = true;
|
||||
email.thunderbird.enable = true;
|
||||
firefox.enable = true;
|
||||
rescrobbled.enable = true;
|
||||
vscode.enable = true;
|
||||
})
|
||||
# CLI Preset
|
||||
(lib.mkIf (config.meta.home-manager.preset == "cli") {
|
||||
beets.enable = false;
|
||||
desktop.enable = false;
|
||||
desktop.plasma.enable = false;
|
||||
email.enable = false;
|
||||
email.thunderbird.enable = false;
|
||||
firefox.enable = false;
|
||||
rescrobbled.enable = false;
|
||||
vscode.enable = false;
|
||||
})
|
||||
];
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
{ pkgs, inputs, system, lib, ty-home-manager-options, ... }:
|
||||
{
|
||||
home.packages = (with pkgs; [
|
||||
# :3
|
||||
fastfetch # Modern & faster neofetch alternative
|
||||
|
||||
# CLI Tools
|
||||
ripgrep # Text searching and manipulation
|
||||
jq # JSON filtering
|
||||
eza # Directory lister
|
||||
bat # File reading
|
||||
doggo # DNS Requests
|
||||
nmap # Network scanning
|
||||
glow # Markdown rendering
|
||||
tealdeer # TLDR
|
||||
usbutils # `lsusb`
|
||||
pciutils # `lspci`
|
||||
unzip # Extract zip files
|
||||
|
||||
# Process tools
|
||||
btop # Process monitor
|
||||
nvtopPackages.full # GPU monitor
|
||||
]) ++ (lib.optionals ty-home-manager-options.plasma.enable (with pkgs; [
|
||||
# Documents
|
||||
logseq # Outliner
|
||||
libreoffice-qt6-fresh # Office-style editing
|
||||
hunspell
|
||||
hunspellDicts.en_US-large
|
||||
|
||||
# Video
|
||||
jellyfin-media-player # Jellyfin electron client w/ MPV
|
||||
vlc # Video file player
|
||||
|
||||
# Chat
|
||||
element-desktop # Matrix client
|
||||
vesktop # Discord client
|
||||
signal-desktop # Signal client
|
||||
|
||||
# KDE Themes
|
||||
vimix-cursors # Cursors
|
||||
(pkgs.callPackage ../../packages/beautyline {}) # Icons
|
||||
(pkgs.callPackage ../../packages/magna-splash-6 {}) # Splash
|
||||
|
||||
# Programming
|
||||
jetbrains.idea-ultimate # Jetbrains IntelliJ Idea Ultimate IDE
|
||||
nixd # LSP for .nix files
|
||||
gcc # GNU C++ Compiler
|
||||
(lib.meta.hiPrio clang) # LLVM C++ Compiler (better than g++)
|
||||
clang-tools # Clang language server
|
||||
cling # C++ REPL
|
||||
deno # Typescript & Javascript runtime
|
||||
gnumake # Makefile support
|
||||
|
||||
# UI Tools
|
||||
qalculate-qt # Calculator
|
||||
])) ++ (lib.optionals ty-home-manager-options.firefox.enable [
|
||||
# Firefox nightly
|
||||
inputs.firefox-nightly.packages.${system}.firefox-nightly-bin
|
||||
]) ++ (lib.optionals ty-home-manager-options.plasma.enable (with pkgs.kdePackages; [
|
||||
kate # IDE
|
||||
elisa # Music
|
||||
kdeconnect-kde # Phone sync
|
||||
polkit-kde-agent-1 # Polkit authentication popup support
|
||||
]));
|
||||
}
|
|
@ -1,23 +1,85 @@
|
|||
{ secrets, lib, ty-home-manager-options, ... }:
|
||||
{
|
||||
config = lib.mkIf ty-home-manager-options.rescrobbled.enable {
|
||||
services.custom.rescrobbled = let s = secrets.programs.rescrobbled; in lib.mkIf s.enable {
|
||||
enable = true;
|
||||
{ pkgs, lib, config, ... }:
|
||||
let tomlFormat = pkgs.formats.toml { }; in {
|
||||
options = {
|
||||
services.custom.rescrobbled = {
|
||||
enable = lib.mkEnableOption "rescrobbled";
|
||||
|
||||
session = s.lastfm.session;
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = (pkgs.callPackage ../../packages/rescrobbled {});
|
||||
defaultText = lib.literalExpression "pkgs.rescrobbled";
|
||||
description = "The package to use for rescrobbled";
|
||||
};
|
||||
|
||||
settings = {
|
||||
player-whitelist = [ "elisa" ];
|
||||
session = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The session token to use for last.fm.
|
||||
This can be found by setting a last.fm API key & secret,
|
||||
and then manually running the daemon. Then, the session token
|
||||
will be located at {file}`$XDG_CONFIG_HOME/rescrobbled/session`.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
listenbrainz = lib.mkIf (s.listenbrainz.token != null) [
|
||||
{
|
||||
token = s.listenbrainz.token;
|
||||
}
|
||||
];
|
||||
settings = lib.mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = {};
|
||||
example = lib.literalExpression ''
|
||||
lastfm-key = "Last.fm API key"
|
||||
lastfm-secret = "Last.fm API secret"
|
||||
min-play-time = 0
|
||||
player-whitelist = [ "Player MPRIS identity or bus name" ]
|
||||
filter-script = "path/to/script"
|
||||
|
||||
lastfm-key = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.key;
|
||||
lastfm-secret = lib.mkIf (s.lastfm.key != null && s.lastfm.secret != null) s.lastfm.secret;
|
||||
[[listenbrainz]]
|
||||
url = "Custom API URL"
|
||||
token = "User token"
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
{file}`$XDG_CONFIG_HOME/rescrobbled/config.toml`.
|
||||
|
||||
See <https://github.com/InputUsername/rescrobbled#configuration> for the full list
|
||||
of options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let cfg = config.services.custom.rescrobbled; in lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile ={
|
||||
"rescrobbled/config.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
enable = true;
|
||||
|
||||
source = tomlFormat.generate "rescrobbled-config" cfg.settings;
|
||||
};
|
||||
|
||||
"rescrobbled/session" = lib.mkIf (cfg.settings != { }) {
|
||||
enable = true;
|
||||
# Force makes it easy to generate the session file, then add it to nix cfg without issues
|
||||
force = true;
|
||||
|
||||
text = cfg.session;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.rescrobbled = {
|
||||
Unit = {
|
||||
Description = "An MPRIS scrobbler";
|
||||
Documentation = "https://github.com/InputUsername/rescrobbled";
|
||||
Wants = "network-online.target";
|
||||
After = "network-online.target";
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/sleep 15"; # Avoid listenbrainz errors by adding delay till network is connected
|
||||
ExecStart = "${cfg.package}/bin/rescrobbled";
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
# Folders
|
||||
./services
|
||||
# Individual files
|
||||
./bootloader.nix
|
||||
./display.nix
|
||||
./locale.nix
|
||||
|
@ -8,5 +11,6 @@
|
|||
./nixpkgs.nix
|
||||
./programs.nix
|
||||
./users.nix
|
||||
./vscode-server.nix
|
||||
];
|
||||
}
|
8
hosts/laptop-server/config/vscode-server.nix
Normal file
8
hosts/laptop-server/config/vscode-server.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
services.vscode-server = {
|
||||
enable = true;
|
||||
nodejsPackage = pkgs.nodejs-18_x;
|
||||
installPath = "$HOME/.vscodium-server";
|
||||
};
|
||||
}
|
|
@ -8,9 +8,23 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
## External modules
|
||||
|
||||
# Better command-not-found
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
{ programs.nix-index-database.comma.enable = true; }
|
||||
|
||||
# Home manager
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
../../home-manager
|
||||
{ meta.home-manager.preset = "cli"; }
|
||||
|
||||
# VSCode server support
|
||||
inputs.vscode-server.nixosModules.default
|
||||
|
||||
## Normal configuration
|
||||
./hardware-configuration.nix
|
||||
./modules
|
||||
./services
|
||||
./config
|
||||
];
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
## External modules
|
||||
|
||||
# Better command-not-found
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
{ programs.nix-index-database.comma.enable = true; }
|
||||
|
||||
# Home manager
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
../../home-manager
|
||||
{ meta.home-manager.preset = "plasma-desktop"; }
|
||||
|
||||
## Normal configuration
|
||||
./hardware-configuration.nix
|
||||
./modules
|
||||
./config
|
||||
];
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
|
|
79
utils/default.nix
Normal file
79
utils/default.nix
Normal file
|
@ -0,0 +1,79 @@
|
|||
{ inputs, secrets }:
|
||||
{
|
||||
createNixosSystem = {
|
||||
system ? "x86_64-linux",
|
||||
entrypoint
|
||||
}: inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
specialArgs = {
|
||||
inherit inputs system secrets;
|
||||
};
|
||||
|
||||
modules = [ entrypoint ];
|
||||
};
|
||||
|
||||
createColmenaHive = {
|
||||
defaultSystem ? "x86_64-linux",
|
||||
hostConfigs ? []
|
||||
}: {
|
||||
# Set meta options for the colmena hive
|
||||
meta = {
|
||||
# Standard options
|
||||
allowApplyAll = false;
|
||||
# Defaults for nodes
|
||||
nixpkgs = import inputs.nixpkgs { system = defaultSystem; };
|
||||
specialArgs = {
|
||||
inherit inputs secrets;
|
||||
system = defaultSystem;
|
||||
};
|
||||
# Overrides for individual nodes
|
||||
nodeNixpkgs = (
|
||||
builtins.foldl'
|
||||
(acc: cur:
|
||||
acc // {
|
||||
${cur.name} = import inputs.nixpkgs { system = cur.system; };
|
||||
}
|
||||
)
|
||||
{}
|
||||
(builtins.filter
|
||||
(c: builtins.hasAttr "system" c && c.system != defaultSystem)
|
||||
hostConfigs)
|
||||
);
|
||||
nodeSpecialArgs = (
|
||||
builtins.foldl'
|
||||
(acc: cur:
|
||||
acc // {
|
||||
${cur.name} = {
|
||||
inherit inputs secrets;
|
||||
system = cur.system;
|
||||
};
|
||||
}
|
||||
)
|
||||
{}
|
||||
(builtins.filter
|
||||
(c: builtins.hasAttr "system" c && c.system != defaultSystem)
|
||||
hostConfigs)
|
||||
);
|
||||
};
|
||||
} // (
|
||||
# Add all of the hosts
|
||||
builtins.foldl'
|
||||
(acc: cur:
|
||||
acc // {
|
||||
${cur.name} = { ... }: {
|
||||
deployment = {
|
||||
replaceUnknownProfiles = false;
|
||||
targetUser = if (builtins.hasAttr "sshUser" cur) then cur.sshUser else "root";
|
||||
targetHost = if (builtins.hasAttr "sshHost" cur) then cur.sshHost else cur.name;
|
||||
targetPort = if (builtins.hasAttr "sshPort" cur) then cur.sshPort else 22;
|
||||
};
|
||||
|
||||
imports = [ cur.entrypoint ];
|
||||
};
|
||||
}
|
||||
)
|
||||
{}
|
||||
hostConfigs
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue