diff --git a/flake.lock b/flake.lock index 9cab2c3..200b58d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,7 +3,9 @@ "deploy-rs": { "inputs": { "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs-unstable" + ], "utils": "utils" }, "locked": { @@ -71,7 +73,9 @@ "gitlab_artifacts_sync": { "inputs": { "flake-compat": "flake-compat_2", - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "nixpkgs-unstable" + ], "utils": "utils_2" }, "locked": { @@ -131,59 +135,6 @@ "type": "gitlab" } }, - "nix-darwin-unstable": { - "inputs": { - "nixpkgs": [ - "nixpkgs-unstable" - ] - }, - "locked": { - "lastModified": 1667419884, - "narHash": "sha256-oLNw87ZI5NxTMlNQBv1wG2N27CUzo9admaFlnmavpiY=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "cfc0125eafadc9569d3d6a16ee928375b77e3100", - "type": "github" - }, - "original": { - "owner": "lnl7", - "ref": "master", - "repo": "nix-darwin", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1648219316, - "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1659446231, - "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-21.11", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-unstable": { "locked": { "lastModified": 1667901915, @@ -200,19 +151,18 @@ "type": "github" } }, - "nixpkgs_2": { + "nur": { "locked": { - "lastModified": 1660410996, - "narHash": "sha256-arkfX1YYFmwMyDTCguzoOI4epABC41FGQU4J1/G3/9M=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "70b6236f3cbc815f2cae8d597418c714cf83d1c8", + "lastModified": 1668174315, + "narHash": "sha256-oss9lJ30HbgXpVFy5Xv9doB+1mNjQehbFlFYau95odM=", + "owner": "nix-community", + "repo": "NUR", + "rev": "5da1d2f59d29cd1bb9c0787db9c1046825ade56a", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "release-22.05", - "repo": "nixpkgs", + "owner": "nix-community", + "repo": "NUR", "type": "github" } }, @@ -222,9 +172,8 @@ "gitlab_artifacts_sync": "gitlab_artifacts_sync", "home-manager-unstable": "home-manager-unstable", "musicutil": "musicutil", - "nix-darwin-unstable": "nix-darwin-unstable", - "nixpkgs-stable": "nixpkgs-stable", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs-unstable": "nixpkgs-unstable", + "nur": "nur" } }, "utils": { diff --git a/flake.nix b/flake.nix index 4ebb35c..a942f83 100644 --- a/flake.nix +++ b/flake.nix @@ -6,18 +6,19 @@ nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager-unstable.url = "github:nix-community/home-manager"; home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable"; - nix-darwin-unstable.url = "github:lnl7/nix-darwin/master"; - nix-darwin-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable"; + #nix-darwin-unstable.url = "github:lnl7/nix-darwin/master"; + #nix-darwin-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable"; - nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-21.11"; + nur.url = "github:nix-community/NUR"; deploy-rs.url = "github:serokell/deploy-rs"; - #deploy-rs.inputs.nixpkgs.follows = "nixpkgs-unstable"; + deploy-rs.inputs.nixpkgs.follows = "nixpkgs-unstable"; musicutil.url = "gitlab:ChaotiCryptidz/musicutil"; musicutil.inputs.nixpkgs.follows = "nixpkgs-unstable"; gitlab_artifacts_sync.url = "gitlab:ChaotiCryptidz/gitlab_artifacts_sync"; + gitlab_artifacts_sync.inputs.nixpkgs.follows = "nixpkgs-unstable"; }; outputs = { ... }@inputs: import ./outputs.nix inputs; diff --git a/guides/COMMON_SETUP.md b/guides/COMMON_SETUP.md deleted file mode 100644 index ddb12fe..0000000 --- a/guides/COMMON_SETUP.md +++ /dev/null @@ -1,66 +0,0 @@ -# Websites -## discord.com -Zoom: 165% -### Appearance -- Chat Font Scaling: 18px -### Accessability -- Saturation: 70% -- Apply to custom colour schemes: ON -- Enable Reduced Motion -- Enable Play Animated Emoji -- Stickers: Animate on interaction -### Notifications -- DISABLE ALL SOUNDS. -## twitter.com -### Accessability -- Reduce Motion -### Display -- Theme: Dim -- Colour: Purple -- Font Size: Large -## VaultUI -Zoom: 165% -- Default View&Editor Syntax: YAML -- View&Editor Indent: 2 -## gitlab.com -Zoom: 185% -# Telegram Desktop (kotatogram) -- Lappy: Set interface size to 200% -- MacMini: Set Interface Size to 125% -- Recent stickers: show 40 stickers -- Sticker Height: 165px -- Upload Speed Boost: Slight -- Main Font & Semibold Font: Comic Sans MS -- Monospaced Font: Comic Code -- Confirm before calling: on -## Quassel Client -### Interface -- Set theme to config dir's style.qss -- Widget Style: Fusion -- Fallback Icon Theme: Fusion -- Show System Tray Icon -### Chat View -- Chat Window Font: Comic Code 20pt -### Chat View Colours -- Disable Custom Colours -- Disallow coloured text -### Chat & Nick Lists -- Custom Font: Comic Code 18pt -- Use Custom Colours: -``` -Standard: #ffffff -Inactive: #bbbbbb -Unread: #26f502 -Highlight: #fff700 -Other: #00dda6 -``` -### Input Widget -- Custom Font: Comic Code 18pt -### Topic Widget -- Custom Font: Comic Code 14pt -### Backlog Fetching -- Amount: 500 -- Method: Fixed -- Initial: 2000 -## Websites -follow WEB_SETUP_GUIDE.md diff --git a/guides/HETZNERVM_RESTORE_GUIDE.md b/guides/HETZNERVM_RESTORE_GUIDE.md deleted file mode 100644 index 32cb8bf..0000000 --- a/guides/HETZNERVM_RESTORE_GUIDE.md +++ /dev/null @@ -1,73 +0,0 @@ -# ok so you fucked up, what next, -## Step 1 -Either create a new VM or if still have access, go to ISOs and put in nixos 22.05 iso and reboot server. -If create new vm, please change DNS and update IPs in the main nix config and this document (v6) and set rhost -## Step 2 -Use console to set ssh password. - -SSH in `ssh root@hetzner-vm.servers.genderfucked.monster` - -Add ssh key `echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAeN3T1aZkTm5xS0b66cRDyKUbdEQCFyzVWXeW+eIbsa chaos@chaos" >> /root/.ssh/authorized_keys` -## Step 3 -Install NixOS. -``` -parted -s "/dev/sda" -- mklabel msdos -parted -s "/dev/sda" -- mkpart primary 512MiB 100% -parted -s "/dev/sda" -- print - -mkfs.ext4 /dev/sda1 - -mount /dev/sda1 /mnt - -nixos-generate-config --root /mnt -``` - -Edit configuration.nix and replace with -```nix -{ config, pkgs, ... }: -{ - imports = [ ./hardware-configuration.nix ]; - users.users.root = { - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAeN3T1aZkTm5xS0b66cRDyKUbdEQCFyzVWXeW+eIbsa chaos@chaos" - ]; - }; - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/sda"; - boot.initrd.kernelModules = [ "nvme" ]; - - services.openssh.enable = true; - - networking.enableIPv6 = true; - networking.usePredictableInterfaceNames = false; - networking.dhcpcd.enable = true; - systemd.network = { - enable = true; - networks.eth0 = { - name = "eth0"; - address = [ "2a01:4f9:c010:8beb::1/64" ]; - gateway = [ "fe80::1" ]; - }; - }; - - system.stateVersion = "21.11"; -} -``` - -Then run `nixos-install` and reboot if successful. - -## Step 4 -Redeploy with `deploy -s .#hetzner-vm --magic-rollback=false --auto-rollback=false --ssh-user root` - -## Step 5 -Restore using restic. -`B2_ACCOUNT_ID=id B2_ACCOUNT_KEY=key RESTIC_REPOSITORY=b2:Chaos-Backups:HetznerVM restic restore latest` - -## Step 6 -re-connect to tailscale `tailscale up` and redo dns - -## Step 7 -Restore Postgres `cat /var/backup/postgresql/all.sql.zstd | zstd -d | sudo -u postgres psql` - -## Step 8 -Restore music, either via `mkdir -p /storage/music && env B2_ACCOUNT_ID=id B2_ACCOUNT_KEY=key RESTIC_REPOSITORY=b2:Chaos-Backups:Music restic restore latest --target /storage/music` or ./sync.sh on laptop. \ No newline at end of file diff --git a/guides/LAPPY_SETUP_GUIDE.md b/guides/LAPPY_SETUP_GUIDE.md deleted file mode 100644 index 636a0bc..0000000 --- a/guides/LAPPY_SETUP_GUIDE.md +++ /dev/null @@ -1,55 +0,0 @@ -# Lappy Setup Guide -## Filesystems -``` -mkdir /usb -cryptsetup luksOpen /dev/disk/by-partname/usb usb_unencrypted -mount /dev/mapper/usb_unencrypted /usb - -nix develop -mk-lappy-ssd /dev/nvme0n1 /usb/encryption-keys/lappy.key -``` -## NetworkManager -Grab passwords from Vault -## Browser (vivaldi) -### Settings -#### General -Home Page: Start Page -Startup With: Start Page -#### Appearance -Use Animation: NO! -#### Themes -Theme: Custom -Background: #2e3440 -Foreground: #eceff4 -Highlight: #88c0d0 -Accent: #4c566a -Corner Rounding: 2 -#### Tabs -- Display Close Button: Permanantly -- Active Tab Minimum Width: 150px -- Tab Stacking: Disable -#### Search -- Default search engine: Google -- Always search in new tab: ON -#### Privacy -- Phishing and Malware Protection: OFF -- DNS to help resolve navigation errors: OFF -- Form AutoFill Assist: OFF -- Ask websites not to track me: ON -- No Blocking -- Save Webpage Passwords: OFF -#### Downloads -- Save without asking: ON -#### Webpages -- Default Webpage Zoom: 145% -- Disable Use Tab Zoom -- Disable Use Ctrl+Scroll Zoom -- Plugins: Enable All -- Fonts: All to Comic Sans apart from Monospace which is Comic Code -- Reader: Colour Scheme: Dark -### Extensions -Install the following extensions: -- Stylus -- Tampermonkey -- uBlock Origin -Then install all userscripts and userstyles from [Here](https://gitlab.com/ChaotiCryptidz/userstyles-userscripts/-/tree/main) \ No newline at end of file diff --git a/guides/MACMINI_SETUP_GUIDE.md b/guides/MACMINI_SETUP_GUIDE.md deleted file mode 100644 index 0404990..0000000 --- a/guides/MACMINI_SETUP_GUIDE.md +++ /dev/null @@ -1,53 +0,0 @@ -# Mac Mini Setup Guide - -## First Install -### macOS installer -Country/Region: United Kingdom -Cognitive: Dark Theme -Turn On Hover Text - -### Install Nix -``` -sh <(curl -L https://nixos.org/nix/install) --daemon -``` -### Clone Nixfiles -``` -mkdir ~/Projects -cd ~/Projects -nix-shell -p git --run "git clone https://gitlab.com/ChaotiCryptidz/nixfiles" -``` -### Bootstrap Nix-Darwin -``` -nix --experimental-features "nix-command flakes" build .#darwinConfigurations.MacMini.system - -echo -e "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf -/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B -/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t - -./result/sw/bin/darwin-rebuild switch --flake .#darwinConfigurations.MacMini -``` - -## Terminal -Set default font to Comic Code - -## Settings -### General -- Theme: Dark -- Accent Colour: Pink -### Dock & Menu Bar -#### Main -- Position: Left -- Minimize Using: Scale Effect -- Do not animate opening apps -- Automatically hide and show the dock: Yes -- Do not show recent apps - -## Safari -- Enable Develop Menu -# Extensions -install from app store: -- Adblock Pro for Safari -- Cascadea (& install userstyles from repo) - -## Apps -- Install Kotatogram Desktop from website diff --git a/guides/WEB_SETUP_GUIDE.md b/guides/WEB_SETUP_GUIDE.md deleted file mode 100644 index 7394fd9..0000000 --- a/guides/WEB_SETUP_GUIDE.md +++ /dev/null @@ -1,66 +0,0 @@ -# Websites -## discord.com -Zoom: 165% -### Appearance -- Chat Font Scaling: 18px -### Accessability -- Saturation: 70% -- Apply to custom colour schemes: ON -- Enable Reduced Motion -- Enable Play Animated Emoji -- Stickers: Animate on interaction -### Notifications -- DISABLE ALL SOUNDS. -## twitter.com -### Accessability -- Reduce Motion -### Display -- Theme: Lights Out -- Colour: Purple -- Font Size: Large -## VaultUI -Zoom: 165% -- Default View&Editor Syntax: YAML -- View&Editor Indent: 2 -## gitlab.com -Zoom: 185% -## tweetdeck.twitter.com -Zoom: 165% -### TweetDeck Settings -- Theme: Dark -- dont show notifs on startup -- display sensitive medias -- column: the Wide -- font size: lorgest -### TweetDeck Columns -- Delete messages & trending -#### Home -- media size: the lorge -- DO NOT NOTIFY -#### Notifications -- media size: the smol -- sound: enable -- notif: the enabled -### Better TweetDeck Settings -#### General -- pause column scrolling on -- custom width for columns: 49.655% -- mute nft accounts thank fuck -- show heart for moots even though they prolly hate us -- add columns for creatures, stuff, empty spaces; -#### Tweet Content -- Show Content Warnings -- Do not show twibber warnings -- extract the pronouns -#### Theme -- theme: super black -- accent colour: the Purple -- scrollbars: hidden -#### Tweets Display -- avatar shape: square -#### Tweet Actions -- tweet actions to add: block author -- position: right -#### Tweet Composor -- no tweet until alt text -- always show how many chars left \ No newline at end of file diff --git a/home/apps/firefox.nix b/home/apps/firefox.nix new file mode 100644 index 0000000..1864368 --- /dev/null +++ b/home/apps/firefox.nix @@ -0,0 +1,146 @@ +{ config, nixosConfig, pkgs, ... }: +let isGnome = nixosConfig.services.xserver.desktopManager.gnome.enable; +in { + programs.firefox = { + enable = true; + package = pkgs.firefox.override { + cfg = { + # for gnome media shenanigans + enableGnomeExtensions = isGnome; + }; + }; + extensions = with nixosConfig.nur; [ + repos.rycee.firefox-addons.ublock-origin + repos.rycee.firefox-addons.stylus + repos.rycee.firefox-addons.tampermonkey + repos.rycee.firefox-addons.search-engines-helper + repos.rycee.firefox-addons.search-by-image + repos.rycee.firefox-addons.offline-qr-code-generator + repos.rycee.firefox-addons.i-dont-care-about-cookies + repos.rycee.firefox-addons.don-t-fuck-with-paste + repos.rycee.firefox-addons.amp2html + repos.rycee.firefox-addons.a11ycss + ]; + profiles."profile" = { + name = "profile"; + id = 0; + isDefault = true; + settings = { + "app.normandy.first_run" = false; + "browser.search.region" = "GB"; + "intl.locale.requested" = "en-GB,en-US"; + + # less junk on homescreen + "extensions.htmlaboutaddons.recommendations.enabled" = false; + "browser.newtabpage.activity-stream.feeds.recommendationprovider" = + false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = + false; + "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = + false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = + false; + "browser.newtabpage.activity-stream.section.highlights.includeVisited" = + false; + "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = + false; + "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = + false; + + # dont use any form autofill + "signon.autofillForms" = false; + "signon.generation.enabled" = false; + "signon.management.page.breach-alerts.enabled" = false; + "signon.rememberSignons" = false; + "dom.forms.autocomplete.formautofill" = false; + "extensions.formautofill.creditCards.enabled" = false; + "browser.formfill.enable" = false; + + # disable search suggestions + "browser.search.suggest.enabled" = false; + + # no telemetry + "toolkit.telemetry.enabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "app.shield.optoutstudies.enabled" = false; + + # disable pocket + "browser.pocket.enabled" = false; + "extensions.pocket.enabled" = false; + + # no safebrowsing + "browser.safebrowsing.enabled " = false; + "browser.safebrowsing.phishing.enabled" = false; + "browser.safebrowsing.malware.enabled" = false; + "browser.safebrowsing.downloads.enabled" = false; + + # don't let websites replace right click + "dom.event.contextmenu.enabled" = false; + + # disable geoip + "geo.enabled" = false; + "geo.wifi.uri" = ""; + "browser.search.geoip.url" = ""; + + # enable widevine + "media.eme.enabled" = true; + "media.gmp-widevinecdm.enabled" = true; + + # browser toolbar and UI + # may need updating when extensions change + "browser.toolbars.bookmarks.visibility" = "always"; + "layout.css.devPixelsPerPx" = "1.8"; + "browser.uiCustomization.state" = builtins.toJSON { + currentVersion = 18; + dirtyAreaCache = [ + "nav-bar" + "PersonalToolbar" + "toolbar-menubar" + "TabsToolbar" + "widget-overflow-fixed-list" + ]; + newElementCount = 22; + placements = { + PersonalToolbar = [ "import-button" "personal-bookmarks" ]; + TabsToolbar = + [ "tabbrowser-tabs" "new-tab-button" "alltabs-button" ]; + nav-bar = [ + "back-button" + "forward-button" + "stop-reload-button" + "urlbar-container" + "downloads-button" + "ublock0_raymondhill_net-browser-action" + "firefox_tampermonkey_net-browser-action" + "_7a7a4a92-a2a0-41d1-9fd7-1e92480d612d_-browser-action" + "offline-qr-code_rugk_github_io-browser-action" + ]; + toolbar-menubar = [ "menubar-items" ]; + widget-overflow-fixed-list = [ + "a11y_css_ffoodd-browser-action" + "dontfuckwithpaste_raim_ist-browser-action" + "jid1-kkzogwgsw3ao4q_jetpack-browser-action" + "_65a2d764-7358-455b-930d-5afa86fb5ed0_-browser-action" + "_2e5ff8c8-32fe-46d0-9fc8-6b8986621f3c_-browser-action" + ]; + }; + seen = [ + "save-to-pocket-button" + "developer-button" + "a11y_css_ffoodd-browser-action" + "dontfuckwithpaste_raim_ist-browser-action" + "jid1-kkzogwgsw3ao4q_jetpack-browser-action" + "offline-qr-code_rugk_github_io-browser-action" + "ublock0_raymondhill_net-browser-action" + "firefox_tampermonkey_net-browser-action" + "_65a2d764-7358-455b-930d-5afa86fb5ed0_-browser-action" + "_7a7a4a92-a2a0-41d1-9fd7-1e92480d612d_-browser-action" + "_2e5ff8c8-32fe-46d0-9fc8-6b8986621f3c_-browser-action" + ]; + }; + }; + }; + }; +} diff --git a/home/apps/kitty.nix b/home/apps/kitty.nix index bf4a015..b21163c 100644 --- a/home/apps/kitty.nix +++ b/home/apps/kitty.nix @@ -8,7 +8,8 @@ enable = true; font.name = "Comic Code"; settings = { - font_size = if nixosConfig.networking.hostName == "tablet" then 12 else 20; + font_size = + if nixosConfig.networking.hostName == "tablet" then 12 else 20; bold_font = "auto"; italic_font = "auto"; bold_italic_font = "auto"; diff --git a/home/programming/editors/sublime.nix b/home/programming/editors/sublime.nix deleted file mode 100644 index 132a996..0000000 --- a/home/programming/editors/sublime.nix +++ /dev/null @@ -1 +0,0 @@ -{ pkgs, ... }: { home.packages = with pkgs; [ sublime4 ]; } diff --git a/home/programming/editors/vscode.nix b/home/programming/editors/vscode.nix index 46cecd3..35873fc 100644 --- a/home/programming/editors/vscode.nix +++ b/home/programming/editors/vscode.nix @@ -1,46 +1,23 @@ { config, nixosConfig, pkgs, ... }: let - configDir = "Code"; - userDir = if pkgs.stdenv.hostPlatform.isDarwin then - "$HOME/Library/Application Support/${configDir}/User" - else - "${config.xdg.configHome}/${configDir}/User"; - - font-size = if nixosConfig.networking.hostName == "tablet" then 16 else 24; - + font-size = if nixosConfig.networking.hostName == "tablet" then 18 else 24; + zoom-level = if nixosConfig.networking.hostName == "tablet" then -2 else 0; in { - programs.vscode = { + programs.vscode-mod = { enable = true; userSettings = { - "editor.tabSize" = 4; "terminal.integrated.shellIntegration.enabled" = false; "github.gitAuthentication" = false; - "editor.fontSize" = 24; + "editor.fontSize" = font-size; "editor.fontFamily" = "'Comic Code'"; - "terminal.integrated.fontSize" = 24; + "terminal.integrated.fontSize" = font-size; "editor.codeLensFontFamily" = "'Comic Code'"; "editor.inlayHints.fontFamily" = "'Comic Code'"; "markdown.preview.fontFamily" = "'Comic Code'"; "terminal.integrated.fontFamily" = "'Comic Code'"; "files.autoSave" = "afterDelay"; + "window.zoomLevel" = zoom-level; + "editor.tabSize" = 2; }; }; - programs.vscode.extensions = with pkgs; - [ vscode-extensions.matklad.rust-analyzer ]; - - # make config changeable - #home = { - # activation = { - # afterWriteBoundary = { - # after = [ "writeBoundary" ]; - # before = [ ]; - # data = '' - # vscodeDir="${userDir}" - # $DRY_RUN_CMD cat "$vscodeDir/settings.json" > "$vscodeDir/settings_whatever.json" - # $DRY_RUN_CMD rm -f "$vscodeDir/settings.json" - # $DRY_RUN_CMD cp "$vscodeDir/settings_whatever.json" "$vscodeDir/settings.json" - # ''; - # }; - # }; - #}; } diff --git a/home/programming/languages/go/go.nix b/home/programming/languages/go.nix similarity index 53% rename from home/programming/languages/go/go.nix rename to home/programming/languages/go.nix index 92cce20..83fea3a 100644 --- a/home/programming/languages/go/go.nix +++ b/home/programming/languages/go.nix @@ -2,5 +2,5 @@ { home.packages = with pkgs; [ go gopls go-outline gotools ]; - programs.vscode.extensions = with pkgs; [ vscode-extensions.golang.go ]; + programs.vscode-mod.extensions = with pkgs; [ vscode-extensions.golang.go ]; } diff --git a/home/programming/languages/nix/nix.nix b/home/programming/languages/nix.nix similarity index 70% rename from home/programming/languages/nix/nix.nix rename to home/programming/languages/nix.nix index 1fbd211..ffcc2b8 100644 --- a/home/programming/languages/nix/nix.nix +++ b/home/programming/languages/nix.nix @@ -3,12 +3,12 @@ { home.packages = with pkgs; [ nixfmt ]; - programs.vscode.extensions = with pkgs; [ + programs.vscode-mod.extensions = with pkgs; [ vscode-extensions.bbenoist.nix vscode-extensions.brettm12345.nixfmt-vscode ]; - programs.vscode.userSettings."[nix]" = { + programs.vscode-mod.userSettings."[nix]" = { "editor.defaultFormatter" = "brettm12345.nixfmt-vscode"; }; } diff --git a/home/programming/languages/rust.nix b/home/programming/languages/rust.nix new file mode 100644 index 0000000..3837d46 --- /dev/null +++ b/home/programming/languages/rust.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + programs.vscode-mod.extensions = with pkgs; + [ vscode-extensions.matklad.rust-analyzer ]; + home.packages = with pkgs; [ rustc cargo clippy rust-analyzer rustfmt ]; + home.sessionVariables = { RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; }; +} diff --git a/hosts/default.nix b/hosts/default.nix index 033fbf1..4c1bb51 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,4 @@ { ... }@inputs: { nixosConfigurations = import ./nixos.nix inputs; - darwinConfigurations = import ./darwin.nix inputs; + #darwinConfigurations = import ./darwin.nix inputs; } diff --git a/hosts/hetzner-vm/hetzner-vm.nix b/hosts/hetzner-vm/hetzner-vm.nix index d4a1ca2..ab1b842 100644 --- a/hosts/hetzner-vm/hetzner-vm.nix +++ b/hosts/hetzner-vm/hetzner-vm.nix @@ -5,7 +5,6 @@ users.root profiles.base - profiles.tailscale profiles.sshd profiles.nginx profiles.nix-gc diff --git a/hosts/nixos.nix b/hosts/nixos.nix index 4dc11f0..69b5fdb 100644 --- a/hosts/nixos.nix +++ b/hosts/nixos.nix @@ -16,6 +16,11 @@ let tree.impure.profiles.base inputs.home-manager-unstable.nixosModules.home-manager inputs.gitlab_artifacts_sync.nixosModule + + inputs.nur.nixosModules.nur + + tree.impure.modules.nixos.rclone-serve + tree.impure.modules.nixos.rclone-sync ]; nixosUnstableSystem = nixpkgs-unstable.lib.nixosSystem; @@ -53,11 +58,7 @@ in { storage = nixosUnstableSystem { specialArgs = defaultSpecialArgs; system = "x86_64-linux"; - modules = defaultModules ++ [ - ./storage/modules/rclone-serve.nix - ./storage/modules/rclone-sync.nix - ./storage/storage.nix - ]; + modules = defaultModules ++ [ ./storage/storage.nix ]; }; vault = nixosUnstableSystem { diff --git a/hosts/tablet/tablet.nix b/hosts/tablet/tablet.nix index 2e98dff..a349d63 100644 --- a/hosts/tablet/tablet.nix +++ b/hosts/tablet/tablet.nix @@ -23,7 +23,7 @@ home.home-folders home.programming.editors.vscode - home.programming.languages.go + home.programming.languages.rust home.programming.languages.nix ]; home.stateVersion = "22.05"; diff --git a/modules/home/vscode-mod-module.nix b/modules/home/vscode-mod-module.nix new file mode 100644 index 0000000..bd39064 --- /dev/null +++ b/modules/home/vscode-mod-module.nix @@ -0,0 +1,229 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.vscode-mod; + + vscodePname = cfg.package.pname; + + jsonFormat = pkgs.formats.json { }; + + configDir = { + "vscode" = "Code"; + "vscode-insiders" = "Code - Insiders"; + "vscodium" = "VSCodium"; + }.${vscodePname}; + + extensionDir = { + "vscode" = "vscode"; + "vscode-insiders" = "vscode-insiders"; + "vscodium" = "vscode-oss"; + }.${vscodePname}; + + userDir = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/${configDir}/User" + else + "${config.xdg.configHome}/${configDir}/User"; + + configFilePath = "${userDir}/settings.json"; + tasksFilePath = "${userDir}/tasks.json"; + keybindingsFilePath = "${userDir}/keybindings.json"; + + # TODO: On Darwin where are the extensions? + extensionPath = ".${extensionDir}/extensions"; + + mergedUserSettings = cfg.userSettings + // optionalAttrs (!cfg.enableUpdateCheck) { "update.mode" = "none"; } + // optionalAttrs (!cfg.enableExtensionUpdateCheck) { + "extensions.autoCheckUpdates" = false; + }; +in { + options = { + programs.vscode-mod = { + enable = mkEnableOption "Visual Studio Code"; + + package = mkOption { + type = types.package; + default = pkgs.vscode; + example = literalExpression "pkgs.vscodium"; + description = '' + Version of Visual Studio Code to install. + ''; + }; + + enableUpdateCheck = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable update checks/notifications. + ''; + }; + + enableExtensionUpdateCheck = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable update notifications for extensions. + ''; + }; + + userSettings = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + { + "files.autoSave" = "off"; + "[nix]"."editor.tabSize" = 2; + } + ''; + description = '' + Configuration written to Visual Studio Code's + settings.json. + ''; + }; + + userTasks = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + { + version = "2.0.0"; + tasks = [ + { + type = "shell"; + label = "Hello task"; + command = "hello"; + } + ]; + } + ''; + description = '' + Configuration written to Visual Studio Code's + tasks.json. + ''; + }; + + keybindings = mkOption { + type = types.listOf (types.submodule { + options = { + key = mkOption { + type = types.str; + example = "ctrl+c"; + description = "The key or key-combination to bind."; + }; + + command = mkOption { + type = types.str; + example = "editor.action.clipboardCopyAction"; + description = "The VS Code command to execute."; + }; + + when = mkOption { + type = types.nullOr (types.str); + default = null; + example = "textInputFocus"; + description = "Optional context filter."; + }; + + # https://code.visualstudio.com/docs/getstarted/keybindings#_command-arguments + args = mkOption { + type = types.nullOr (jsonFormat.type); + default = null; + example = { direction = "up"; }; + description = "Optional arguments for a command."; + }; + }; + }); + default = [ ]; + example = literalExpression '' + [ + { + key = "ctrl+c"; + command = "editor.action.clipboardCopyAction"; + when = "textInputFocus"; + } + ] + ''; + description = '' + Keybindings written to Visual Studio Code's + keybindings.json. + ''; + }; + + extensions = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExpression "[ pkgs.vscode-extensions.bbenoist.nix ]"; + description = '' + The extensions Visual Studio Code should be started with. + ''; + }; + + mutableExtensionsDir = mkOption { + type = types.bool; + default = true; + example = false; + description = '' + Whether extensions can be installed or updated manually + or by Visual Studio Code. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + # make config changeable + home = { + activation = { + vscode-mod-copy = hm.dag.entryAfter [ "writeBoundary" ] '' + $DRY_RUN_CMD cat "${configFilePath}.source" > "${configFilePath}" + ''; + }; + }; + + home.file = mkMerge [ + (mkIf (mergedUserSettings != { }) { + # Don't install settings to actual config file path + # instead install to ${configFilePath}.source + "${configFilePath}.source".source = + jsonFormat.generate "vscode-user-settings" mergedUserSettings; + }) + + (mkIf (cfg.userTasks != { }) { + "${tasksFilePath}".source = + jsonFormat.generate "vscode-user-tasks" cfg.userTasks; + }) + (mkIf (cfg.keybindings != [ ]) + (let dropNullFields = filterAttrs (_: v: v != null); + in { + "${keybindingsFilePath}".source = + jsonFormat.generate "vscode-keybindings" + (map dropNullFields cfg.keybindings); + })) + (mkIf (cfg.extensions != [ ]) (let + subDir = "share/vscode/extensions"; + + # Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2 + toPaths = ext: + map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; }) + (if ext ? vscodeExtUniqueId then + [ ext.vscodeExtUniqueId ] + else + builtins.attrNames (builtins.readDir (ext + "/${subDir}"))); + in if cfg.mutableExtensionsDir then + mkMerge (concatMap toPaths cfg.extensions) + else { + "${extensionPath}".source = let + combinedExtensionsDrv = pkgs.buildEnv { + name = "vscode-extensions"; + paths = cfg.extensions; + }; + in "${combinedExtensionsDrv}/${subDir}"; + })) + ]; + }; +} diff --git a/hosts/storage/modules/rclone-serve.nix b/modules/nixos/rclone-serve.nix similarity index 100% rename from hosts/storage/modules/rclone-serve.nix rename to modules/nixos/rclone-serve.nix diff --git a/hosts/storage/modules/rclone-sync.nix b/modules/nixos/rclone-sync.nix similarity index 100% rename from hosts/storage/modules/rclone-sync.nix rename to modules/nixos/rclone-sync.nix diff --git a/outputs.nix b/outputs.nix index d075422..c134dcd 100644 --- a/outputs.nix +++ b/outputs.nix @@ -7,7 +7,7 @@ let hosts = import ./hosts ({ inherit tree; } // inputs); in { nixosConfigurations = hosts.nixosConfigurations; - darwinConfigurations = hosts.darwinConfigurations; + #darwinConfigurations = hosts.darwinConfigurations; deploy.nodes = (import ./deployNodes.nix { nixosConfigurations = self.nixosConfigurations; diff --git a/presets/nixos/desktop.nix b/presets/nixos/desktop.nix index a258bc0..40cdc46 100644 --- a/presets/nixos/desktop.nix +++ b/presets/nixos/desktop.nix @@ -20,6 +20,7 @@ home.apps.mpv home.apps.vivaldi + home.apps.firefox home.apps.telegram home.apps.quassel diff --git a/profiles/base/home.nix b/profiles/base/home.nix index 2b22874..d78b98f 100644 --- a/profiles/base/home.nix +++ b/profiles/base/home.nix @@ -1,4 +1,4 @@ -{ inputs, tree, config, lib, ... }: +{ inputs, tree, config, pkgs, lib, ... }: with lib; { options.home-manager.users = mkOption { type = types.attrsOf (types.submoduleWith { @@ -13,6 +13,7 @@ with lib; { home-manager = { useGlobalPkgs = true; useUserPackages = true; + sharedModules = with tree; [ modules.home.vscode-mod-module ]; }; }; } diff --git a/profiles/gui/environments/gnome/default.nix b/profiles/gui/environments/gnome/default.nix index f9d5e6f..b404cac 100644 --- a/profiles/gui/environments/gnome/default.nix +++ b/profiles/gui/environments/gnome/default.nix @@ -26,6 +26,8 @@ gnome.gnome-tweaks gnomeExtensions.just-perfection ]; + + services.gnome.gnome-browser-connector.enable = true; services.udev.packages = with pkgs; [ gnome3.gnome-settings-daemon ]; services.power-profiles-daemon.enable = lib.mkForce false;