Skip to content

Latest commit

 

History

History
182 lines (166 loc) · 5.16 KB

wiki.org

File metadata and controls

182 lines (166 loc) · 5.16 KB

Wiki

Connect to bluetooth

$ bluetoothctl
[bluetooth] # power on
[bluetooth] # agent on
[bluetooth] # default-agent
[bluetooth] # scan on
...put device in pairing mode and wait [hex-address] to appear here...
[bluetooth] # pair [hex-address]
[bluetooth] # connect [hex-address]

Garbage collection

nix-collect-garbage

Get info for fetchFromGitHub

nix shell nixpkgs#nix-prefetch-git
nix-prefetch-git https://github.com/MarianArlt/sddm-sugar-dark

Update flake

# Update flake.lock
sudo nix flake update

# Or replace only the specific input, such as home-manager:
sudo nix flake lock --update-input home-manager

# Apply the updates
sudo nixos-rebuild switch --flake .

Screenshots

grim -g “$(slurp)” - | wl-copy wl-paste > ~/Pictures/screen.png

Doom emacs java

So I had a bunch of problems with java in doom + nix but now everything seems to be working Steps I took:

  1. Turn on java in doom
  2. Create dummy project with maven
  3. Open java class in it and wait for lsp to download all it needs
  4. Configure spring like this
    (after! lsp-java
      (require 'lsp-java-boot)
      (require 'dap-java)
    
      ;; to enable the lenses
      (add-hook 'lsp-mode-hook #'lsp-lens-mode)
      (add-hook 'java-mode-hook #'lsp-java-boot-lens-mode)
      (add-hook 'java-mode-hook #'lsp-java-boot-lens-mode)
      (setf lombok-jar-path "/home/omen/.m2/repository/org/projectlombok/lombok/1.18.26/lombok-1.18.26.jar")
      (setq lsp-java-vmargs `(
                              "-XX:+UseParallelGC"
                              "-XX:GCTimeRatio=4"
                              "-XX:AdaptiveSizePolicyWeight=90"
                              "-Dsun.zip.disableMemoryMapping=true"
                              "-Xmx1G"
                              "-Xms100m"
                              ,(concat "-javaagent:" lombok-jar-path)
                              )
            )
      )
        
  5. Create dummy project with spring in it. DO NOT USE lsp stuff to generate it (seems like it is broken some way)
  6. Open some class in project and wait for lsp do update some stuff

Encrypt pdf

qpdf --verbose --encrypt USER_PASSWORD OWNER_PASSWORD 256 -- file_in.pdf file_out.pdf

Running maven+spring in nixos

So if you just try to run src_bash[:exports code]{mvn clean install} in terminal you would get errors for running integration test. For this to work you would need to use this shell.nix

{ pkgs ? import <nixpkgs> {} }:

(pkgs.buildFHSEnv {
  name = "simple-x11-env";
  targetPkgs = pkgs: (with pkgs; [
    maven
    jdk17
  ]);
  multiPkgs = pkgs: (with pkgs; [
    maven
    jdk17
  ]);
  runScript = "zsh";
}).env

Copy with progress

rsync -ah --progress source destination

Gpg authinfo issue

Had some issues accessing `.authinfo.gpg` file. Needed to kill gpg-agent and start it again like:

# kill agent
gpgconf --kill gpg-agent

# start it
gpg-agent

Nix format

sudo nix fmt

Sound issues

For some reason sound stoped working and was able to fix using:

systemctl --user restart pipewire.service

Sops

Notes: After installation src_bash[:exports code]{nixos-rebuild test –flake .#uzume} returns error but after running src_bash[:exports code]{nixos-rebuild boot –flake .#uzume} and running test again issue fixed

Integrate your configuration with sops

  1. Enter nix shell with necessary packages
    nix shell nixpkgs#ssh-to-age nixpkgs#age nixpkgs#sops
        
  2. Create master key
    mkdir -p ~/.config/sops/age
    age-keygen -o ~/.config/sops/age/keys.txt
        
  3. Get public key for the generated one
    age-keygen -y ~/.config/sops/age/keys.txt
        
  4. Create .sops.yaml file Primary key is from previous steps, it should be backed up somewhere else as you will use it as backup key in case something happens and you can’t access secrets using other keys Omen key is based on public ssh key from /etc/ssh/ssh_host_ed25519_key.pub (enabled openssh service for this)
    keys:
      - &primary age19wvqtn4ju6k4vs8fxr34unl6xx4cv04jw0lx9ps20xlde927zfssgl4qke
      - &omen age1jggd0cqn7c3ajqphnd0tt7kud3tqdz6uv3mkghhkzdtf4f0xrp2qtuvsks
    creation_rules:
      - path_regex: secrets/secrets.yaml$
        key_groups:
          - age:
              - *primary
              - *omen
        
  5. Create secrets file and populate them
    sops secrets/secrets.yaml
        
  6. Create sops.nix configuration
    { config, lib, pkgs, inputs, ... }:
    
    {
      imports = [
          inputs.sops-nix.nixosModules.sops
      ];
    
      sops = {
        defaultSopsFile = ./secrets/secrets.yaml;
        validateSopsFiles = false;
    
        age = {
          sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
          keyFile = "/var/lib/sops-nix/keys.txt";
          generateKey = true;
        };
    
        secrets = {
          omen-password = {
            neededForUsers = true;
          };
        };
      };
    }
        

Now you can use your secrets in nix configurations