Code Monkey home page Code Monkey logo

nix-dotfiles's Introduction

James' Dotfiles

Welcome to my dotfiles. This is a mess of NixOS and Home-Manager

NixOS

Installation

  1. Install Nixos on a device
  2. deploy this repo
    1. Clone it
      1. sudo nixos-rebuild switch --flake .#${nixosConfiguration.name}
    2. Remote deploy it
      1. nixos-rebuild --target-host [email protected] --use-remote-sudo switch --flake .#klipperpi

Raspberry Pi

Some pain points when configuring the raspberry pi and building the image to flash it.

Agenix requires the public key of the host that you are deploying the secret to. Specifically a pubkey from /etc/ssh. This is configured on first boot. So how do you flash the pi and have the wifi configuration baked in as I have it setup in the configuration.nix. Before I can do that I have to do the following:

  1. hard code the wifi password
  2. build the image
  3. flash the sd card
  4. deploy the pi
  5. ssh into the pi and get the pubkey
  6. build the secret with agenix
  7. update the configuration to consume the secret

This is all a pain in the ass and exposes the wifi secret in your local /nix/store.(nix-collect-garbage -d is your friend after this).


Possible Option: Thanks Blades

Flash the sd for the pi as an access point. Fetch the pubkey and then proceed with agenix to set up and configure the wifi network. Router AP Example

Agenix Workflow

so my brain remembers
  1. Get the pubkey for the device that will consume the secret from /etc/ssh
  2. Add that pubkey to secrets.nix
    1. I think you can use a different secret for things that are specific to the user. But I haven't had a need yet.
  3. Create the secret
    1. cd secrets/ or make the directory and cd there
    2. nix run github:ryantm/agenix -- -e klipperpi.age < This should point at the secretName.age you just added
    3. A text editor will pop up and you add your secret in whatever format you need (k:v, rsa, env, string)
    4. Save the file and it will populate as secrets/secretName.age
  4. Consume the secret
    1. Wherever you need to consume the secret add a file reference to it
      1. age.secrets.klipperpi.file = ../../secrets/klipperpi.age;
    2. Then add a path reference to whatever consumes it.
      1. wireless.environmentFile = config.age.secrets.klipperpi.path;
        

wireless.environmentFile reference

Nifty Features

In here I've set some basic sane settings for configuring firefox based on ffprofiles.com. You can create multiple profiles and override the defaultSettings with the // construct.

{
  programs.firefox.profiles.NAME.settings = defaultSettings // {
    "app.update.auto" = false;
    "browser.startup.homepage" = "https://lobste.rs";
  };
}

This is actually configured in a few places:

  • Package install
  • Firewall Rules This won't work without some TCP and UDP ports open
    {
      networking.firewall = {
        allowedTCPPortRanges = [
          # KDE Connect
          { from = 1714; to = 1764; }
        ];
        allowedUDPPortRanges = [
          # KDE Connect
          { from = 1714; to = 1764; }
        ];
      };
    }
    Then you install KDE Connect on your phone. And follow the instructions to set it up.

Inspiration / Credit Links:

Blades dots

Aldoborrero's blog

nix-dotfiles's People

Contributors

jamesatintegratnio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.