about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--config.nix4
-rw-r--r--hardware-configuration.nix33
-rw-r--r--home.nix13
-rw-r--r--modules/dockd.nix74
-rw-r--r--platforms/linux/aliases.nix1
-rw-r--r--platforms/linux/configuration.nix283
-rw-r--r--platforms/linux/xorg/default.nix3
-rw-r--r--programs/aliases.nix2
-rw-r--r--programs/rclone.nix30
-rw-r--r--programs/zsh/precomp.zshrc2
10 files changed, 438 insertions, 7 deletions
diff --git a/config.nix b/config.nix
index 9466840..80ae38d 100644
--- a/config.nix
+++ b/config.nix
@@ -2,8 +2,8 @@
   allowUnfree = true;
   packageOverrides = pkgs: {
     nur = import (builtins.fetchTarball {
-      url = "https://github.com/nix-community/NUR/archive/5e6c5deca9fd7ef8c2151ec9b2c55c7fd3fa380f.tar.gz";
-      sha256 = "0f6zfld7pxy9dx3426yddfk9xx1ma2h9wdw31kw31d4w35cbmzcp";
+      url = "https://github.com/nix-community/NUR/archive/ed5311bdee0d9f7e41949da1c1254f7e982193d6.tar.gz";
+      sha256 = "038fpr5pfsgx9ikpnx39bv886yfixwfkpmb8yd4gvaccazral5h8";
     }) {
       inherit pkgs;
     };
diff --git a/hardware-configuration.nix b/hardware-configuration.nix
new file mode 100644
index 0000000..84eb8cd
--- /dev/null
+++ b/hardware-configuration.nix
@@ -0,0 +1,33 @@
+# ThinkPad X220
+
+# Do not modify this file!  It was generated by ‘nixos-generate-config’
+# and may be overwritten by future invocations.  Please make changes
+# to /etc/nixos/configuration.nix instead.
+{ config, lib, pkgs, ... }:
+
+{
+  imports =
+    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
+    ];
+
+  boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
+  boot.initrd.kernelModules = [ ];
+  boot.kernelModules = [ "kvm-intel" ];
+  boot.extraModulePackages = [ ];
+
+  fileSystems."/" =
+    { device = "/dev/disk/by-uuid/e00c989b-b3fd-469e-b894-ea609fb4d7fa";
+      fsType = "ext4";
+    };
+
+  fileSystems."/boot" =
+    { device = "/dev/disk/by-uuid/2f0948cd-a0de-41c0-a341-e9fe01460fd3";
+      fsType = "ext3";
+    };
+
+    swapDevices = [ {
+      device = "/dev/sda2"; } ];
+
+  nix.maxJobs = lib.mkDefault 4;
+  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
+}
diff --git a/home.nix b/home.nix
index 69ce6d5..3259387 100644
--- a/home.nix
+++ b/home.nix
@@ -4,7 +4,12 @@ let
   common_packages = import ./platforms/common-packages.nix pkgs;
   isDarwin = builtins.currentSystem == "x86_64-darwin";
   platformSetup =
-    if isDarwin then ./platforms/darwin else ./platforms/linux;
+    if isDarwin then [
+      ./platforms/darwin
+    ] else [
+      ./platforms/linux
+      ./programs/rclone.nix
+    ];
 in
 {
   # Errors on linux
@@ -22,11 +27,10 @@ in
 
   imports = [
     # Platform specific config
-    platformSetup
     ./programs/zsh
     ./programs/newsboat
     ./programs/git.nix
-  ];
+  ] ++ platformSetup;
 
   home.packages = with pkgs; [
     # Basic
@@ -34,6 +38,9 @@ in
     pnvim
     nur.repos.pn.larbs-mail
     nur.repos.pn.larbs-news
+    amfora
+    translate-shell
+    nix-index
 
     # Misc
     browserpass
diff --git a/modules/dockd.nix b/modules/dockd.nix
new file mode 100644
index 0000000..83cb576
--- /dev/null
+++ b/modules/dockd.nix
@@ -0,0 +1,74 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.programs.dockd;
+in
+
+{
+  options = {
+    programs.dockd = {
+      enable = lib.mkOption {
+        type = lib.types.bool;
+        default = false;
+        description = ''
+          ThinkPad dock manager daemon.
+        '';
+      };
+    };
+  };
+
+  config = lib.mkIf (cfg.enable) {
+    environment.etc = {
+      "dockd/docked.conf".text = ''
+        [Screen]
+        height=1920
+        width=3000
+        mm_height=506
+        mm_width=791
+
+        [CRTC]
+        crtc=63
+        x=0
+        y=241
+        rotation=1
+        mode=1920x1080
+        outputs_len=1
+        outputs_0=HDMI-3
+
+        [CRTC]
+        crtc=64
+        x=1920
+        y=0
+        rotation=2
+        mode=1920x1080
+        outputs_len=1
+        outputs_0=DP-2
+      '';
+
+      "dockd/undocked.conf".text = ''
+        [Screen]
+        height=768
+        width=1366
+        mm_height=202
+        mm_width=359
+
+        [CRTC]
+        crtc=63
+        x=0
+        y=0
+        rotation=1
+        mode=1366x768
+        outputs_len=1
+        outputs_0=LVDS-1
+
+        [CRTC]
+        crtc=64
+        x=1920
+        y=0
+        rotation=2
+        mode=None
+        outputs_len=0
+      '';
+    };
+  };
+}
diff --git a/platforms/linux/aliases.nix b/platforms/linux/aliases.nix
index 3cee519..60948e3 100644
--- a/platforms/linux/aliases.nix
+++ b/platforms/linux/aliases.nix
@@ -1,3 +1,4 @@
 {
   nixos-rebuild = "sudo nixos-rebuild -I nixos-config=$HOME/.config/nixpkgs/platforms/linux/configuration.nix";
+  cf = "vim $HOME/.config/nixpkgs/platforms/linux/configuration.nix";
 }
diff --git a/platforms/linux/configuration.nix b/platforms/linux/configuration.nix
new file mode 100644
index 0000000..9d894e6
--- /dev/null
+++ b/platforms/linux/configuration.nix
@@ -0,0 +1,283 @@
+# Edit this configuration file to define what should be installed on
+# your system.  Help is available in the configuration.nix(5) man page
+# and in the NixOS manual (accessible by running ‘nixos-help’).
+
+{ config, pkgs, ... }:
+{
+  nix.useSandbox = true;
+
+  # Add NUR
+  nixpkgs.config.packageOverrides = pkgs: {
+    nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
+      inherit pkgs;
+    };
+  };
+
+  # NUR cachable
+  #nixpkgs.config.packageOverrides = pkgs: {
+  #  nur = import (builtins.fetchTarball {
+  #    url = "https://github.com/nix-community/NUR/archive/02ba8936dec5010545a97bba41a52a03078a2644.tar.gz";
+  #    sha256 = "0ix86b53l9hv5minkjhbydi82n6dc4s700k8pwlm0z5fwlgvhy09";
+  #  }) {
+  #    inherit pkgs;
+  #  };
+  #};
+
+
+  imports =
+    [ # Include the results of the hardware scan.
+      # <home-manager>/nixos
+      ../../modules/dockd.nix
+      ../../hardware-configuration.nix
+    ];
+
+  # Use the GRUB 2 boot loader.
+  boot.loader.grub.enable = true;
+  boot.loader.grub.version = 2;
+  # boot.loader.grub.efiSupport = true;
+  # boot.loader.grub.efiInstallAsRemovable = true;
+  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
+  # Define on which hard drive you want to install Grub.
+  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
+  boot.plymouth.enable = true;
+  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
+
+  fileSystems = {
+    "/home" = {
+      device = "/dev/disk/by-label/home";
+      fsType = "ext4";
+    };
+    "/nix" = {
+      device = "/dev/disk/by-label/nix";
+      fsType = "ext4";
+    };
+    "/var/lib/docker" = {
+      device = "/dev/disk/by-label/docker";
+      fsType = "ext4";
+    };
+    "/mnt/qnap" = {
+      device = "//192.168.1.119/Patryk";
+      fsType = "cifs";
+      options = let
+        # this line prevents hanging on network split
+        automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,vers=1.0";
+
+      in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
+    };
+  };
+
+  networking = {
+    networkmanager = {
+     enable = true;
+     wifi.backend = "iwd";
+    };
+  };
+
+  networking.hostName = "nixos"; # Define your hostname.
+  networking.extraHosts = "${ pkgs.stdenv.lib.readFile "${pkgs.fetchurl {
+    url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts";
+    sha256 = "0fw6p8m4k7r470rjz40fbr7drgpxmmyzp9l9a677g55nif2gnk2x";
+  }}"}";
+
+  # The global useDHCP flag is deprecated, therefore explicitly set to false here.
+  # Per-interface useDHCP will be mandatory in the future, so this generated config
+  # replicates the default behaviour.
+  networking.useDHCP = false;
+  networking.interfaces.enp0s25.useDHCP = true;
+  networking.interfaces.wlp3s0.useDHCP = true;
+
+  # Configure network proxy if necessary
+  # networking.proxy.default = "http://user:password@proxy:port/";
+  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
+
+  # Select internationalisation properties.
+  # i18n.defaultLocale = "en_US.UTF-8";
+  # console = {
+  #   font = "Lat2-Terminus16";
+  #   keyMap = "us";
+  # };
+
+  # Set your time zone.
+  time.timeZone = "Europe/Warsaw";
+
+  nixpkgs.config = {
+    allowUnfree = true;
+  };
+
+  # List packages installed in system profile. To search, run:
+  # $ nix search wget
+  environment.systemPackages = with pkgs; [
+    # Basic tools
+    stdenv wget vim curl htop dnsutils zip unzip
+    zsh neovim ripgrep jq groff file pinentry_gnome
+    ssh-ident
+
+    # XORG perfs
+    xorg.xorgserver xorg.xf86inputevdev xorg.xf86inputsynaptics xorg.xf86inputlibinput
+    xorg.xf86videointel
+    noto-fonts-extra dunst xclip
+    xwallpaper
+    nur.repos.pn.dmenu xdotool
+    # screenkey
+
+    # UI apps
+    zathura ncmpcpp brave sxiv pulsemixer
+    lynx lf nur.repos.pn.st arandr wpa_supplicant_gui
+    system-config-printer libreoffice teams
+    vscodium abook
+
+    # Audio/Video
+    mpd mpc_cli mpv ffmpeg youtube-dl
+
+    # CLIs
+    lm_sensors
+    fzf gitAndTools.gh docker-compose xsel
+    bc libnotify
+    pamixer maim killall
+    quickserve ueberzug chafa
+
+    # Thinkpad utils
+    nur.repos.pn.dockd
+
+  ];
+
+  # Pure conf
+  environment.etc = {
+    "zsh/zshenv".text = ''
+      export ZDOTDIR=$HOME/.config/zsh
+    '';
+  };
+
+  environment.variables = {
+    XDG_CONFIG_HOME = "$HOME/.config";
+    XDG_DATA_HOME = "$HOME/.local/share";
+  };
+
+  # Some programs need SUID wrappers, can be configured further or are
+  # started in user sessions.
+  # programs.mtr.enable = true;
+  programs.gnupg = {
+    agent = {
+      enable = true;
+      enableSSHSupport = true;
+      pinentryFlavor = "gnome3";
+    };
+  };
+
+  programs.zsh = {
+    enable = true;
+    enableCompletion = true;
+    autosuggestions.enable = true;
+    histFile = "$XDG_DATA_HOME/zsh/history";
+
+    syntaxHighlighting.enable = true;
+  };
+
+  programs.vim.defaultEditor = true;
+  programs.slock.enable = true;
+  programs.browserpass.enable = true;
+  programs.dockd.enable = true;
+  programs.adb.enable = true;
+
+  virtualisation.docker.enable = true;
+  # virtualisation.anbox.enable = true;
+
+  # List services that you want to enable:
+
+  # services.udev.packages = [
+  #   pkgs.android-udev-rules
+  # ];
+
+  # Enable the OpenSSH daemon.
+  # services.openssh.enable = true;
+
+  # Open ports in the firewall.
+  # networking.firewall.allowedTCPPorts = [ ... ];
+  # networking.firewall.allowedUDPPorts = [ ... ];
+  # Or disable the firewall altogether.
+  networking.firewall.enable = false;
+
+  # Enable CUPS to print documents.
+  services.printing = {
+    enable = true;
+    drivers = [ pkgs.epson_201207w ];
+  };
+
+  services.cron.enable = true;
+  services.fcron.enable = true;
+
+  services.acpid.enable = true;
+
+  # Enable sound.
+  sound.enable = true;
+  hardware.pulseaudio.enable = true;
+
+  # Enable the X11 windowing system.
+  services.xserver.enable = true;
+  services.xserver.displayManager.startx.enable = true;
+  services.xserver.layout = "pl";
+  # services.xserver.xkbOptions = "eurosign:e";
+
+  # Enable touchpad support.
+  services.xserver.libinput.enable = true;
+
+  # Enable the KDE Desktop Environment.
+  #services.xserver.displayManager.sddm.enable = true;
+  #services.xserver.desktopManager.plasma5 = {
+  #  enable = true;
+  #};
+
+  # i3
+  #services.xserver.desktopManager.xterm.enable = false;
+  #services.xserver.displayManager.defaultSession = "none+i3";
+  #services.xserver.windowManager.i3 = {
+  #  enable = true;
+  #  package = pkgs.i3-gaps;
+  #  extraPackages = with pkgs; [
+  #    i3status
+  #    i3lock
+  #    i3blocks
+  #  ];
+  #};
+
+  # XFCE + i3
+  #services.xserver.displayManager.defaultSession = "xfce+i3";
+  #services.xserver.desktopManager = {
+  #  xterm.enable = false;
+  #  xfce = {
+  #    enable = true;
+  #    noDesktop = true;
+  #    enableXfwm = false;
+  #  };
+  #};
+  #services.xserver.windowManager.i3 = {
+  #  enable = true;
+  #  package = pkgs.i3-gaps;
+  #  extraPackages = with pkgs; [
+  #    i3status
+  #    i3lock
+  #    i3blocks
+  #  ];
+  #};
+
+
+  # Define a user account. Don't forget to set a password with ‘passwd’.
+  users.users.pn = {
+    isNormalUser = true;
+    extraGroups = [ "wheel" "video" "docker" "adbusers" ]; # Enable ‘sudo’ for the user.
+  };
+
+  users.defaultUserShell = "/run/current-system/sw/bin/zsh";
+  security.sudo.wheelNeedsPassword = false;
+
+
+
+  # This value determines the NixOS release from which the default
+  # settings for stateful data, like file locations and database versions
+  # on your system were taken. It‘s perfectly fine and recommended to leave
+  # this value at the release version of the first install of this system.
+  # Before changing this value read the documentation for this option
+  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
+  system.stateVersion = "20.09"; # Did you read the comment?
+
+}
diff --git a/platforms/linux/xorg/default.nix b/platforms/linux/xorg/default.nix
index 21bb4de..ad3fc1f 100644
--- a/platforms/linux/xorg/default.nix
+++ b/platforms/linux/xorg/default.nix
@@ -21,7 +21,6 @@ in
     xcompmgr
     picom
     dunst
-    unclutter
     nur.repos.pn.dockd
     pndwmblocks
     pndwm
@@ -42,7 +41,7 @@ in
       picom &
       dunst &			# dunst for notifications
       xset r rate 300 50 &	# Speed xrate up
-      unclutter &		# Remove mouse when idle
+      # unclutter &		# Remove mouse when idle
       #sxhkd &
       dockd --daemon &
       for app in `ls ~/.config/autostart/*.desktop`; do
diff --git a/programs/aliases.nix b/programs/aliases.nix
index d947226..9667790 100644
--- a/programs/aliases.nix
+++ b/programs/aliases.nix
@@ -1,4 +1,6 @@
 {
+  cfd = "cd ~/.config/nixpkgs";
+
   cp = "cp -iv";
   mv = "mv -iv";
   rm = "rm -iv";
diff --git a/programs/rclone.nix b/programs/rclone.nix
new file mode 100644
index 0000000..a8c4782
--- /dev/null
+++ b/programs/rclone.nix
@@ -0,0 +1,30 @@
+{ pkgs, config, ... }:
+
+let
+    mountdir = "${config.home.homeDirectory}/zhr/drive";
+in
+{
+  home.packages = with pkgs; [
+    rclone
+  ];
+
+    systemd.user = {
+        services.gdrive_mount = {
+            Unit = {
+                Description = "mount google-drive dirs";
+            };
+            Install.WantedBy = [ "multi-user.target" ];
+            Service = {
+                # ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountdir}";
+                ExecStart = ''
+                    ${pkgs.rclone}/bin/rclone mount zhr-drive: ${mountdir}
+                '';
+                # ExecStop = "${pkgs.coreutils}/bin/umount ${mountdir}";
+                Type = "notify";
+                Restart = "always";
+                RestartSec = "10s";
+                Environment = [ "PATH=${pkgs.fuse}/bin:$PATH" ];
+            };
+        };
+    };
+}
diff --git a/programs/zsh/precomp.zshrc b/programs/zsh/precomp.zshrc
index 6398877..c19a3c5 100644
--- a/programs/zsh/precomp.zshrc
+++ b/programs/zsh/precomp.zshrc
@@ -1,6 +1,8 @@
 [ -f ~/.nix-profile/etc/profile.d/nix.sh ] && . ~/.nix-profile/etc/profile.d/nix.sh
 export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
 
+source ~/.zprofile
+
 autoload -U colors && colors
 PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "