From 50f8176e0ce83927bdbe4934278aabb375ef5f0a Mon Sep 17 00:00:00 2001 From: Jacob Hrbek Date: Sun, 27 Jun 2021 22:49:48 +0200 Subject: [PATCH] Sync --- home.nix | 33 +++++++++++++++++++++++++++++++++ machines/leonid.nix | 4 ++++ programs/firefox.nix | 28 ++++++++++++++++++++++++++++ programs/git.nix | 7 +++++++ programs/gpg.nix | 4 ++++ programs/ssh.nix | 7 +++++++ programs/vim.nix | 7 +++++++ 7 files changed, 90 insertions(+) create mode 100644 home.nix create mode 100644 machines/leonid.nix create mode 100644 programs/firefox.nix create mode 100644 programs/git.nix create mode 100644 programs/gpg.nix create mode 100644 programs/ssh.nix create mode 100644 programs/vim.nix diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..d4eb4ca --- /dev/null +++ b/home.nix @@ -0,0 +1,33 @@ +### Initialization file used to deploy network-wide configuration + +# Reference by real-life examples: +# - https://github.com/balsoft/nixos-config +# - https://github.com/MatthewCroughan/nixcfg + +{ config, lib, ... }: +let + # Global variables + homeNixDir = "$HOME/.local/share/home-manager"; + + # NOTE(Krey): Handling of https://github.com/NixOS/nixpkgs/issues/128286 + nixFilesIn = path: + let + names = lib.filter (lib.hasSuffix ".nix") (lib.attrNames (builtins.readDir path)); + in + map (x: path + "/${x}") names; +in { + imports = [ + (/. + "${homeNixDir}" + /users/kreyren.nix) + + (import "${homeNixDir}/machines/${config.networking.hostName}.nix" {inherit homeNixDir;}) + ] ++ nixFilesIn "${homeNixDir}/programs/"; + + # Use preferred location for home-manager + programs.home-manager.path = "${homeNixDir}"; + + # Global packages + programs.bash.enable = true; + programs.vim.enable = true; + programs.gpg.enable = true; + programs.htop.enable = true; +} \ No newline at end of file diff --git a/machines/leonid.nix b/machines/leonid.nix new file mode 100644 index 0000000..093736d --- /dev/null +++ b/machines/leonid.nix @@ -0,0 +1,4 @@ +{ config, pkgs, ... }: { + # NOTE(Krey): Just so there is something here + programs.vim.enable = true; +} \ No newline at end of file diff --git a/programs/firefox.nix b/programs/firefox.nix new file mode 100644 index 0000000..391cf1b --- /dev/null +++ b/programs/firefox.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: { + programs.firefox = { + profiles = { + myprofile = { + settings = { + "general.smoothScroll" = false; + # Tor integration + ## FIXME(Krey): Apply this only if tor is present + "network.proxy.socks" = "127.0.0.1"; + "network.proxy.socks_port" = "9050"; + "network.proxy.socks_remote_dns" = true; + }; + }; + }; + # NOTE(Krey): List of exensions https://nur.nix-community.org/repos/rycee/ + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + https-everywhere + privacy-badger + clearurls + keepassxc-browser + sponsorblock + decentraleyes + ublock-origin + darkreader + videospeed + privacy-redirect + ]; +} \ No newline at end of file diff --git a/programs/git.nix b/programs/git.nix new file mode 100644 index 0000000..4ff695a --- /dev/null +++ b/programs/git.nix @@ -0,0 +1,7 @@ +{ ... }: { + programs.git = { + userName = "Jacob Hrbek"; + userEmail = "kreyren@fsfe.org"; + # FIXME(Krey): Use tor for proxy if it's set up on the system + }; +} \ No newline at end of file diff --git a/programs/gpg.nix b/programs/gpg.nix new file mode 100644 index 0000000..08c92a4 --- /dev/null +++ b/programs/gpg.nix @@ -0,0 +1,4 @@ +{ config, ... }: { + # Git integration + programs.git.signing.signByDefault = config.programs.git.enable; +} \ No newline at end of file diff --git a/programs/ssh.nix b/programs/ssh.nix new file mode 100644 index 0000000..c2d3783 --- /dev/null +++ b/programs/ssh.nix @@ -0,0 +1,7 @@ +{ services, ... }: { + programs.ssh = { + proxyCommand = if(services.tor.torsocks.enable == true) + then "torsocks" + else null; + }; +} \ No newline at end of file diff --git a/programs/vim.nix b/programs/vim.nix new file mode 100644 index 0000000..82c59c9 --- /dev/null +++ b/programs/vim.nix @@ -0,0 +1,7 @@ +{ ... }: { + programs.vim = { + settings = { + number = true; + }; + }; +} \ No newline at end of file