Compare commits

...

10 commits

20 changed files with 319 additions and 77 deletions

View file

@ -2,7 +2,7 @@
## 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
@ -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.
| Package | License | Original Link |
| ------------------- | ------- | ---------------------------------------------------------------------- |
| BeautyLine (Garuda) | GPLv3 | https://gitlab.com/garuda-linux/themes-and-settings/artwork/beautyline |
| Magna Splash 6 | GPLv3 | https://www.pling.com/p/2136626/ |
| Package | License | Original Link |
| ------------------- | ------- | ---------------------------------------------------------------------------------|
| BeautyLine (Garuda) | GPLv3 | https://gitlab.com/garuda-linux/themes-and-settings/artwork/beautyline |
| 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": {
"dir": "/pkgs/firefox-addons",
"lastModified": 1733087703,
"narHash": "sha256-WKdLy5t8SH9HBtajC8BZb+V4n0FaP71aUUYLuku46Rk=",
"lastModified": 1733135686,
"narHash": "sha256-++1Btq9w+ZPQYP45X3G1iXEXwllo3b2UdeKVwQdUAoQ=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "d4cbff4dda07726005224b33cf2cc5dc4a2c4211",
"rev": "074cadca26132cbd19f44ae5a45072f28f050ed9",
"type": "gitlab"
},
"original": {
@ -50,11 +50,11 @@
]
},
"locked": {
"lastModified": 1732670254,
"narHash": "sha256-5z4pN4FnhZ/LedFrMmEhzCqFORd2cj227Jm1I2Lj4Zg=",
"lastModified": 1733159850,
"narHash": "sha256-IrFkgBWFzzujwG4gt4iXj2ncx4BH3Yc4M5VdwN/Y/Ss=",
"owner": "nix-community",
"repo": "flake-firefox-nightly",
"rev": "c7eb601bd2d36aa4b9b6cdddc5793a36d77c0f06",
"rev": "d20be2e9c1b201e4253e79a200f0a2ed7fc27441",
"type": "github"
},
"original": {
@ -152,11 +152,11 @@
]
},
"locked": {
"lastModified": 1733085484,
"narHash": "sha256-dVmNuUajnU18oHzBQWZm1BQtANCHaqNuxTHZQ+GN0r8=",
"lastModified": 1733133928,
"narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c1fee8d4a60b89cae12b288ba9dbc608ff298163",
"rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011",
"type": "github"
},
"original": {
@ -172,11 +172,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1732450403,
"narHash": "sha256-qYjJeHYUHDgfDsvMpIf9TRz0oAoMwvYP75XHObDjWIg=",
"lastModified": 1733055216,
"narHash": "sha256-yB2y7tGJxDI/SDQ0D7b6ocRtLTPm93u8ybdIKQGXRDE=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "c817444fb8a3042c26be57d8640fb744bc1b516c",
"rev": "f67bf0781c69a46bf3a1469f83c98518aa3054c3",
"type": "github"
},
"original": {
@ -188,11 +188,11 @@
"mozilla": {
"flake": false,
"locked": {
"lastModified": 1704373101,
"narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=",
"lastModified": 1733136220,
"narHash": "sha256-Ga8AP/YPsKDVF5LcNN8v3RiLgnEeW7zBk9GyX7wa9Ug=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2",
"rev": "ad7af231a95acf65ccc4afa0c766f5c0674ad3f1",
"type": "github"
},
"original": {
@ -201,6 +201,26 @@
"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": {
"inputs": {
"nixpkgs": [
@ -223,11 +243,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1732837521,
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=",
"lastModified": 1733015953,
"narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370",
"rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
"type": "github"
},
"original": {
@ -255,11 +275,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1732410305,
"narHash": "sha256-/hxIKRTBsdrnudJWDGaBN8wIjHovqVAVxXdi8ByVtck=",
"lastModified": 1733015484,
"narHash": "sha256-qiyO0GrTvbp869U4VGX5GhAZ00fSiPXszvosY1AgKQ8=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "87b6978992e2eb605732fba842cad0a7e14b2047",
"rev": "0e4fdd4a0ab733276b6d2274ff84ae353f17129e",
"type": "github"
},
"original": {
@ -296,6 +316,7 @@
"firefox-addons": "firefox-addons",
"firefox-nightly": "firefox-nightly",
"home-manager": "home-manager",
"nix-index-database": "nix-index-database",
"nixos-grub-themes": "nixos-grub-themes",
"nixpkgs": "nixpkgs",
"nixpkgs-24-11": "nixpkgs-24-11",

View file

@ -5,6 +5,11 @@
# General NixOS config
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
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 = {
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";
pkgs = nixpkgs.legacyPackages.${system};
secrets = import ./secrets.nix;
@ -56,6 +61,10 @@
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
@ -74,6 +83,7 @@
# the path to your home.nix.
modules = [
plasma-manager.homeManagerModules.plasma-manager
./home-manager/custom-modules
./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.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 = {
inherit inputs system secrets;
};

View file

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

View file

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

View file

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

View file

@ -7,7 +7,8 @@
# Video
jellyfin-media-player
vlc
# Chat
element-desktop
vesktop
@ -22,6 +23,8 @@
# Programming
nixd # NixD LSP for .nix files
clang
clang-tools
deno
# :3
@ -53,4 +56,4 @@
kdeconnect-kde
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 = [
./zsh.nix
./starship.nix
./konsole.nix
./btop.nix
./konsole.nix
./starship.nix
./zsh.nix
];
}

View file

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

View file

@ -1,33 +1,51 @@
{ pkgs, inputs, system, ... }:
{
programs.vscode = {
programs.vscode = let vscode-package = pkgs.vscodium; in {
enable = true;
package = pkgs.vscodium;
package = vscode-package;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = false;
extensions = with inputs.vscode-extensions.extensions."${system}".open-vsx; [
# Language support
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
];
extensions = with (inputs.vscode-extensions.extensions."${system}".forVSCodeVersion (
# Get pkgs.vscodium version, and remove the 4th part (forVSCodeVersion only expects 3 parts)
# By using forVSCodeVersion, any unsupported versions are automatically excluded and this config
# won't build (rather than only finding out in vscode itself)
pkgs.lib.strings.concatStringsSep "." (
pkgs.lib.lists.take 3 (
pkgs.lib.strings.splitString "." vscode-package.version
)
)
)); (
(with open-vsx; [
# Language support
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 = {
# Editor
"editor.fontFamily" = "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace";
"editor.indentSize" = "tabSize";
"editor.tabSize" = 4;
"files.associations" = {
"*.hujson" = "jsonc";
};
# JJ
"files.watcherExclude" = {
"**/.git/objects/**" = true;

View file

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

View file

@ -2,29 +2,30 @@
{
# Configure dual-gpu AMD+Nvidia
hardware.graphics.enable = true;
services.xserver.videoDrivers = ["nvidia" "amdgpu"];
hardware.nvidia = {
modesetting.enable = true;
services.xserver.videoDrivers = ["amdgpu"];
# services.xserver.videoDrivers = ["nvidia" "amdgpu"];
# hardware.nvidia = {
# modesetting.enable = true;
# Experimental nvidia power management
powerManagement.enable = false;
# # Experimental nvidia power management
# powerManagement.enable = false;
# Experimentally turn off Nvidia GPU when not in use
powerManagement.finegrained = true;
# # Experimentally turn off Nvidia GPU when not in use
# 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
prime = {
amdgpuBusId = "PCI:4:0:0";
nvidiaBusId = "PCI:1:0:0";
# # Configure dual-gpu offloading
# prime = {
# amdgpuBusId = "PCI:4:0:0";
# nvidiaBusId = "PCI:1:0:0";
offload = {
enable = true;
enableOffloadCmd = true;
};
};
};
# offload = {
# enable = true;
# enableOffloadCmd = true;
# };
# };
# };
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, inputs, ... }:
{
# Install system packages
environment.systemPackages = with pkgs; [
@ -22,6 +22,10 @@
# Install zsh
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
programs.firefox = {
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
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 = {