29 Commits

Author SHA1 Message Date
8ab86428ec attempt to use pkgs for unfree predicate
still not working
2023-03-10 21:22:07 -05:00
d4fa322fb1 fix: neovim xdg mimeapps don't work in macos 2023-03-09 10:45:11 -05:00
3d73f8cab4 switch to nixpkgs slack instead of homebrew 2023-03-09 10:45:00 -05:00
0df8af607d associate media applications as defaults 2023-03-08 22:58:49 -05:00
61d9b103b0 set local network hosts file 2023-03-08 22:57:48 -05:00
71d0d3ca14 move yt-dlp to separate file 2023-03-08 22:57:30 -05:00
d5b0405b99 fix: default nvim desktop mime-apps 2023-03-08 22:55:34 -05:00
3cad3d2fb0 bring back tabularize to neovim config 2023-03-08 18:14:52 -05:00
2acd9b3478 add yt-dlp to media packages 2023-03-08 18:14:30 -05:00
bf4be11718 don't garbage collect direnv flakes 2023-03-08 17:43:30 -05:00
4d38d1094f limit number of configurations
not really a big problem, but worth adding just in case
2023-03-08 17:42:25 -05:00
183babd2f0 disable community cachix on macos
ssl at work prevents connection
2023-03-08 10:30:47 -05:00
12682a57e1 macos: don't recreate canvas on app switcher 2023-03-08 10:30:25 -05:00
31170a616f client samba cleanup 2023-03-05 23:47:52 -05:00
4502c5ff62 enhancements for samba server 2023-03-06 04:46:12 +00:00
59bd3590a4 turn on fstrim for ssds 2023-03-05 23:07:03 -05:00
ebacff7250 remove unnecessary trash in darwin 2023-03-05 23:04:28 -05:00
763f0bbdda enable trash on linux 2023-03-05 23:04:06 -05:00
18505d4cbb enable steam remote play 2023-03-05 23:03:34 -05:00
a7c04b59ed use entire data dir for samba 2023-03-05 20:44:55 +00:00
d46e6dad6b open firewall for samba connection 2023-03-05 19:59:58 +00:00
5e4642b92e fix: mail pass file set incorrectly 2023-03-05 09:05:45 -05:00
7ab78767d4 move calibre books to zfs directory 2023-03-04 01:04:02 +00:00
366a7f6157 move nextcloud data directory 2023-03-03 20:54:27 +00:00
fb47302f3b add cachix community binary cache 2023-03-03 09:39:42 -05:00
cda3ee0a4c credit attribution to LaunchBar for applescript 2023-03-02 15:15:07 -05:00
0ed11de174 move gvfs outside of common
nixos-only option
2023-03-02 14:49:20 -05:00
ab6f80fc18 overlay for age no longer needed 2023-03-02 14:48:49 -05:00
d1f21ec874 fix: dismiss notifications with hammerspoon in ventura 2023-03-02 14:47:51 -05:00
39 changed files with 319 additions and 122 deletions

23
docs/restore-calibre.md Normal file
View File

@ -0,0 +1,23 @@
# Restoring Calibre From Backup
The `metadata.db` holds the library and `app.db` and `gdrive.db` contain the
web/account information.
Place books directories in `/data/books/`.
Place `metadata.db` in `/var/lib/calibre-web-db/`.
Symlink `metadata.db` to the library:
```
sudo ln -s /var/lib/calibre-web-db/metadata.db /data/books/metadata.db
```
Place `app.db` and `gdrive.db` in `/var/lib/calibre-web/`.
Restart Calibre:
```
sudo systemctl restart calibre-web.service
```

View File

@ -22,10 +22,10 @@ litestream restore -o nextcloud.db s3://noahmasur-backup.s3.us-west-002.backblaz
Install Nextcloud. Then copy DB: Install Nextcloud. Then copy DB:
``` ```
sudo rm /var/lib/nextcloud/data/nextcloud.db* sudo rm /data/nextcloud/data/nextcloud.db*
sudo mv nextcloud.db /var/lib/nextcloud/data/ sudo mv nextcloud.db /data/nextcloud/data/
sudo chown nextcloud:nextcloud /var/lib/nextcloud/data/nextcloud.db sudo chown nextcloud:nextcloud /data/nextcloud/data/nextcloud.db
sudo chmod 770 /var/lib/nextcloud/data/nextcloud.db sudo chmod 770 /data/nextcloud/data/nextcloud.db
``` ```
Restart Nextcloud: Restart Nextcloud:
@ -37,7 +37,7 @@ sudo systemctl restart phpfpm-nextcloud.service
Adjust Permissions and Directories: Adjust Permissions and Directories:
``` ```
sudo mkdir /var/lib/nextcloud/data/noah/files sudo mkdir /data/nextcloud/data/noah/files
sudo chown nextcloud:nextcloud /var/lib/nextcloud/data/noah/files sudo chown nextcloud:nextcloud /data/nextcloud/data/noah/files
``` ```

24
flake.lock generated
View File

@ -94,11 +94,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1675471726, "lastModified": 1676854489,
"narHash": "sha256-526iHwidfdtZZ7aAU9od1/zbyfSFBEailBTet+Gvfqg=", "narHash": "sha256-hWmx3JFLNPGMtflyjgEn5GZydbLW3msjXvarS1NsBDM=",
"owner": "bandithedoge", "owner": "bandithedoge",
"repo": "nixpkgs-firefox-darwin", "repo": "nixpkgs-firefox-darwin",
"rev": "813d55a3e3b3c0423eb5d1fcb4bf82197c9f7796", "rev": "6a5cca0ea8dfab4718e1e43e243c80ba110c2364",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -176,11 +176,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1675935446, "lastModified": 1678271387,
"narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=", "narHash": "sha256-H2dv/i1LRlunRtrESirELzfPWdlG/6ElDB1ksO529H4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2dce7f1a55e785a22d61668516df62899278c9e4", "rev": "36999b8d19eb6eebb41983ef017d7e0095316af2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -301,11 +301,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1676973346, "lastModified": 1676885936,
"narHash": "sha256-rft8oGMocTAhUVqG3LW6I8K/Fo9ICGmNjRqaWTJwav0=", "narHash": "sha256-ZRKb6zBfTvdCOXI7nGC1L9UWSU5ay2ltxg+f5UIzBOU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d0d55259081f0b97c828f38559cad899d351cad1", "rev": "b69883faca9542d135fa6bab7928ff1b233c167f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -510,11 +510,11 @@
}, },
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1676283394,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -44,6 +44,7 @@ darwin.lib.darwinSystem {
lua.enable = true; lua.enable = true;
kubernetes.enable = true; kubernetes.enable = true;
_1password.enable = true; _1password.enable = true;
slack.enable = true;
} }
]; ];
} }

View File

@ -41,6 +41,7 @@ nixpkgs.lib.nixosSystem {
caddy.enable = true; caddy.enable = true;
streamServer = "stream.masu.rs"; streamServer = "stream.masu.rs";
nextcloudServer = "cloud.masu.rs"; nextcloudServer = "cloud.masu.rs";
bookServer = "books.masu.rs";
samba.enable = true; samba.enable = true;
backup.s3 = { backup.s3 = {

View File

@ -49,6 +49,7 @@ nixpkgs.lib.nixosSystem {
# mullvad.enable = true; # mullvad.enable = true;
nixlang.enable = true; nixlang.enable = true;
dotfiles.enable = true; dotfiles.enable = true;
yt-dlp.enable = true;
gaming = { gaming = {
enable = true; enable = true;

View File

@ -11,7 +11,7 @@
config = lib.mkIf config = lib.mkIf
(config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) { (config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) {
unfreePackages = [ "1password" "_1password-gui" ]; unfreePackages = with pkgs; [ _1password _1password-gui ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ _1password-gui ]; home.packages = with pkgs; [ _1password-gui ];
}; };

View File

@ -7,9 +7,11 @@
./firefox.nix ./firefox.nix
./kitty.nix ./kitty.nix
./media.nix ./media.nix
./nautilus.nix
./obsidian.nix ./obsidian.nix
./qbittorrent.nix ./qbittorrent.nix
./nautilus.nix ./slack.nix
./yt-dlp.nix
]; ];
} }

View File

@ -10,7 +10,7 @@
}; };
config = lib.mkIf (config.gui.enable && config.discord.enable) { config = lib.mkIf (config.gui.enable && config.discord.enable) {
unfreePackages = [ "discord" ]; unfreePackages = [ pkgs.discord ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ discord ]; home.packages = with pkgs; [ discord ];
xdg.configFile."discord/settings.json".text = '' xdg.configFile."discord/settings.json".text = ''

View File

@ -13,9 +13,9 @@
config = lib.mkIf (config.gui.enable && config.firefox.enable) { config = lib.mkIf (config.gui.enable && config.firefox.enable) {
unfreePackages = [ unfreePackages = with pkgs.nur.repos.rycee.firefox-addons; [
(lib.mkIf config._1password.enable "onepassword-password-manager") (lib.mkIf config._1password.enable onepassword-password-manager)
"okta-browser-plugin" okta-browser-plugin
]; ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {

View File

@ -19,9 +19,17 @@
]; ];
# Set default for opening PDFs # Set default for opening PDFs
xdg.mimeApps.defaultApplications."application/pdf" = xdg.mimeApps = {
[ "zathura.desktop" ]; associations.added = {
xdg.mimeApps.defaultApplications."image/*" = [ "sxiv.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/*" = [ "sxiv.desktop" ];
};
associations.removed = { "application/pdf" = [ "mupdf.desktop" ]; };
defaultApplications = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/*" = [ "sxiv.desktop" ];
};
};
}; };

View File

@ -29,9 +29,6 @@
}; };
}; };
# Allow browsing Samba shares
services.gvfs.enable = true;
}; };
} }

View File

@ -10,7 +10,7 @@
}; };
config = lib.mkIf (config.gui.enable && config.obsidian.enable) { config = lib.mkIf (config.gui.enable && config.obsidian.enable) {
unfreePackages = [ "obsidian" ]; unfreePackages = [ pkgs.obsidian ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ obsidian ]; home.packages = with pkgs; [ obsidian ];
}; };

View File

@ -0,0 +1,19 @@
{ config, pkgs, lib, ... }: {
options = {
slack = {
enable = lib.mkEnableOption {
description = "Enable Slack.";
default = false;
};
};
};
config = lib.mkIf (config.gui.enable && config.slack.enable) {
unfreePackages = [ pkgs.slack ];
home-manager.users.${config.user} = {
home.packages = with pkgs; [ slack ];
};
};
}

View File

@ -0,0 +1,35 @@
{ config, pkgs, lib, ... }: {
options = {
yt-dlp = {
enable = lib.mkEnableOption {
description = "Enable YouTube downloader.";
default = false;
};
};
};
config = lib.mkIf (config.yt-dlp.enable) {
home-manager.users.${config.user} = {
programs.yt-dlp = {
enable = true;
extraConfig = "";
settings = {
no-continue = true; # Always re-download each fragment
no-overwrites = true; # Don't overwrite existing files
download-archive = "archive.log"; # Log of archives
embed-metadata = true;
embed-thumbnail = true;
embed-subs = true;
sub-langs = "en.*";
concurrent-fragments = 4; # Parallel download chunks
};
};
programs.fish.shellAbbrs.yt = "yt-dlp";
};
};
}

View File

@ -68,7 +68,7 @@
description = "Link to dotfiles repository."; description = "Link to dotfiles repository.";
}; };
unfreePackages = lib.mkOption { unfreePackages = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.package;
description = "List of unfree packages to allow."; description = "List of unfree packages to allow.";
default = [ ]; default = [ ];
}; };
@ -77,11 +77,29 @@
config = let stateVersion = "23.05"; config = let stateVersion = "23.05";
in { in {
# Enable features in Nix commands nix = {
nix.extraOptions = ''
experimental-features = nix-command flakes # Enable features in Nix commands
warn-dirty = false extraOptions = ''
''; experimental-features = nix-command flakes
warn-dirty = false
'';
settings = {
# Add community Cachix to binary cache
substituters = lib.mkIf (!pkgs.stdenv.isDarwin)
[ "https://nix-community.cachix.org" ];
trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
# Scans and hard links identical files in the store
auto-optimise-store = true;
};
};
# Basic common system packages for all devices # Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ]; environment.systemPackages = with pkgs; [ git vim wget curl ];
@ -95,8 +113,10 @@
# Allow specified unfree packages (identified elsewhere) # Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name # Retrieves package object based on string name
# Idea: https://discourse.nixos.org/t/how-to-use-packages-directly-in-allowunfreepredicate/22455/6
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) config.unfreePackages; builtins.elem (pkg.name or (builtins.parseDrvName pkg.pname).name)
(map lib.getName config.unfreePackages);
# Pin a state version to prevent warnings # Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion; home-manager.users.${config.user}.home.stateVersion = stateVersion;

View File

@ -67,7 +67,7 @@
notmuch.enable = false; notmuch.enable = false;
passwordCommand = passwordCommand =
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${ "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
builtins.toString ../../private/mailpass.age builtins.toString ../../../private/mailpass.age
}"; }";
smtp = { smtp = {
host = "smtp.purelymail.com"; host = "smtp.purelymail.com";

View File

@ -0,0 +1,9 @@
{ pkgs, ... }: {
plugins = [ pkgs.vimPlugins.tabular ];
lua = ''
-- Align
vim.keymap.set("", "<Leader>ta", ":Tabularize /")
vim.keymap.set("", "<Leader>t#", ":Tabularize /#<CR>")
vim.keymap.set("", "<Leader>tl", ":Tabularize /---<CR>")
'';
}

View File

@ -34,6 +34,14 @@ in {
programs.kitty.settings.scrollback_pager = lib.mkForce '' programs.kitty.settings.scrollback_pager = lib.mkForce ''
${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -''; ${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
name = "Neovim wrapper";
exec = "kitty nvim %F";
};
xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux {
defaultApplications."text/markdown" = [ "nvim.desktop" ];
};
}; };
# # Used for icons in Vim # # Used for icons in Vim

View File

@ -31,6 +31,7 @@
pkgs.neovimBuilder { pkgs.neovimBuilder {
package = pkgs.neovim-unwrapped; package = pkgs.neovim-unwrapped;
imports = [ imports = [
../config/align.nix
../config/bufferline.nix ../config/bufferline.nix
../config/completion.nix ../config/completion.nix
../config/gitsigns.nix ../config/gitsigns.nix

View File

@ -6,4 +6,10 @@
config = { whitelist = { prefix = [ config.dotfilesPath ]; }; }; config = { whitelist = { prefix = [ config.dotfilesPath ]; }; };
}; };
# Prevent garbage collection
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
} }

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { { config, pkgs, lib, ... }: {
users.users.${config.user}.shell = pkgs.fish; users.users.${config.user}.shell = pkgs.fish;
programs.fish.enable = programs.fish.enable =
@ -11,7 +11,10 @@
programs.fish = { programs.fish = {
enable = true; enable = true;
shellAliases = { ls = "exa"; }; shellAliases = {
ls = "exa";
trash = lib.mkIf pkgs.stdenv.isLinux "${pkgs.trash-cli}/bin/trash-put";
};
functions = { functions = {
commandline-git-commits = { commandline-git-commits = {
description = "Insert commit into commandline"; description = "Insert commit into commandline";
@ -90,6 +93,7 @@
sc = "systemctl"; sc = "systemctl";
scs = "systemctl status"; scs = "systemctl status";
m = "make"; m = "make";
t = "trash";
# Vim (overwritten by Neovim) # Vim (overwritten by Neovim)
v = "vim"; v = "vim";

View File

@ -17,20 +17,6 @@ in {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Fix: age won't build
nixpkgs.overlays = [
(_final: prev: {
age = prev.age.overrideAttrs (_old: {
src = prev.fetchFromGitHub {
owner = "FiloSottile";
repo = "age";
rev = "7354aa0d08a06eac42c635670a55f858bd23c943";
sha256 = "H80mNTgZmExDMgubONIXP7jmLBvNMVqXee6NiZJhPFY=";
};
});
})
];
home.packages = with pkgs; [ home.packages = with pkgs; [
unzip # Extract zips unzip # Extract zips
rsync # Copy folders rsync # Copy folders

View File

@ -16,6 +16,7 @@
firefox = "${pkgs.firefox-bin}/Applications/Firefox.app"; firefox = "${pkgs.firefox-bin}/Applications/Firefox.app";
discord = "${pkgs.discord}/Applications/Discord.app"; discord = "${pkgs.discord}/Applications/Discord.app";
kitty = "${pkgs.kitty}/Applications/kitty.app"; kitty = "${pkgs.kitty}/Applications/kitty.app";
slack = "${pkgs.slack}/Applications/Slack.app";
}; };
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source = xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source =
./hammerspoon/Spoons/MoveWindow.spoon; ./hammerspoon/Spoons/MoveWindow.spoon;

View File

@ -0,0 +1,21 @@
# Credit: https://github.com/Ptujec/LaunchBar/blob/f7b5a0dba9919c2fec879513f68a044f78748539/Notifications/Dismiss%20all%20notifications.lbaction/Contents/Scripts/default.applescript
tell application "System Events"
try
set _groups to groups of UI element 1 of scroll area 1 of group 1 of window "Notification Center" of application process "NotificationCenter"
repeat with _group in _groups
set _actions to actions of _group
repeat with _action in _actions
if description of _action is in {"Schlie§en", "Alle entfernen", "Close", "Clear All"} then
perform _action
end if
end repeat
end repeat
end try
end tell

View File

@ -10,7 +10,7 @@ obj.license = "MIT - https://opensource.org/licenses/MIT"
function obj:init() function obj:init()
hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "k", function() hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "k", function()
hs.osascript.javascriptFromFile("Spoons/DismissAlerts.spoon/close_notifications_applescript.js") hs.osascript.applescriptFromFile("Spoons/DismissAlerts.spoon/close_notifications.applescript")
end) end)
end end

View File

@ -8,44 +8,44 @@ obj.name = "Launcher"
obj.version = "0.1" obj.version = "0.1"
obj.license = "MIT - https://opensource.org/licenses/MIT" obj.license = "MIT - https://opensource.org/licenses/MIT"
function DrawSwitcher() local width = hs.screen.mainScreen():fullFrame().w
-- Drawing local switcherWidth = 500
local width = hs.screen.mainScreen():fullFrame().w obj.canvas = hs.canvas.new({
local switcherWidth = 500 x = width / 2 - switcherWidth / 2,
local canv = hs.canvas.new({ y = 1,
x = width / 2 - switcherWidth / 2, h = 3,
y = 1, w = switcherWidth,
h = 3, })
w = switcherWidth, -- Draw switcher
}) obj.canvas[#obj.canvas + 1] = {
canv[#canv + 1] = { action = "build",
action = "build", type = "rectangle",
type = "rectangle", }
} obj.canvas[#obj.canvas + 1] = {
canv[#canv + 1] = { type = "rectangle",
type = "rectangle", fillColor = { alpha = 1, red = 0.8, green = 0.6, blue = 0.3 },
fillColor = { alpha = 1, red = 0.8, green = 0.6, blue = 0.3 }, action = "fill",
action = "fill", }
}
return canv:show()
end
function obj:init() function obj:init()
-- Begin launcher mode -- Begin launcher mode
if self.launcher == nil then if self.launcher == nil then
self.launcher = hs.hotkey.modal.new("ctrl", "space") self.launcher = hs.hotkey.modal.new("ctrl", "space")
print(self.canvas)
print(obj.canvas)
end end
-- Behaviors on enter -- Behaviors on enter
function self.launcher:entered() function self.launcher:entered()
-- hs.alert("Entered mode") -- hs.alert("Entered mode")
self.canv = DrawSwitcher() obj.canvas:show()
end end
-- Behaviors on exit -- Behaviors on exit
function self.launcher:exited() function self.launcher:exited()
-- hs.alert("Exited mode") -- hs.alert("Exited mode")
self.canv:hide() obj.canvas:hide()
end end
-- Use escape to exit launcher mode -- Use escape to exit launcher mode
@ -54,7 +54,8 @@ function obj:init()
end) end)
-- Launcher shortcuts -- Launcher shortcuts
self.launcher:bind("ctrl", "space", function() end) self.launcher:bind("ctrl", "space", function()
end)
self.launcher:bind("", "return", function() self.launcher:bind("", "return", function()
self:switch("@kitty@") self:switch("@kitty@")
end) end)
@ -92,7 +93,7 @@ function obj:init()
hs.reload() hs.reload()
end) end)
self.launcher:bind("", "S", function() self.launcher:bind("", "S", function()
self:switch("Slack.app") self:switch("@slack@")
end) end)
self.launcher:bind("", "Z", function() self.launcher:bind("", "Z", function()
self:switch("zoom.us.app") self:switch("zoom.us.app")

View File

@ -45,12 +45,6 @@
]; ];
}; };
home-manager.users.${config.user} = {
programs.fish.shellAbbrs.t = "trash";
};
}; };
} }

View File

@ -166,7 +166,7 @@
echo "Choose and order dock icons" echo "Choose and order dock icons"
defaults write com.apple.dock persistent-apps -array \ defaults write com.apple.dock persistent-apps -array \
"$(__dock_item /Applications/1Password.app)" \ "$(__dock_item /Applications/1Password.app)" \
"$(__dock_item /Applications/Slack.app)" \ "$(__dock_item ${pkgs.slack}/Applications/Slack.app)" \
"$(__dock_item /System/Applications/Calendar.app)" \ "$(__dock_item /System/Applications/Calendar.app)" \
"$(__dock_item ${pkgs.firefox-bin}/Applications/Firefox.app)" \ "$(__dock_item ${pkgs.firefox-bin}/Applications/Firefox.app)" \
"$(__dock_item /System/Applications/Messages.app)" \ "$(__dock_item /System/Applications/Messages.app)" \

View File

@ -14,7 +14,7 @@ in {
config = lib.mkIf config.gaming.minecraft-server.enable { config = lib.mkIf config.gaming.minecraft-server.enable {
unfreePackages = [ "minecraft-server" ]; unfreePackages = [ pkgs.minecraft-server ];
services.minecraft-server = { services.minecraft-server = {
enable = true; enable = true;

View File

@ -4,16 +4,21 @@
config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) { config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) {
hardware.steam-hardware.enable = true; hardware.steam-hardware.enable = true;
unfreePackages = [ "steam" "steam-original" "steamcmd" "steam-run" ]; unfreePackages = with pkgs; [ steam steamcmd steam-run ];
environment.systemPackages = with pkgs; [
steam programs.steam = {
enable = true;
remotePlay.openFirewall = true;
};
environment.systemPackages = with pkgs; [
# Enable terminal interaction # Enable terminal interaction
steamPackages.steamcmd steamPackages.steamcmd
steam-tui steam-tui
]; ];
}; };
} }

View File

@ -13,6 +13,9 @@
# Attempt to display GRUB on widescreen monitor # Attempt to display GRUB on widescreen monitor
gfxmodeEfi = "1920x1080"; gfxmodeEfi = "1920x1080";
# Limit the total number of configurations to rollback
configurationLimit = 25;
# Install GRUB onto the boot disk # Install GRUB onto the boot disk
# device = config.fileSystems."/boot".device; # device = config.fileSystems."/boot".device;

View File

@ -3,6 +3,7 @@
imports = [ imports = [
./audio.nix ./audio.nix
./boot.nix ./boot.nix
./disk.nix
./keyboard.nix ./keyboard.nix
./monitors.nix ./monitors.nix
./mouse.nix ./mouse.nix

View File

@ -0,0 +1,7 @@
{ config, pkgs, lib, ... }: {
# Enable fstrim, which tracks free space on SSDs for garbage collection
# More info: https://www.reddit.com/r/NixOS/comments/rbzhb1/if_you_have_a_ssd_dont_forget_to_enable_fstrim/
services.fstrim.enable = true;
}

View File

@ -9,6 +9,12 @@
networking.interfaces.enp5s0.useDHCP = true; networking.interfaces.enp5s0.useDHCP = true;
networking.interfaces.wlp4s0.useDHCP = true; networking.interfaces.wlp4s0.useDHCP = true;
networking.firewall.allowPing = lib.mkIf config.server true;
networking.hosts = {
"192.168.0.120" = [ "tempest" ];
"192.168.0.218" = [ "swan" ];
};
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }:
let
libraryPath = "/data/books";
in {
options = { options = {
bookServer = lib.mkOption { bookServer = lib.mkOption {
@ -6,6 +12,11 @@
description = "Hostname for Calibre library"; description = "Hostname for Calibre library";
default = null; default = null;
}; };
backups.calibre = lib.mkOption {
type = lib.types.bool;
description = "Whether to backup Calibre library";
default = true;
};
}; };
config = lib.mkIf (config.bookServer != null) { config = lib.mkIf (config.bookServer != null) {
@ -17,6 +28,7 @@
reverseProxyAuth.enable = false; reverseProxyAuth.enable = false;
enableBookConversion = true; enableBookConversion = true;
enableBookUploading = true; enableBookUploading = true;
calibreLibrary = libraryPath;
}; };
}; };
@ -30,7 +42,7 @@
}]; }];
# Run a backup on a schedule # Run a backup on a schedule
systemd.timers.calibre-backup = { systemd.timers.calibre-backup = lib.mkIf config.backups.calibre {
timerConfig = { timerConfig = {
OnCalendar = "*-*-* 00:00:00"; # Once per day OnCalendar = "*-*-* 00:00:00"; # Once per day
Unit = "calibre-backup.service"; Unit = "calibre-backup.service";
@ -39,24 +51,22 @@
}; };
# Backup Calibre data to object storage # Backup Calibre data to object storage
systemd.services.calibre-backup = systemd.services.calibre-backup = lib.mkIf config.backups.calibre {
let libraryPath = "/var/lib/calibre-web"; # Default location description = "Backup Calibre data";
in { environment.AWS_ACCESS_KEY_ID = config.backup.s3.accessKeyId;
description = "Backup Calibre data"; serviceConfig = {
environment.AWS_ACCESS_KEY_ID = config.backup.s3.accessKeyId; Type = "oneshot";
serviceConfig = { User = "calibre-web";
Type = "oneshot"; Group = "backup";
User = "calibre-web"; EnvironmentFile = config.secrets.backup.dest;
Group = "backup";
EnvironmentFile = config.secrets.backup.dest;
};
script = ''
${pkgs.awscli2}/bin/aws s3 sync \
${libraryPath}/ \
s3://${config.backup.s3.bucket}/calibre/ \
--endpoint-url=https://${config.backup.s3.endpoint}
'';
}; };
script = ''
${pkgs.awscli2}/bin/aws s3 sync \
${libraryPath}/ \
s3://${config.backup.s3.bucket}/calibre/ \
--endpoint-url=https://${config.backup.s3.endpoint}
'';
};
}; };

View File

@ -15,6 +15,7 @@
services.nextcloud = { services.nextcloud = {
enable = true; enable = true;
package = pkgs.nextcloud25; # Required to specify package = pkgs.nextcloud25; # Required to specify
datadir = "/data/nextcloud";
https = true; https = true;
hostName = "localhost"; hostName = "localhost";
maxUploadSize = "50G"; maxUploadSize = "50G";
@ -52,6 +53,9 @@
before = [ "nextcloud-setup.service" ]; before = [ "nextcloud-setup.service" ];
}; };
# Grant user access to Nextcloud directories
users.users.${config.user}.extraGroups = [ "nextcloud" ];
## Backup config ## Backup config
# Open to groups, allowing for backups # Open to groups, allowing for backups

View File

@ -1,20 +1,38 @@
{ config, lib, ... }: { { config, pkgs, lib, ... }: {
options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; }; options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; };
config = lib.mkIf (config.samba.enable) { config = {
services.samba.enable = true; services.samba = lib.mkIf (config.samba.enable) {
services.samba.shares.video = { enable = true;
path = "/data/video"; openFirewall = true;
browseable = "yes"; shares.data = {
"read only" = "no"; path = "/data";
"guest ok" = "no"; browseable = "yes";
"force user" = config.user; "read only" = "no";
"force group" = config.user; "guest ok" = "no";
comment = "Movies and TV"; "force user" = config.user;
"force group" = config.user;
comment = "NAS";
};
}; };
# Allows Windows clients to discover server
services.samba-wsdd.enable = true;
networking.firewall.allowedTCPPorts = [ 5357 ];
networking.firewall.allowedUDPPorts = [ 3702 ];
# Allow client browsing Samba and virtual filesystem shares
services.gvfs =
lib.mkIf (config.gui.enable && config.nautilus.enable) { enable = true; };
# # Permissions required to mount Samba with GVFS, if not using desktop environment
# environment.systemPackages = lib.mkIf (config.gui.enable
# && config.nautilus.enable
# && config.services.xserver.windowManager.i3.enable)
# [ pkgs.lxqt.lxqt-policykit ];
}; };
} }

View File

@ -32,6 +32,11 @@
}; };
home-manager.users.${config.user}.xdg = { home-manager.users.${config.user}.xdg = {
# Allow Nix to manage the default applications list
mimeApps.enable = true;
# Set directories for application defaults
userDirs = { userDirs = {
enable = true; enable = true;
createDirectories = true; createDirectories = true;