Files
nixos/flake.nix

546 lines
30 KiB
Nix
Raw Normal View History

2026-02-22 19:54:17 +00:00
{
2026-02-25 23:58:47 +00:00
description = "Stationette nix config";
2026-02-22 19:54:17 +00:00
2026-02-25 23:58:47 +00:00
inputs = {
2026-03-02 00:14:11 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2026-02-25 23:58:47 +00:00
disko.url = "github:nix-community/disko/latest";
2026-02-27 00:51:33 +00:00
impermanence.url = "github:nix-community/impermanence";
2026-02-28 17:54:50 +00:00
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
2026-02-27 00:51:33 +00:00
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
2026-03-08 00:25:11 +00:00
try-cli = {
url = "github:tobi/try-cli";
inputs.nixpkgs.follows = "nixpkgs";
};
elephant = {
url = "github:abenz1267/elephant";
2026-03-08 21:00:47 +00:00
# inputs.nixpkgs.follows = "nixpkgs";
2026-03-08 00:25:11 +00:00
};
2026-03-06 16:56:28 +00:00
walker = {
url = "github:abenz1267/walker";
inputs.elephant.follows = "elephant";
2026-03-08 00:25:11 +00:00
inputs.nixpkgs.follows = "nixpkgs";
};
voxtype = {
url = "github:peteonrails/voxtype";
inputs.nixpkgs.follows = "nixpkgs";
};
2026-03-08 21:00:47 +00:00
# hyprland-preview-share-picker = {
# url = "github:WhySoBad/hyprland-preview-share-picker";
# inputs.nixpkgs.follows = "nixpkgs";
# };
2026-02-22 19:54:17 +00:00
};
2026-02-25 23:58:47 +00:00
outputs = {
self,
nixpkgs,
2026-03-02 00:14:11 +00:00
nixpkgs-unstable,
2026-02-27 00:51:33 +00:00
impermanence,
2026-02-25 23:58:47 +00:00
disko,
2026-02-27 00:51:33 +00:00
home-manager,
2026-03-04 23:11:54 +00:00
try-cli,
2026-03-08 00:25:11 +00:00
voxtype,
2026-03-08 21:00:47 +00:00
# hyprland-preview-share-picker,
2026-02-25 23:58:47 +00:00
...
} @ inputs: let
lib = nixpkgs.lib;
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
2026-03-02 00:14:11 +00:00
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
2026-02-25 23:58:47 +00:00
in {
nixosConfigurations = {
stationette = nixpkgs.lib.nixosSystem {
modules = [
2026-02-26 23:27:43 +00:00
./hardware-configuration.nix
2026-03-09 20:27:18 +00:00
./hardware
./system
2026-02-27 00:51:33 +00:00
home-manager.nixosModules.home-manager
2026-02-26 23:27:43 +00:00
{
2026-03-07 00:26:43 +00:00
powerManagement.enable = true;
2026-03-08 00:25:11 +00:00
systemd = {
packages = with pkgs; [
uwsm
];
settings = {
Manager = {
DefaultTimeoutStopSec = "5s";
};
};
};
2026-03-06 16:56:28 +00:00
environment = {
2026-03-08 00:25:11 +00:00
pathsToLink = [
"/share/uwsm"
];
2026-03-06 16:56:28 +00:00
};
users.users.chris = {
uid = 1000;
isNormalUser = true;
initialPassword = "changeme123";
shell = pkgs.zsh;
extraGroups = [
"chris"
"wheel"
"networkmanager"
];
};
nixpkgs.config.allowUnfree = true;
programs = {
2026-03-07 00:26:43 +00:00
localsend = {
enable = true;
openFirewall = true;
};
2026-03-06 16:56:28 +00:00
zsh = {
enable = true;
2026-02-28 14:33:47 +00:00
};
2026-03-06 16:56:28 +00:00
hyprland = {
enable = true;
2026-03-08 23:18:43 +00:00
package = pkgs.writeShellScriptBin "hyprland" ''
station-bg-random
${pkgs-unstable.hyprland}/bin/Hyprland
'';
2026-03-06 16:56:28 +00:00
xwayland.enable = true;
2026-03-07 00:26:43 +00:00
withUWSM = true;
2026-03-06 16:56:28 +00:00
};
steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
2026-03-07 00:26:43 +00:00
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
2026-03-06 16:56:28 +00:00
};
};
system.stateVersion = "25.11";
home-manager = {
users.chris = { pkgs, lib, ... }: {
2026-03-08 21:00:47 +00:00
xdg.configFile."voxtype/config.toml".enable = false;
2026-03-06 16:56:28 +00:00
home = {
file.".mozilla/firefox/default/search.json.mozlz4".force = lib.mkForce true;
username = "chris";
homeDirectory = "/home/chris";
enableNixpkgsReleaseCheck = false;
stateVersion = "25.11";
persistence."/persist" = {
directories = [
"Downloads"
"Tower"
"Code"
".steam"
".config/dotfiles"
2026-03-08 15:27:58 +00:00
".cache/zsh"
2026-03-06 16:56:28 +00:00
".mozilla/firefox"
".config/nvim"
".config/yazi/plugins"
".config/nixos"
".config/sinew.in"
2026-03-08 21:00:47 +00:00
".config/chromium"
2026-03-06 16:56:28 +00:00
".local/share/direnv"
".local/share/nvim"
2026-03-08 00:25:11 +00:00
".local/share/voxtype"
2026-03-06 16:56:28 +00:00
".local/share/zoxide"
".local/share/Enpass"
".local/share/Steam"
2026-03-07 00:26:43 +00:00
".local/share/station"
".local/state/station"
2026-03-06 16:56:28 +00:00
".ssh"
];
files = [
".config/shell/.env"
];
};
activation = {
setupDotfiles = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [[ -v DRY_RUN ]]; then
echo "Dry run: Would bootstrap dotfiles from labs.scarif.space"
exit
fi
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
TEMP_DIR=$(mktemp -d)
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
DOTFILES_DIR="$HOME/.config/dotfiles"
DOTFILES_GIT_DIR="$DOTFILES_DIR/.git"
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
if [ ! -d "$DOTFILES_GIT_DIR" ]; then
echo "No local repository so cloning from remote"
SOURCE="https://labs.scarif.space/chris/dotfiles.git"
${pkgs.git}/bin/git clone -b main "$SOURCE" "$TEMP_DIR"
mv "$TEMP_DIR/.git" "$DOTFILES_GIT_DIR"
else
echo "Local repository found so cloning from there"
${pkgs.git}/bin/git clone -b main "$DOTFILES_GIT_DIR" "$TEMP_DIR"
${pkgs.git}/bin/git --git-dir="$DOTFILES_GIT_DIR" --work-tree="$TEMP_DIR" pull --rebase || true
fi
2026-02-28 15:17:09 +00:00
2026-03-06 16:56:28 +00:00
echo "Copying dot files to home"
${pkgs.coreutils}/bin/cp -rfT "$TEMP_DIR" "$HOME"
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
NVIM_DIR="$HOME/.config/nvim"
echo "Neovim config not initialised so initialising from remote"
${pkgs.git}/bin/git --git-dir="$DOTFILES_GIT_DIR" --work-tree="$HOME" submodule set-url ".config/nvim" https://labs.scarif.space/chris/nvim.git
${pkgs.git}/bin/git --git-dir="$DOTFILES_GIT_DIR" --work-tree="$HOME" submodule update --init || true
${pkgs.git}/bin/git --git-dir="$DOTFILES_GIT_DIR" --work-tree="$HOME" submodule set-url ".config/nvim" git@labs.scarif.space:chris/nvim.git
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
cd "$HOME"
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
echo "Cleanup"
${pkgs.coreutils}/bin/rm -rf "$TEMP_DIR"
${pkgs.coreutils}/bin/rm -rf "$HOME/.git" || true
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
echo "Dotfiles bootstrapped successfully."
'';
setupDevDirectories = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [[ -v DRY_RUN ]]; then
echo "Dry run: Would create dev directories"
exit
fi
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
echo "Creating development directories"
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
for dir in "DevOps" "FSharp" "JavaScript" "Scala" "Rust" "PHP" "Tutorials" "Sites" "MobileApps" "Tries"; do
if [ ! -d "$HOME/Code/$dir" ]; then
mkdir -p "$HOME/Code/$dir"
fi
done
'';
2026-03-08 21:00:47 +00:00
setupInitialConfigs = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [[ -v DRY_RUN ]]; then
echo "Dry run: Would copy initial config files"
exit
fi
DEST_FILE="$HOME/.config/Nextcloud/nextcloud.cfg"
if [ ! -f "$DEST_FILE" ]; then
cp "${./initial-configs/nextcloud.cfg}" "$DEST_FILE"
fi
DEST_FILE="$HOME/.config/sinew.in/Enpass.conf"
if [ ! -f "$DEST_FILE" ]; then
2026-03-08 23:18:43 +00:00
cp "${./initial-configs/Enpass.conf}" "$DEST_FILE"
2026-03-08 21:00:47 +00:00
fi
'';
2026-02-27 00:51:33 +00:00
};
2026-03-06 16:56:28 +00:00
packages = with pkgs; [
2026-03-07 00:26:43 +00:00
lunar-client
2026-03-06 16:56:28 +00:00
direnv
wiremix
2026-03-08 00:25:11 +00:00
xournalpp
2026-03-06 16:56:28 +00:00
bluetui
spotify
nodePackages.pnpm
try-cli.packages.${system}.default
obsidian
mailspring
antigravity
gimp
nautilus
enpass
enpass-cli
expressvpn
2026-03-07 00:26:43 +00:00
ffmpeg
ffmpegthumbnailer
gpu-screen-recorder
2026-03-06 16:56:28 +00:00
inkscape
krita
libreoffice-fresh
nextcloud-client
nodejs_24
signal-desktop
sxiv
tenacity
zathura
ghostty
yarn
uwsm
wally-cli
kdePackages.wacomtablet
mpv
vlc
imv
];
};
xdg.mimeApps = {
enable = true;
defaultApplications = {
# Directories
"inode/directory" = [ "org.gnome.Nautilus.desktop" ];
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
# Images
"image/png" = [ "imv.desktop" ];
"image/jpeg" = [ "imv.desktop" ];
"image/gif" = [ "imv.desktop" ];
"image/webp" = [ "imv.desktop" ];
"image/bmp" = [ "imv.desktop" ];
"image/tiff" = [ "imv.desktop" ];
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
# Documents
"application/pdf" = [ "zathura.desktop" ];
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
# Web and Browser
"x-scheme-handler/http" = [ "firefox.desktop" ];
"x-scheme-handler/https" = [ "firefox.desktop" ];
"text/html" = [ "firefox.desktop" ];
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
# Video
"video/mp4" = [ "mpv.desktop" ];
"video/x-msvideo" = [ "mpv.desktop" ];
"video/x-matroska" = [ "mpv.desktop" ];
"video/x-flv" = [ "mpv.desktop" ];
"video/x-ms-wmv" = [ "mpv.desktop" ];
"video/mpeg" = [ "mpv.desktop" ];
"video/ogg" = [ "mpv.desktop" ];
"video/webm" = [ "mpv.desktop" ];
"video/quicktime" = [ "mpv.desktop" ];
"video/3gpp" = [ "mpv.desktop" ];
"video/3gpp2" = [ "mpv.desktop" ];
"video/x-ms-asf" = [ "mpv.desktop" ];
"video/x-ogm+ogg" = [ "mpv.desktop" ];
"video/x-theora+ogg" = [ "mpv.desktop" ];
"application/ogg" = [ "mpv.desktop" ];
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
# Mail
"x-scheme-handler/mailto" = [ "mailspring.desktop" ];
2026-03-04 23:11:54 +00:00
2026-03-06 16:56:28 +00:00
# Text and Code
"text/plain" = [ "nvim.desktop" ];
"text/english" = [ "nvim.desktop" ];
"text/x-makefile" = [ "nvim.desktop" ];
"text/x-c++hdr" = [ "nvim.desktop" ];
"text/x-c++src" = [ "nvim.desktop" ];
"text/x-chdr" = [ "nvim.desktop" ];
"text/x-csrc" = [ "nvim.desktop" ];
"text/x-java" = [ "nvim.desktop" ];
"text/x-moc" = [ "nvim.desktop" ];
"text/x-pascal" = [ "nvim.desktop" ];
"text/x-tcl" = [ "nvim.desktop" ];
"text/x-tex" = [ "nvim.desktop" ];
"application/x-shellscript" = [ "nvim.desktop" ];
"text/x-c" = [ "nvim.desktop" ];
"text/x-c++" = [ "nvim.desktop" ];
"application/xml" = [ "nvim.desktop" ];
"text/xml" = [ "nvim.desktop" ];
2026-03-04 23:11:54 +00:00
};
2026-03-06 16:56:28 +00:00
};
imports = [
inputs.walker.homeManagerModules.default
2026-03-08 00:25:11 +00:00
inputs.voxtype.homeManagerModules.default
2026-03-06 16:56:28 +00:00
];
2026-03-07 00:26:43 +00:00
services = {
swayosd.enable = true;
};
2026-03-08 21:00:47 +00:00
# systemd.user = {
# enable = true;
# timers = {
# "station-battery-monitor" = {
# wantedBy = [ "timers.target" ];
# timerConfig = {
# OnBootSec = "1min";
# OnUnitActiveSec = "30sec";
# Unit = "station-battery-monitor.service";
# };
# };
# };
# services = {
# "station-battery-monitor" = {
# after = [ "graphical-session.target" ];
# serviceConfig = {
# Type = "oneshot";
# ExecStart = "%h/.local/share/omarchy/bin/omarchy-battery-monitor";
# Environment = "DISPLAY=:0";
# LogLevelMax = "warning";
# };
# };
# };
# };
2026-03-06 16:56:28 +00:00
programs = let
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
in {
walker = {
enable = true;
2026-03-08 00:25:11 +00:00
config = {};
2026-03-06 16:56:28 +00:00
runAsService = true;
};
elephant = {
enable = true;
2026-03-08 00:25:11 +00:00
};
voxtype = {
enable = true;
package = voxtype.packages.${system}.vulkan;
service.enable = true;
2026-03-08 21:00:47 +00:00
settings = {};
2026-03-06 16:56:28 +00:00
};
2026-03-08 23:18:43 +00:00
chromium = {
enable = true;
extensions = [
"cjpalhdlnbpafiamejdnhcphjbkeiagm"
"kmcfomidfpdkfieipokbalgegidffkal"
];
extraOpts = {
"BrowserSignin" = 0;
"SyncDisabled" = true;
"PasswordManagerEnabled" = false;
"SpellcheckEnabled" = true;
"SpellcheckLanguage" = [
"en-GB"
];
};
};
2026-03-06 16:56:28 +00:00
firefox = {
enable = true;
package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
extraPolicies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value= true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = false;
DisableAccounts = false;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "always"; # alternatives: "always" or "newtab"
DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
SearchBar = "unified"; # alternative: "separate"
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
/* ---- EXTENSIONS ---- */
ExtensionSettings = {
"*".installation_mode = "allowed"; # blocks all addons except the ones specified below
# Enpass
"firefox-enpass@enpass.io" = {
install_url = "https://dl.enpass.io/stable/extensions/firefox/versions/v6.11.10.2/enpass_password_manager-6.11.10.2.xpi";
installation_mode = "force_installed";
2026-03-01 11:15:56 +00:00
};
2026-03-06 16:56:28 +00:00
};
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
/* ---- PREFERENCES ---- */
# Set preferences shared by all profiles.
Preferences = {
"browser.contentblocking.category" = { Value = "strict"; Status = "locked"; };
"extensions.pocket.enabled" = lock-false;
"extensions.screenshots.disabled" = lock-true;
"browser.topsites.contile.enabled" = lock-false;
"browser.formfill.enable" = lock-false;
"browser.search.suggest.enabled" = lock-false;
"browser.search.suggest.enabled.private" = lock-false;
"browser.urlbar.suggest.searches" = lock-false;
"browser.urlbar.showSearchSuggestionsFirst" = lock-false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
"browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false;
"browser.newtabpage.activity-stream.showSponsored" = lock-false;
"browser.newtabpage.activity-stream.system.showSponsored" = lock-false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false;
"browser.newtabpage.activity-stream.feeds.section.highlights" = false;
2026-03-01 23:02:27 +00:00
};
};
2026-03-06 16:56:28 +00:00
};
profiles = {
default = {
id = 0;
name = "default";
isDefault = true;
search = {
default = "holocron";
order = [ "holocron" "google" ];
engines= {
holocron = {
name = "Holocron";
urls = [{
template = "https://holocron.scarif.space/search";
params = [
{ name = "q"; value = "{searchTerms}"; }
];
}];
icon = "https://holocron.scarif.space/favicon.ico";
definedAliases = [ "@h" ];
2026-03-01 23:02:27 +00:00
};
2026-03-06 16:56:28 +00:00
bing.metaData.hidden = true;
ebay.metaData.hidden = true;
perplexity.metaData.hidden = true;
2026-03-01 11:15:56 +00:00
};
};
};
2026-02-28 16:20:16 +00:00
};
2026-02-28 14:33:47 +00:00
};
2026-03-06 16:56:28 +00:00
};
nixpkgs = {
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
2026-02-27 00:51:33 +00:00
2026-03-06 16:56:28 +00:00
permittedInsecurePackages = [
"electron-25.9.0" # Obsidian
"beekeeper-studio-5.3.4"
];
2026-02-27 00:51:33 +00:00
};
};
};
2026-03-06 16:56:28 +00:00
extraSpecialArgs = {
inherit inputs;
};
};
2026-03-08 00:25:11 +00:00
system = {
autoUpgrade = {
enable = true;
allowReboot = false;
runGarbageCollection = true;
};
};
fonts = {
packages = with pkgs; [
nerd-fonts.jetbrains-mono
nerd-fonts.fira-code
];
};
2026-03-08 21:00:47 +00:00
hardware.bluetooth.enable = true;
2026-03-06 16:56:28 +00:00
}
];
2026-02-25 23:58:47 +00:00
};
2026-03-06 16:56:28 +00:00
};
2026-02-22 19:54:17 +00:00
2026-03-06 16:56:28 +00:00
# Standalone home-manager configuration entrypoint
#homeConfigurations = {
# chris = home-manager.lib.homeManagerConfiguration {
# inherit pkgs;
# extraSpecialArgs = {
# inherit inputs;
# };
# modules = [
# ./home
# ];
# };
#};
nix.settings = {
extra-substituters = [
"https://walker.cachix.org"
"https://walker-git.cachix.org"
];
extra-trusted-public-keys = [
"walker.cachix.org-1:fG8q+uAaMqhsMxWjwvk0IMb4mFPFLqHjuvfwQxE4oJM="
"walker-git.cachix.org-1:vmC0ocfPWh0S/vRAQGtChuiZBTAe4wiKDeyyXM0/7pM="
];
2026-02-28 14:33:47 +00:00
};
2026-03-06 16:56:28 +00:00
};
2026-02-22 19:54:17 +00:00
}