Compare commits

...

10 commits

20 changed files with 319 additions and 77 deletions

View file

@ -2,7 +2,7 @@
## Config Setup ## Config Setup
The three main parts of my config are the `home-manager/`, `hosts/`, and `packages/` folders. The three main parts of my config are the `home-manager/`, `hosts/`, and `packages/` folders. In addition to these, I also have a `secrets.nix` file which needs to be populated with secrets as structured in `secrets.example.nix`. Soon, I will have a way to export and import this file to/from a bitwarden vault, for backup purposes.
### Home manager ### Home manager
@ -16,7 +16,8 @@ This folder contains sub-folders for each of my NixOS hosts, of which there is o
This folder contains all of my personally-made nix packages. This is mainly just packages I can't seem to find on the interwebs, like some themes. Theoretically they could be used by someone else, but I haven't quite made my config modular yet, so don't try. This folder contains all of my personally-made nix packages. This is mainly just packages I can't seem to find on the interwebs, like some themes. Theoretically they could be used by someone else, but I haven't quite made my config modular yet, so don't try.
| Package | License | Original Link | | Package | License | Original Link |
| ------------------- | ------- | ---------------------------------------------------------------------- | | ------------------- | ------- | ---------------------------------------------------------------------------------|
| BeautyLine (Garuda) | GPLv3 | https://gitlab.com/garuda-linux/themes-and-settings/artwork/beautyline | | BeautyLine (Garuda) | GPLv3 | https://gitlab.com/garuda-linux/themes-and-settings/artwork/beautyline |
| Magna Splash 6 | GPLv3 | https://www.pling.com/p/2136626/ | | Magna Splash 6 | GPLv3 | https://www.pling.com/p/2136626/ |
| Rescrobbled | GPLv3 | https://github.com/NixOS/nixpkgs/pull/274553 (unmerged nixpkgs PR by negatethis) |

63
flake.lock generated
View file

@ -25,11 +25,11 @@
}, },
"locked": { "locked": {
"dir": "/pkgs/firefox-addons", "dir": "/pkgs/firefox-addons",
"lastModified": 1733087703, "lastModified": 1733135686,
"narHash": "sha256-WKdLy5t8SH9HBtajC8BZb+V4n0FaP71aUUYLuku46Rk=", "narHash": "sha256-++1Btq9w+ZPQYP45X3G1iXEXwllo3b2UdeKVwQdUAoQ=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "d4cbff4dda07726005224b33cf2cc5dc4a2c4211", "rev": "074cadca26132cbd19f44ae5a45072f28f050ed9",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@ -50,11 +50,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732670254, "lastModified": 1733159850,
"narHash": "sha256-5z4pN4FnhZ/LedFrMmEhzCqFORd2cj227Jm1I2Lj4Zg=", "narHash": "sha256-IrFkgBWFzzujwG4gt4iXj2ncx4BH3Yc4M5VdwN/Y/Ss=",
"owner": "nix-community", "owner": "nix-community",
"repo": "flake-firefox-nightly", "repo": "flake-firefox-nightly",
"rev": "c7eb601bd2d36aa4b9b6cdddc5793a36d77c0f06", "rev": "d20be2e9c1b201e4253e79a200f0a2ed7fc27441",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -152,11 +152,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1733085484, "lastModified": 1733133928,
"narHash": "sha256-dVmNuUajnU18oHzBQWZm1BQtANCHaqNuxTHZQ+GN0r8=", "narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "c1fee8d4a60b89cae12b288ba9dbc608ff298163", "rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -172,11 +172,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1732450403, "lastModified": 1733055216,
"narHash": "sha256-qYjJeHYUHDgfDsvMpIf9TRz0oAoMwvYP75XHObDjWIg=", "narHash": "sha256-yB2y7tGJxDI/SDQ0D7b6ocRtLTPm93u8ybdIKQGXRDE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lib-aggregate", "repo": "lib-aggregate",
"rev": "c817444fb8a3042c26be57d8640fb744bc1b516c", "rev": "f67bf0781c69a46bf3a1469f83c98518aa3054c3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -188,11 +188,11 @@
"mozilla": { "mozilla": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1704373101, "lastModified": 1733136220,
"narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=", "narHash": "sha256-Ga8AP/YPsKDVF5LcNN8v3RiLgnEeW7zBk9GyX7wa9Ug=",
"owner": "mozilla", "owner": "mozilla",
"repo": "nixpkgs-mozilla", "repo": "nixpkgs-mozilla",
"rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2", "rev": "ad7af231a95acf65ccc4afa0c766f5c0674ad3f1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -201,6 +201,26 @@
"type": "github" "type": "github"
} }
}, },
"nix-index-database": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733024876,
"narHash": "sha256-vy9Q41hBE7Zg0yakF79neVgb3i3PQMSMR7uHPpPywFE=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "6e0b7f81367069589a480b91603a10bcf71f3103",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-index-database",
"type": "github"
}
},
"nixos-grub-themes": { "nixos-grub-themes": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -223,11 +243,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1732837521, "lastModified": 1733015953,
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=", "narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370", "rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -255,11 +275,11 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1732410305, "lastModified": 1733015484,
"narHash": "sha256-/hxIKRTBsdrnudJWDGaBN8wIjHovqVAVxXdi8ByVtck=", "narHash": "sha256-qiyO0GrTvbp869U4VGX5GhAZ00fSiPXszvosY1AgKQ8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "87b6978992e2eb605732fba842cad0a7e14b2047", "rev": "0e4fdd4a0ab733276b6d2274ff84ae353f17129e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -296,6 +316,7 @@
"firefox-addons": "firefox-addons", "firefox-addons": "firefox-addons",
"firefox-nightly": "firefox-nightly", "firefox-nightly": "firefox-nightly",
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-index-database": "nix-index-database",
"nixos-grub-themes": "nixos-grub-themes", "nixos-grub-themes": "nixos-grub-themes",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-24-11": "nixpkgs-24-11", "nixpkgs-24-11": "nixpkgs-24-11",

View file

@ -5,6 +5,11 @@
# General NixOS config # General NixOS config
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-24-11.url = "github:NixOS/nixpkgs/nixos-24.11"; nixpkgs-24-11.url = "github:NixOS/nixpkgs/nixos-24.11";
# Nixpkgs index for command-not-found support
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# NixOS Grub Themes (hyperfluent) # NixOS Grub Themes (hyperfluent)
nixos-grub-themes = { nixos-grub-themes = {
url = "github:jeslie0/nixos-grub-themes"; url = "github:jeslie0/nixos-grub-themes";
@ -45,7 +50,7 @@
}; };
}; };
outputs = inputs@{ nixpkgs, home-manager, plasma-manager, ... }: let outputs = inputs@{ nixpkgs, home-manager, plasma-manager, nix-index-database, ... }: let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
secrets = import ./secrets.nix; secrets = import ./secrets.nix;
@ -56,6 +61,10 @@
modules = [ modules = [
./hosts/laptop ./hosts/laptop
# Better command-not-found
nix-index-database.nixosModules.nix-index
{ programs.nix-index-database.comma.enable = true; }
# Home manager # Home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
./home-manager ./home-manager
@ -74,6 +83,7 @@
# the path to your home.nix. # the path to your home.nix.
modules = [ modules = [
plasma-manager.homeManagerModules.plasma-manager plasma-manager.homeManagerModules.plasma-manager
./home-manager/custom-modules
./home-manager/home.nix ./home-manager/home.nix
]; ];

View file

@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./rescrobbled.nix
];
}

View file

@ -0,0 +1,85 @@
{ 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" ];
};
};
}

View file

@ -2,7 +2,10 @@
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.sharedModules = [ inputs.plasma-manager.homeManagerModules.plasma-manager ]; home-manager.sharedModules = [
inputs.plasma-manager.homeManagerModules.plasma-manager
./custom-modules
];
home-manager.extraSpecialArgs = { home-manager.extraSpecialArgs = {
inherit inputs system secrets; inherit inputs system secrets;
}; };

View file

@ -17,5 +17,6 @@
./modules/desktop.nix ./modules/desktop.nix
./modules/gtk.nix ./modules/gtk.nix
./modules/beets.nix ./modules/beets.nix
./modules/rescrobbled.nix
]; ];
} }

View file

@ -2,5 +2,6 @@
{ {
imports = [ imports = [
./email.nix ./email.nix
./ssh.nix
]; ];
} }

View file

@ -8,33 +8,33 @@
matchBlocks = { matchBlocks = {
# Tailscale nodes # Tailscale nodes
"vps" = { "vps" = {
hostName = "oracle-vps"; hostname = "oracle-vps";
user = "tyman"; user = "tyman";
port = 22; port = 22;
}; };
"srv" = { "srv" = {
hostName = "old-lenovo-laptop"; hostname = "old-lenovo-laptop";
user = "ty"; user = "ty";
port = 22; port = 22;
}; };
"polyfrost" = { "polyfrost" = {
hostName = "polyfrost-vps"; hostname = "polyfrost-vps";
user = "tyman"; user = "tyman";
port = 22; port = 22;
}; };
# Git hosts # Git hosts
"forgejo" = { "forgejo" = {
hostName = "git.myriation.xyz"; hostname = "git.myriation.xyz";
user = "git"; user = "git";
port = 22; port = 22;
}; };
"github" = { "github" = {
hostName = "github.com"; hostname = "github.com";
user = "git"; user = "git";
port = 22; port = 22;
}; };
"codeberg" = { "codeberg" = {
hostName = "codeberg.org"; hostname = "codeberg.org";
user = "git"; user = "git";
port = 22; port = 22;
}; };

View file

@ -7,7 +7,8 @@
# Video # Video
jellyfin-media-player jellyfin-media-player
vlc
# Chat # Chat
element-desktop element-desktop
vesktop vesktop
@ -22,6 +23,8 @@
# Programming # Programming
nixd # NixD LSP for .nix files nixd # NixD LSP for .nix files
clang
clang-tools
deno deno
# :3 # :3
@ -53,4 +56,4 @@
kdeconnect-kde kdeconnect-kde
polkit-kde-agent-1 polkit-kde-agent-1
]); ]);
} }

View file

@ -0,0 +1,21 @@
{ secrets, lib, ... }:
{
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;
};
};
}

View file

@ -1,9 +1,9 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
./zsh.nix
./starship.nix
./konsole.nix
./btop.nix ./btop.nix
./konsole.nix
./starship.nix
./zsh.nix
]; ];
} }

View file

@ -125,7 +125,7 @@
custom.date = { custom.date = {
disabled = false; disabled = false;
when = true; when = true;
command = ''date +"%b %e %Y"''; command = ''date +"%b %-d %Y"'';
description = "The current local date"; description = "The current local date";
style = "bg:238 fg:#E5B9E9 bold"; style = "bg:238 fg:#E5B9E9 bold";
format = "[$output]($style)"; format = "[$output]($style)";

View file

@ -1,33 +1,51 @@
{ pkgs, inputs, system, ... }: { pkgs, inputs, system, ... }:
{ {
programs.vscode = { programs.vscode = let vscode-package = pkgs.vscodium; in {
enable = true; enable = true;
package = pkgs.vscodium; package = vscode-package;
enableUpdateCheck = false; enableUpdateCheck = false;
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;
mutableExtensionsDir = false; mutableExtensionsDir = false;
extensions = with inputs.vscode-extensions.extensions."${system}".open-vsx; [ extensions = with (inputs.vscode-extensions.extensions."${system}".forVSCodeVersion (
# Language support # Get pkgs.vscodium version, and remove the 4th part (forVSCodeVersion only expects 3 parts)
rust-lang.rust-analyzer # Rust # By using forVSCodeVersion, any unsupported versions are automatically excluded and this config
llvm-vs-code-extensions.vscode-clangd # C++ # won't build (rather than only finding out in vscode itself)
vadimcn.vscode-lldb # C++ Debugging pkgs.lib.strings.concatStringsSep "." (
jnoortheen.nix-ide # Nix pkgs.lib.lists.take 3 (
tamasfe.even-better-toml # TOML pkgs.lib.strings.splitString "." vscode-package.version
yzhang.markdown-all-in-one # Markdown )
denoland.vscode-deno # Deno JS/TS )
# Theming )); (
pkief.material-icon-theme # Material icons (with open-vsx; [
# Utilities # Language support
streetsidesoftware.code-spell-checker # Spellchecking rust-lang.rust-analyzer # Rust
]; llvm-vs-code-extensions.vscode-clangd # C++
vadimcn.vscode-lldb # C++ Debugging
jnoortheen.nix-ide # Nix
tamasfe.even-better-toml # TOML
yzhang.markdown-all-in-one # Markdown
denoland.vscode-deno # Deno JS/TS
# Theming
pkief.material-icon-theme # Material icons
# Utilities
streetsidesoftware.code-spell-checker # Spellchecking
jeanp413.open-remote-ssh # Remote SSH
])
++ (with vscode-marketplace; [
yy0931.save-as-root # Save as root over SSH
])
);
userSettings = { userSettings = {
# Editor # Editor
"editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace"; "editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace";
"editor.indentSize" = "tabSize"; "editor.indentSize" = "tabSize";
"editor.tabSize" = 4; "editor.tabSize" = 4;
"files.associations" = {
"*.hujson" = "jsonc";
};
# JJ # JJ
"files.watcherExclude" = { "files.watcherExclude" = {
"**/.git/objects/**" = true; "**/.git/objects/**" = true;

View file

@ -14,6 +14,7 @@
./nvidia.nix ./nvidia.nix
./packages.nix ./packages.nix
./sound.nix ./sound.nix
./swap.nix
./users.nix ./users.nix
]; ];
} }

View file

@ -2,29 +2,30 @@
{ {
# Configure dual-gpu AMD+Nvidia # Configure dual-gpu AMD+Nvidia
hardware.graphics.enable = true; hardware.graphics.enable = true;
services.xserver.videoDrivers = ["nvidia" "amdgpu"]; services.xserver.videoDrivers = ["amdgpu"];
hardware.nvidia = { # services.xserver.videoDrivers = ["nvidia" "amdgpu"];
modesetting.enable = true; # hardware.nvidia = {
# modesetting.enable = true;
# Experimental nvidia power management # # Experimental nvidia power management
powerManagement.enable = false; # powerManagement.enable = false;
# Experimentally turn off Nvidia GPU when not in use # # Experimentally turn off Nvidia GPU when not in use
powerManagement.finegrained = true; # powerManagement.finegrained = true;
open = false; # Open source module is still very much beta # open = false; # Open source module is still very much beta
nvidiaSettings = true; # nvidiaSettings = true;
# Configure dual-gpu offloading # # Configure dual-gpu offloading
prime = { # prime = {
amdgpuBusId = "PCI:4:0:0"; # amdgpuBusId = "PCI:4:0:0";
nvidiaBusId = "PCI:1:0:0"; # nvidiaBusId = "PCI:1:0:0";
offload = { # offload = {
enable = true; # enable = true;
enableOffloadCmd = true; # enableOffloadCmd = true;
}; # };
}; # };
}; # };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, inputs, ... }:
{ {
# Install system packages # Install system packages
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -22,6 +22,10 @@
# Install zsh # Install zsh
programs.zsh.enable = true; programs.zsh.enable = true;
# Disable default command-not-found (it doesn't work with flakes)
programs.command-not-found.enable = false;
programs.nix-index.enable = true;
# Manage default firefox web browser install # Manage default firefox web browser install
programs.firefox = { programs.firefox = {
enable = true; enable = true;

View file

@ -0,0 +1,7 @@
{ ... }:
{
zramSwap = {
enable = true;
algorithm = "zstd";
};
}

View file

@ -0,0 +1,44 @@
{ lib
, bash
, fetchFromGitHub
, rustPlatform
, pkg-config
, openssl
, dbus
}:
rustPlatform.buildRustPackage rec {
pname = "rescrobbled";
version = "0.7.1";
src = fetchFromGitHub {
owner = "InputUsername";
repo = "rescrobbled";
rev = "v${version}";
hash = "sha256-1E+SeKjHCah+IFn2QLAyyv7jgEcZ1gtkh8iHgiVBuz4=";
};
cargoHash = "sha256-ZJbyYFvGTuXt1aqhGOATcDRrkTk7SorWXkN81sUoDdo=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl dbus ];
postPatch = ''
# Required for tests
substituteInPlace src/filter.rs --replace '#!/usr/bin/bash' '#!${bash}/bin/bash'
'';
postInstall = ''
substituteInPlace rescrobbled.service --replace '%h/.cargo/bin/rescrobbled' "$out/bin/rescrobbled"
'';
meta = with lib; {
description = "MPRIS music scrobbler daemon";
homepage = "https://github.com/InputUsername/rescrobbled";
license = licenses.gpl3Plus;
mainProgram = "rescrobbled";
platforms = platforms.unix;
};
}

View file

@ -4,6 +4,21 @@
# The API key to use for google custom search lyrics backend # The API key to use for google custom search lyrics backend
google_api_key = null; google_api_key = null;
}; };
rescrobbled = {
enable = false;
# The credentials to use for last.fm and listenbrainz
lastfm = {
key = null;
secret = null;
# Generated by manually running the rescrobbled daemon and reading $XDG_CONFIG_HOME/rescrobbled/session
session = null;
};
listenbrainz = {
token = null;
};
};
}; };
passwords = { passwords = {