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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1677779205, "lastModified": 1682493015,
"narHash": "sha256-6DBjL9wjq86p2GczmwnHtFRnWPBPItc67gapWENBgX8=", "narHash": "sha256-KiMOAe8u83QDF40Z25kWMkZbqr9U+mvjvEJy5Qvw0nw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "96e18717904dfedcd884541e5a92bf9ff632cf39", "rev": "60c0f762658916a4a5b5a36b3e06486f8301daf4",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -5,10 +5,17 @@
shellAbbrs = { shellAbbrs = {
battery = "acpi"; 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>" # Jump to directories by typing "z <directory-name>"
{ {
name = "z"; name = "z";

View file

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

View file

@ -1,45 +1,22 @@
# TODO(imperanence): handle persistence
{ pkgs, inputs, ... }: { 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 = { programs.firefox = {
enable = true; enable = true;
profiles.adrielus = { profiles.adrielus = {
# {{{ High level user settings
# Unique user id # Unique user id
id = 0; id = 0;
# Make this the default user # Make this the default user
isDefault = true; isDefault = true;
# Forcefully replace the search configuration # Forcefully replace the search configuration
search.force = true; search.force = true;
# Set default search engine # Set default search engine
search.default = "Google"; search.default = "Google";
# }}}
# {{{ Extensions
extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ extensions = with inputs.firefox-addons.packages.${pkgs.system}; [
buster-captcha-solver buster-captcha-solver
bypass-paywalls-clean bypass-paywalls-clean
@ -67,77 +44,109 @@ in
vimium-c # vim keybinds vimium-c # vim keybinds
youtube-shorts-block 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 definedAliases = aliases;
search.engines = { };
"Nix Packages" = mkNixPackagesEngine {
aliases = [ "@np" "@nix-packages" ]; mkNixPackagesEngine = { aliases, type }:
type = "packages"; 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" ]; # {{{ Other lower level settings
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";
};
settings = { settings = {
# Required for figma to be able to export to svg # Required for figma to be able to export to svg
"dom.events.asyncClipboard.clipboardItem" = true; "dom.events.asyncClipboard.clipboardItem" = true;
}; };
# }}}
}; };
# {{{ Standalone "apps" which actually run inside a browser.
apps = { apps = {
# {{{ Job stuff # {{{ Job stuff
asana = { asana = {
@ -170,5 +179,25 @@ in
id = 4; 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 pkgs.qbittorrent
]; ];
# home.persistence."/persist".directories = [ home.persistence."/persist/home/adrielus".directories = [
# "${config.xdg.configHome}/qBittorrent" # Config options ".config/qBittorrent" # Config options
# # TODO: investigate which subdirectories/files I actually want to keep # TODO: investigate which subdirectories/files I actually want to keep
# "${config.xdg.dataHome}/qBittorrent" # Torrent files, logs, etc ".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.stylix.homeManagerModules.stylix
inputs.homeage.homeManagerModules.homeage inputs.homeage.homeManagerModules.homeage
inputs.nur.nixosModules.nur inputs.nur.nixosModules.nur
# inputs.impermanence.nixosModules.home-manager.impermanence inputs.impermanence.nixosModules.home-manager.impermanence
../features/cli ../features/cli
../features/neovim ../features/neovim
@ -51,4 +51,10 @@ in
# Where homeage should look for our ssh key # Where homeage should look for our ssh key
homeage.identityPaths = [ "~/.ssh/id_ed25519" ]; 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 ./global
./features/desktop/xmonad.nix ./features/desktop/xmonad.nix
./features/desktop/common/discord.nix ./features/desktop/common/discord.nix
./features/desktop/common/signal.nix
./features/desktop/common/qbittorrent.nix ./features/desktop/common/qbittorrent.nix
./features/desktop/common/zathura.nix ./features/desktop/common/zathura.nix
./features/desktop/common/firefox.nix ./features/desktop/common/firefox.nix
./features/desktop/common/games ./features/games
]; ];
# Arbitrary extra packages # Arbitrary extra packages
home.packages = with pkgs; [ home.packages = with pkgs; [
# Desktop apps # Desktop apps
signal-desktop # Signal client
zoom-us # Zoom client 🤮 zoom-us # Zoom client 🤮
element-desktop # Matrix client
obsidian # Notes obsidian # Notes
peek # GIF recorder peek # GIF recorder
vlc # Video player vlc # Video player
@ -21,7 +22,7 @@
libreoffice # Free office suite libreoffice # Free office suite
lmms # Music software lmms # Music software
kicad # PCB editing 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 # obs-studio # video recorder
# Clis # Clis

View file

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

View file

@ -30,10 +30,13 @@ in
gatewayPorts = "clientspecified"; gatewayPorts = "clientspecified";
# Generate ssh key # Generate ssh key
hostKeys = [{ hostKeys =
path = "/persist/etc/ssh/ssh_host_ed25519_key"; let mkKey = type: path: extra: { inherit type path; } // extra;
type = "ed25519"; 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 # Passwordless sudo when SSH'ing with keys

View file

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

View file

@ -7,7 +7,7 @@
# How fast we should scroll I think # How fast we should scroll I think
accelSpeed = "3.5"; accelSpeed = "3.5";
# #TODO: I forgor what this did # TODO: I forgor what this did
naturalScrolling = true; naturalScrolling = true;
# Dsiable the touchpad while typing # 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/lightdm.nix
../common/optional/steam.nix ../common/optional/steam.nix
../common/optional/slambda.nix ../common/optional/slambda.nix
../common/optional/xdg-portal.nix
../common/optional/xmonad ../common/optional/xmonad
./hardware-configuration.nix ./hardware-configuration.nix