Code Monkey home page Code Monkey logo

dotfiles's Introduction

Dotfiles

My NixOS configuration files.

If installing NixOS from scratch

Generate a public key and add it to github:

Generate a key without a passphrase

ssh-keygen

Visit https://github.com/settings/keys and add the contents of ~/.ssh/id_rsa.pub

Download the repository

nix-shell -p vim git
mkdir ~/github
cd ~/github
git clone [email protected]:frandibar/dotfiles.git

If the machine being installed was already configured, then the machine specific configuration files are already present in the repository. Create a symlink to the proper configuration and rebuild

sudo rm /etc/nixos/configuration.nix /etc/nixos/hardware-configuration.nix
sudo ln -s $HOME/github/dotfiles/hosts/<hostname>/configuration.nix /etc/nixos/configuration.nix
sudo ln -s $HOME/github/dotfiles/hosts/<hostname>/hardware-configuration.nix /etc/nixos/hardware-configuration.nix

If the machine being installed was never configured, then we must create the configuration files specific to this machine.

mkdir $HOME/github/dotfiles/hosts/<hostname>
cp /etc/nixos/hardware-configuration.nix $HOME/github/dotfiles/hosts/<hostname>/
sudo rm /etc/nixos/configuration.nix

Create an initial configuration file under ~/github/dotfiles/hosts/<hostname>/configuration.nix containing:

{ config, pkgs, ... }: {

  imports = [
    ../../configuration.nix
    ./hardware-configuration.nix
  ];
  
  networking.hostName = "<hostname>"
}

And make a symlink to this file

sudo ln -s $HOME/github/dotfiles/hosts/<hostname>/configuration.nix /etc/nixos/configuration.nix

Any machine specific fine tuning should be added to the host config. Now continue with the next section.

First time only

Create a symlink to configuration.nix at /etc/nixos so that we don't need to specify the file to nix-build explicitly. If not we must run

sudo nixos-rebuild switch -I nixos-config=configuration.nix`

Add channel for home manager:

sudo nix-channel --add  https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
sudo nix-channel --update

Checkout Doom Emacs repository

cd ~
git clone [email protected]:doomemacs/doomemacs.git
ln -s $HOME/doomemacs $HOME/.config/emacs
cd doomemacs/bin
./doom install
./doom sync

Some cases may require creating a swap file if no partition was set. If so declare it in hardware-configuration.nix for the specific host. Set the size as big as available RAM in order to be able to hibernate.

sudo dd if=/dev/zero of=/swap-file count=36000 bs=1M

Build

Whenever a configuration file changes, run

sudo nixos-rebuild switch

dotfiles's People

Contributors

frandibar 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.