1
Fork 0

Set up the basics of imperanence

This commit is contained in:
Matei Adriel 2023-04-27 02:08:20 +03:00
parent 7bd9d9aa0b
commit 78f154b38a
No known key found for this signature in database
20 changed files with 224 additions and 134 deletions

View file

@ -310,11 +310,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1677779205,
"narHash": "sha256-6DBjL9wjq86p2GczmwnHtFRnWPBPItc67gapWENBgX8=",
"lastModified": 1682493015,
"narHash": "sha256-KiMOAe8u83QDF40Z25kWMkZbqr9U+mvjvEJy5Qvw0nw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "96e18717904dfedcd884541e5a92bf9ff632cf39",
"rev": "60c0f762658916a4a5b5a36b3e06486f8301daf4",
"type": "github"
},
"original": {

View file

@ -5,10 +5,17 @@
shellAbbrs = {
battery = "acpi";
cat = "bat";
};
plugins = with pkgs.fishPlugins; [
shellAliases = {
cat = "bat";
df = "df -h";
du = "du -h";
duh = "du -hd 1"; # short for du here
};
# with pkgs.fishPlugins;
plugins = [
# Jump to directories by typing "z <directory-name>"
{
name = "z";

View file

@ -1,8 +1,11 @@
# TODO(imperanence): handle persistence
{
programs.discord = {
enable = true;
disableUpdateCheck = true;
enableDevtools = true;
};
home.persistence."/persist/home/adrielus".directories = [
".config/discord" # Why tf does discord store it's state here 💀
];
}

View file

@ -1,33 +1,9 @@
# TODO(imperanence): handle persistence
{ pkgs, inputs, ... }:
let
mkBasicSearchEngine = { aliases, url, param }: {
urls = [{
template = url;
params = [
{ name = param; value = "{searchTerms}"; }
];
}];
definedAliases = aliases;
};
mkNixPackagesEngine = { aliases, type }:
let basicEngine = mkBasicSearchEngine
{
aliases = aliases;
url = "https://search.nixos.org/${type}";
param = "query";
};
in
basicEngine // {
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
};
in
{
programs.firefox = {
enable = true;
profiles.adrielus = {
# {{{ High level user settings
# Unique user id
id = 0;
@ -39,7 +15,8 @@ in
# Set default search engine
search.default = "Google";
# }}}
# {{{ Extensions
extensions = with inputs.firefox-addons.packages.${pkgs.system}; [
buster-captcha-solver
bypass-paywalls-clean
@ -67,77 +44,109 @@ in
vimium-c # vim keybinds
youtube-shorts-block
];
# }}}
# {{{ Search engines
search.engines =
let
# {{{ Search engine creation helpers
mkBasicSearchEngine = { aliases, url, param }: {
urls = [{
template = url;
params = [
{ name = param; value = "{searchTerms}"; }
];
}];
# Specify custom search engines
search.engines = {
"Nix Packages" = mkNixPackagesEngine {
aliases = [ "@np" "@nix-packages" ];
type = "packages";
definedAliases = aliases;
};
mkNixPackagesEngine = { aliases, type }:
let basicEngine = mkBasicSearchEngine
{
aliases = aliases;
url = "https://search.nixos.org/${type}";
param = "query";
};
in
basicEngine // {
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
};
# }}}
in
# {{{ Engine declarations
{
"Nix Packages" = mkNixPackagesEngine {
aliases = [ "@np" "@nix-packages" ];
type = "packages";
};
"Nix options" = mkNixPackagesEngine {
aliases = [ "@no" "@nix-options" ];
type = "options";
};
# Purescript packages
"Pursuit" = mkBasicSearchEngine {
url = "https://pursuit.purescript.org/search";
param = "q";
aliases = [ "@ps" "@pursuit" ];
};
"Wikipedia" = mkBasicSearchEngine {
url = "https://en.wikipedia.org/wiki/Special:Search";
param = "search";
aliases = [ "@wk" "@wikipedia" ];
};
"Github" = mkBasicSearchEngine {
url = "https://github.com/search";
param = "q";
aliases = [ "@gh" "@github" ];
};
"Youtube" = mkBasicSearchEngine {
url = "https://www.youtube.com/results";
param = "search_query";
aliases = [ "@yt" "@youtube" ];
};
"Noita wiki" = mkBasicSearchEngine {
url = "https://noita.wiki.gg/index.php";
param = "search";
aliases = [ "@noita" ];
};
"Rain world wiki" = mkBasicSearchEngine {
url = "https://rainworld.miraheze.org/w/index.php";
param = "search";
aliases = [ "@rw" "@rain-world" ];
};
"Factorio wiki" = mkBasicSearchEngine {
url = "https://wiki.factorio.com/index.php";
param = "search";
aliases = [ "@fw" "@factorio-wiki" ];
};
"Factorio mod portal" = mkBasicSearchEngine {
url = "https://mods.factorio.com/";
param = "query";
aliases = [ "@fm" "@factorio-mods" ];
};
"Google".metaData.alias = "@g";
};
"Nix options" = mkNixPackagesEngine {
aliases = [ "@no" "@nix-options" ];
type = "options";
};
# Purescript packages
"Pursuit" = mkBasicSearchEngine {
url = "https://pursuit.purescript.org/search";
param = "q";
aliases = [ "@ps" "@pursuit" ];
};
"Wikipedia" = mkBasicSearchEngine {
url = "https://en.wikipedia.org/wiki/Special:Search";
param = "search";
aliases = [ "@wk" "@wikipedia" ];
};
"Github" = mkBasicSearchEngine {
url = "https://github.com/search";
param = "q";
aliases = [ "@gh" "@github" ];
};
"Youtube" = mkBasicSearchEngine {
url = "https://www.youtube.com/results";
param = "search_query";
aliases = [ "@yt" "@youtube" ];
};
"Noita wiki" = mkBasicSearchEngine {
url = "https://noita.wiki.gg/index.php";
param = "search";
aliases = [ "@noita" ];
};
"Rain world wiki" = mkBasicSearchEngine {
url = "https://rainworld.miraheze.org/w/index.php";
param = "search";
aliases = [ "@rw" "@rain-world" ];
};
"Factorio wiki" = mkBasicSearchEngine {
url = "https://wiki.factorio.com/index.php";
param = "search";
aliases = [ "@fw" "@factorio-wiki" ];
};
"Factorio mod portal" = mkBasicSearchEngine {
url = "https://mods.factorio.com/";
param = "query";
aliases = [ "@fm" "@factorio-mods" ];
};
"Google".metaData.alias = "@g";
};
# }}}
# }}}
# {{{ Other lower level settings
settings = {
# Required for figma to be able to export to svg
"dom.events.asyncClipboard.clipboardItem" = true;
};
# }}}
};
# {{{ Standalone "apps" which actually run inside a browser.
apps = {
# {{{ Job stuff
asana = {
@ -170,5 +179,25 @@ in
id = 4;
};
};
# }}}
};
# {{{ Make firefox the default
# Use firefox as the default browser to open stuff.
# xdg.mimeApps.defaultApplications = {
# "text/html" = [ "firefox.desktop" ];
# "text/xml" = [ "firefox.desktop" ];
# "x-scheme-handler/http" = [ "firefox.desktop" ];
# "x-scheme-handler/https" = [ "firefox.desktop" ];
# };
# Tell apps firefox is the default browser using an env var.
home.sessionVariables.BROWSER = "firefox";
# }}}
# {{{ Persistence
home.persistence."/persist/home/adrielus".directories = [
".cache/mozilla/firefox" # Non important cache
".mozilla/firefox" # More important stuff
];
# }}}
}

View file

@ -1,3 +0,0 @@
{
imports = [ ./wine.nix ./lutris.nix ];
}

View file

@ -1,12 +0,0 @@
{ pkgs, config, ... }: {
home.packages = [
pkgs.lutris
];
# home.persistence."/persist".directories = [
# "${config.xdg.configHome}/lutris" # General config data
# "${config.xdg.cacheHome}/banners" # Game banners
# "${config.xdg.cacheHome}/coverart" # Game cover art
# "${config.home.homeDirectory}/Games" # Game directory
# ];
}

View file

@ -3,9 +3,9 @@
pkgs.qbittorrent
];
# home.persistence."/persist".directories = [
# "${config.xdg.configHome}/qBittorrent" # Config options
# # TODO: investigate which subdirectories/files I actually want to keep
# "${config.xdg.dataHome}/qBittorrent" # Torrent files, logs, etc
# ];
home.persistence."/persist/home/adrielus".directories = [
".config/qBittorrent" # Config options
# TODO: investigate which subdirectories/files I actually want to keep
".local/share/qBittorrent" # Torrent files, logs, etc
];
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }: {
home.packages = [
pkgs.signal-desktop # Signal client
];
home.persistence."/persist/home/adrielus".directories = [
".config/Signal" # Why tf does signal store it's state here 💀
];
}

View file

@ -0,0 +1,3 @@
{
imports = [ ./wine.nix ./lutris.nix ./steam.nix ];
}

View file

@ -0,0 +1,14 @@
{ pkgs, config, ... }: {
home.packages = [
pkgs.lutris
];
home.persistence."/persist/home/adrielus".directories = [
".config/lutris" # General config data
".cache/lutris/banners" # Game banners
".cache/lutris/coverart" # Game cover art
# Aparently IO intensive stuff like games prefer symlinks?
{ directory = "Games/Lutris"; method = "symlink"; } # Lutris games
];
}

View file

@ -0,0 +1,20 @@
# Although steam is installed globally by nixos,
# there's some extra settings we make for a specific user!
{
home.persistence."/persist/home/adrielus" = {
files = [
".steam/registry.vdf" # It seems like auto-login does not work without this
];
directories = [
# TODO: perhaps this should leave in it's own file?
".factorio"
# A couple of games don't play well with bindfs
{
directory = ".local/share/Steam";
method = "symlink";
}
];
};
}

View file

@ -5,7 +5,7 @@ let
inputs.stylix.homeManagerModules.stylix
inputs.homeage.homeManagerModules.homeage
inputs.nur.nixosModules.nur
# inputs.impermanence.nixosModules.home-manager.impermanence
inputs.impermanence.nixosModules.home-manager.impermanence
../features/cli
../features/neovim
@ -51,4 +51,10 @@ in
# Where homeage should look for our ssh key
homeage.identityPaths = [ "~/.ssh/id_ed25519" ];
# Allow root to read persistent files from this user.
home.persistence."/persist/home/adrielus".allowOther = true;
# Set the xdg env vars
xdg.enable = true;
}

View file

@ -3,17 +3,18 @@
./global
./features/desktop/xmonad.nix
./features/desktop/common/discord.nix
./features/desktop/common/signal.nix
./features/desktop/common/qbittorrent.nix
./features/desktop/common/zathura.nix
./features/desktop/common/firefox.nix
./features/desktop/common/games
./features/games
];
# Arbitrary extra packages
home.packages = with pkgs; [
# Desktop apps
signal-desktop # Signal client
zoom-us # Zoom client 🤮
element-desktop # Matrix client
obsidian # Notes
peek # GIF recorder
vlc # Video player
@ -21,7 +22,7 @@
libreoffice # Free office suite
lmms # Music software
kicad # PCB editing
google-chrome # Not my primary browser, but sometimes needed in webdev
# google-chrome # Not my primary browser, but sometimes needed in webdev
# obs-studio # video recorder
# Clis

View file

@ -6,7 +6,7 @@ let
inputs.stylix.nixosModules.stylix
inputs.slambda.nixosModule
inputs.nur.nixosModules.nur
# inputs.impermanence.nixosModule
inputs.impermanence.nixosModule
./nix.nix
./openssh.nix
@ -20,9 +20,9 @@ in
# Import all modules defined in modules/nixos
imports = builtins.attrValues outputs.nixosModules ++ imports;
age.identityPaths = [
"/etc/ssh/ssh_host_ed25519_key"
];
# Allow non root users to specify the "allowOther" option.
# See [the imperanence readme](https://github.com/nix-community/impermanence#home-manager)
programs.fuse.userAllowOther = true;
nixpkgs = {
# Add all overlays defined in the overlays directory

View file

@ -30,10 +30,13 @@ in
gatewayPorts = "clientspecified";
# Generate ssh key
hostKeys = [{
path = "/persist/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}];
hostKeys =
let mkKey = type: path: extra: { inherit type path; } // extra;
in
[
(mkKey "ed25519" "/persist/etc/ssh/ssh_host_ed25519_key" { })
(mkKey "rsa" "/persist/etc/ssh/ssh_host_rsa_key" { bits = 4096; })
];
};
# Passwordless sudo when SSH'ing with keys

View file

@ -43,10 +43,9 @@
# Ensure group exists
users.groups.network = { };
# TODO: figure out why this does not work!
# Persist imperative config
# environment.persistence = {
# "/persist".files = [
# "/etc/wpa_supplicant.conf"
# ];
# };
# environment.persistence."/persist".files = [
# "/etc/wpa_supplicant.conf"
# ];
}

View file

@ -7,7 +7,7 @@
# How fast we should scroll I think
accelSpeed = "3.5";
# #TODO: I forgor what this did
# TODO: I forgor what this did
naturalScrolling = true;
# Dsiable the touchpad while typing

View file

@ -0,0 +1,10 @@
{ pkgs, lib, ... }: {
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [ pkgs.xdg-desktop-portal ];
};
# HACK: copied from @lily on discord.
systemd.user.services.xdg-desktop-portal.path = lib.mkAfter [ "/run/current-system/sw" ];
}

View file

@ -9,6 +9,7 @@
../common/optional/lightdm.nix
../common/optional/steam.nix
../common/optional/slambda.nix
../common/optional/xdg-portal.nix
../common/optional/xmonad
./hardware-configuration.nix